Jump to content

Photo

[NOT][2.53.1 Beta 51] Issue with 'newer' script


  • This topic is locked This topic is locked
6 replies to this topic

#1 klop422

klop422

    Guess I'm full of monsters and treasure

  • Members
  • Real Name:Not George
  • Location:Planet Earth

Posted 11 August 2020 - 09:15 AM

It seems the check for whether newer functions in a script is a bit trigger happy about not having new functions. My script buffer contains the word 'repeat' a few times (in a timed secrets script, I forget where from, which I'll put at the end of this post; I've checked the rest of my script buffer to make sure the word 'repeat' doesn't show up) and therefore ZQuest doesn't let me use the script.

 

I mean, the easy workaround (which I'm doing) is to just rename the 'repeat' variable, but I still feel it's an issue.

 

Here's the script in question, for interest:

// The script will activate secrets after 'frames' number of frames (set as D0).
// If D1 is set, it will repeat it as many times as specified; if 0, then repeat indefinitely
// It will also play the sound specified in D2
ffc script TimedSecrets {
	void run (int frames, int repeat, int sound) {
		Waitframes(15);

		// If repeat is above 0, then it will repeat that many times
		if (repeat > 0) {
			while(repeat > 0){
				Waitframes(frames);
				Screen->TriggerSecrets();
				Game->PlaySound(sound);
				repeat -= 1;
			}
		}
		// If repeat is not above 0, then it will repeat indefinitely
		else {
			while(true) {
				Waitframes(frames);
				Screen->TriggerSecrets();
				Game->PlaySound(sound);
			}
		}
	}
}

 



#2 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 11 August 2020 - 09:17 AM

`repeat` is a keyword, just like `if`, `else`, etc. If you have variables that use it, or any other keyword, as a var name, you need to rename them.

#3 klop422

klop422

    Guess I'm full of monsters and treasure

  • Members
  • Real Name:Not George
  • Location:Planet Earth

Posted 11 August 2020 - 10:31 AM

Fair enough.

 

The error message was slightly confusing, though :P. That's a much more minor bug, though.



#4 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 11 August 2020 - 10:33 AM

What is the specific error message?

#5 klop422

klop422

    Guess I'm full of monsters and treasure

  • Members
  • Real Name:Not George
  • Location:Planet Earth

Posted 11 August 2020 - 03:42 PM

Here's what I get:

THE STATEMENT TYPE `REPEAT()' IS EXCLUSIVE TO ZSCRIPT V14 AND HIGHER.
PLEASE UPGRADE TO ZQUEST 2.55 (OR ABOVE) TO USE IT.

Which pointed to the wrong issue here.

(Although it occurs to me that if 'repeat' is not a keyword in 2.53, it shouldn't really be flagged up as such either. But idk how it all works behind the scenes, so, you know.)

 

In any case, far as I can tell it didn't make my script stop working retroactively - though I haven't formally tested that, so it's probably worth checking for backwards compatibility - so it's (probably) a minor issue which only affects using old scripts.



#6 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 12 August 2020 - 06:43 AM

2.55 keywords were reserved in 2.53 as well, so that any script that compiles in 2.53 will also compile in 2.55. Better now than shortly down the line, is the idea. This does not affect already-compiled scripts, just re-compiling; a compiled script has no idea what the name of that variable is, as it's all just numbers at that level.



#7 klop422

klop422

    Guess I'm full of monsters and treasure

  • Members
  • Real Name:Not George
  • Location:Planet Earth

Posted 12 August 2020 - 08:17 AM

Ah right, fair




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users