Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

How to add two conditions in CYS Script?

4 hours ago
I'm currently writing a small story, and it being my first, I am quite confused with the unique scripting. I am looking to find out if there is any sort of IF AND THEN thread. The website does not recognize "AND" as term, and I'm wondering if there is some other kind of AND.

Ex. IF $ITEMSTATE2 = 1 AND $DEST = 1 THEN %OFFENSE := %OFFENSE + 1 AND %DEFENSE := %DEFENSE + 1

Yes, this is to detect if an item is picked up and to add certain points to variables based off of whether it is picked up. If there is a different way to do that, or if it's not possible, please tell me.

How to add two conditions in CYS Script?

4 hours ago
I'm pretty sure AND does work in certain circumstances, but you don't need it in this case, just list your variable checks and results on separate lines and it'll process them all in order.

How to add two conditions in CYS Script?

4 hours ago
Example please?

How to add two conditions in CYS Script?

52 minutes ago

Use the AND to connect conditions, not to make multiple things happen when a condition is met. That's what a BEGIN END block is for your example should work like this:

IF $ITEMSTATE2 = 1 AND $DEST = 1 THEN BEGIN     %OFFENSE := %OFFENSE + 1
    %DEFENSE := %DEFENSE + 1
END

Or in Mizal's way

IF $ITEMSTATE2 = 1 THEN BEGIN
    IF $DEST = 1 THEN BEGIN
       %OFFENSE := %OFFENSE + 1
       %DEFENSE := %DEFENSE + 1
    END
END