Hiya, I'm currently working on a sequence in my game which involves the player stumbling across a hive of monsters and alerting them, initiating a chase sequence in which they swarm after you.
The chase sequence takes place across multiple maps that you have previously visited, and I think the best way to initiate it would be with the autorun script, but obviously it shouldn't activate when you are not being chased, so the script needs to do a check to see if Tag 50 is on before running, if it's off the script should end.
I'm not too sure how the "If" functions work at the moment so I need a bit of help with this, thanks in advance!
-Samanthuel
Conditional Autorun Script
Moderators: marionline, SDHawk
-
- Red Slime
- Posts: 42
- Joined: Tue Feb 19, 2013 11:06 am
- Contact:
- Feenicks
- Metal Slime
- Posts: 697
- Joined: Tue Aug 10, 2010 9:23 pm
- Location: ON THE AIR IN THE AIR
- Contact:
If/else statements are set up like this:
Hopefully this is useful.
Code: Select all
If(condition) then(
#things to do if condition is true
)
#you can add extra 'else if(condition) then()' statements here if you need to
else(
#things to do if condition is false; if there's nothing here, you can leave out the else() statement
)
Specifically, use the "check tag" command, eg.
Code: Select all
if (check tag(50)) then (...)
I learned if statements and other things basically as sentences with weird grammar and punctuation. I could say, "If this tag is true, then run the script. If something else, then don't." Maybe this isn't really helpful, but I found it a good way to make sense of, for example, what Pheonix wrote right there. It at least puts it in perspective.
Also, there are websites like Codecademy that have free tutorials on several different languages, many of them for beginners. I just looked at the JavaScript one and it starts out with explaining if statements. They work differently in syntax than HamsterSpeak, but it's the same idea.
Also, there are websites like Codecademy that have free tutorials on several different languages, many of them for beginners. I just looked at the JavaScript one and it starts out with explaining if statements. They work differently in syntax than HamsterSpeak, but it's the same idea.
My pronouns are they/them
Ps. I love my wife
Ps. I love my wife