Referencing variables
davidw
07 Sept 2003, 13:28I've got a variable called "score" which increases throughout the game I'm writing. At the end of the game, a different ending greets the player depending on what the "score" is at. But how do I do this?
What I'm after is:
If "score" less than 20 then display text score1
If "score" less than 40 then display text score2
If "score" less than 60 then display text score3
And so on... Only the problem is, I can't seem to figure out how to reference the "score" variable properly. I can change it with tasks but then when I try to add a condition that "score" must be less than 20, nothing happens.
Can anyone help?
What I'm after is:
If "score" less than 20 then display text score1
If "score" less than 40 then display text score2
If "score" less than 60 then display text score3
And so on... Only the problem is, I can't seem to figure out how to reference the "score" variable properly. I can change it with tasks but then when I try to add a condition that "score" must be less than 20, nothing happens.
Can anyone help?
kewldude606
07 Sept 2003, 14:12I might have made some mistakes w/ syntax, but you should get the general idea...
However, nothing happens if %score% is exactly 20, 40, or 60. To fix this this code would work:
Also, you have nothing for if score is above 60.
if %score% < 20 then msg <Text here>
if %score% < 40 AND %score% > 20 then msg <Text here>
if %score% < 60 AND %score% > 40 then msg <Text here>
However, nothing happens if %score% is exactly 20, 40, or 60. To fix this this code would work:
if %score% <= 20 then msg <Text here>
if %score% <= 40 AND %score% > 20 then msg <Text here>
if %score% <= 60 AND %score% > 40 then msg <Text here>
Also, you have nothing for if score is above 60.
davidw
07 Sept 2003, 15:23Thanks. Got it. Seems I wasn't enclosing score in %%. 
GameBoy
07 Sept 2003, 20:23always remember to use %'s and #'s unless it says not too, that way you dont go wrong 
Alex
07 Sept 2003, 20:47Looked like breasts before
What is it supposed to be??
Edit: N.B. That was a response to the comment at the end of Ste's sig which has since been removed... in case anybody thought this thread was taking a bizarre twist
Edit: N.B. That was a response to the comment at the end of Ste's sig which has since been removed... in case anybody thought this thread was taking a bizarre twist
GameBoy
07 Sept 2003, 21:56lol i PMed you, its a rock star with his hands in the air, like the guy on the right is doing... and the 'breasts' is the face, 2 eyes and a nose? lol


Alex
08 Sept 2003, 07:01codingmasters
01 Nov 2003, 06:24If you use the example script givenin the very first post of this thread, that's the example I mean for the Exit Sub(in this case script) command!
Check out this thread to see what I mean: http://www.axeuk.com/phpBB2/viewtopic.php?t=175
Matthew G.
Check out this thread to see what I mean: http://www.axeuk.com/phpBB2/viewtopic.php?t=175
Matthew G.
Anonymous
11 Nov 2003, 06:10Im new to Quest just recently a friend and I have decided to make a text RPG and chose quest. Well in our game we have money. The Variable name is money and if i wanted to but something you can use % or # for this:
%money%-200
and then you would buy something and it takes away $200 but it will still take away money even if i don't have that how do i fix it so you can only buy something if you have $200
or more? 
%money%-200
and then you would buy something and it takes away $200 but it will still take away money even if i don't have that how do i fix it so you can only buy something if you have $200
GameBoy
11 Nov 2003, 23:46if ( %money% <= 0 ) then msg <You do not have enough gold>
or if u wanted to buy something for 200 gold, and u only had 150 gold...
if ( %money% < 200 ) then msg <You do not have enough gold>
if using QDK, use condition scripts.
or if u wanted to buy something for 200 gold, and u only had 150 gold...
if ( %money% < 200 ) then msg <You do not have enough gold>
if using QDK, use condition scripts.