if (String->Message(8)) { Link->X += 116; }but got an error (I forgot which error though).
How do I put it to where if on Message 8 something happens
Started by
LikeLike888
, Jul 06 2018 11:06 AM
2 replies to this topic
#1
Posted 06 July 2018 - 11:06 AM
I have tried something like
#2
Posted 09 July 2018 - 01:12 AM
Such as ^ for example how do I properly code if Message 8 is being shown Link's X and Y position is 17
#3
Posted 09 July 2018 - 04:49 AM
void Screen->Message(int id) is type (void).
There's no specfic way to determine when a message clears: It doesn't return if the message has cleared. (It might be worth adding a way to determine if a message is done, at some future point.)
If the Quest Rule, 'Messages Freeze All Action' is enbled, you can try to determine when the message clears, as action resumes.
This should freeze ffc code too, so the instruction that you want is merely:
That should move Link as soon as the message clears.
-----------------------------------
The error that you would have seen was something like:
...which should probably report, instead:
You used String->, rather than Screen->, however, had you called:
You would have instead seen:
Remember to check the function return types in zscript.txt, and std.txt.
Functions with a (void) type have no return value, and thus cannot be evaluated in statements, nor used in expressions.
--------------
We call this a procedural function:
https://en.wikipedia.../wiki/Void_type
https://www.quora.co...a-pure-function
There's no specfic way to determine when a message clears: It doesn't return if the message has cleared. (It might be worth adding a way to determine if a message is done, at some future point.)
If the Quest Rule, 'Messages Freeze All Action' is enbled, you can try to determine when the message clears, as action resumes.
This should freeze ffc code too, so the instruction that you want is merely:
Screen->Message(8) //with this QR, no instructions run until the player clears the message. Link->X += 116;
That should move Link as soon as the message clears.
-----------------------------------
The error that you would have seen was something like:
Err S09: Variable 'String' is undeclared.
...which should probably report, instead:
Invalid pointer type on token 'String'
You used String->, rather than Screen->, however, had you called:
if ( Screen->Message(8) )
You would have instead seen:
Err T17: Cannot cast from void to bool.
Remember to check the function return types in zscript.txt, and std.txt.
Functions with a (void) type have no return value, and thus cannot be evaluated in statements, nor used in expressions.
--------------
We call this a procedural function:
https://en.wikipedia.../wiki/Void_type
https://www.quora.co...a-pure-function
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users