(Beginner) How do I change something based on the player's score?

I'm currently using

if (game.score>50) {
msg ("You are feeling stronger")
}

but it doesn't seem to work, since when I get the score over 50 nothing happens


That looks like it should work.

Where are you putting that script? Are you sure that the script is running?

It might be worth modifying it to something like:

if (game.score>50) {
  msg ("You are feeling stronger")
}
else {
  msg ("You're not feeling stronger yet")
}

Just temporarily, while you are testing it. If the wrong message appears, then the value of game.score isn't what you think it should be, which would give you a clue how to solve it. If neither message appears, then the problem lies in some of the code around that bit, because your "if" statement is not being checked.


I think I'm not calling it properly. How would I make the game check this every turn but only display it the first time it happens?


How would I make the game check this every turn but only display it the first time it happens?

To make it check every turn, you would create a turnscript. Make sure to tick the "Enabled" box (a lot of people forget).

To make it only happen once, you could use firsttime:

if (game.score>50) {
  firsttime {
    msg ("You are feeling stronger")
  }
}

or you could disable the turnscript when it's done its job:

if (game.score>50) {
  msg ("You are feeling stronger")
  DisableTurnScript (this)
}

Thank you!


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums