Jump to content

Photo

How do I put it to where if on Message 8 something happens


  • Please log in to reply
2 replies to this topic

#1 LikeLike888

LikeLike888

    Spicy food lover!!

  • Members
  • Real Name:Jason
  • Location:North America

Posted 06 July 2018 - 11:06 AM

I have tried something like
if (String->Message(8))
{
  Link->X += 116;
}
but got an error (I forgot which error though).

#2 LikeLike888

LikeLike888

    Spicy food lover!!

  • Members
  • Real Name:Jason
  • Location:North America

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 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

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:
 


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


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users