How to perform an attribute check

Hey, apologies if this question has been asked already but I'm sifting through information at the minute and can't quite work out what I'm doing wrong.

So I'm currently learning how to use Quest, and I have worked out how to set a strength attribute for my character. Then, after a little playing around, I worked out how to increase the strength attribute through scripts.

However, I can't for the life of me work out how to make a script check the attribute. For example, I've got it set so that there's a script that will check if the strength attribute is about 7 on leaving the room, and if it is it will print a brief message.

However I keep on getting this error message

Error running script: Error compiling expression 'player.strength = > 7 ': SyntaxError: Unexpected token ">"; expected one of "-", < INTEGER >, < REAL >, < STRING_LITERAL >, "True", "False", < HEX_LITERAL >, < CHAR_LITERAL >, "null", < DATETIME >, < TIMESPAN >, "(", < IDENTIFIER >, "if", or "cast"Line: 1, Column: 28

I'm sure there's just a syntax thing I'm missing out, but any help would be appreciated.


What are you trying?

I would assume you have code something like this?

if (game.pov.strength > 7) {
  msg ("This is a message")
}

(If you have player instead of game.pov that's valid; I find it's better to use game.pov when making suggestions on the forum, because it will work even if the other person has changed the name of the player object, or has more than one playable character)

From the error message, it looks like you have the > sign at the start of the condition. It needs to come between the two numbers you are comparing.


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

Support

Forums