Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Joseph on Fri 04/06/2010 22:25:37

Title: eEventGotScore && game.score
Post by: Joseph on Fri 04/06/2010 22:25:37
Hola IM back ;D ;D ;D

just want a custome-made Gui to pop-open when my turtle gets a certain amount of points for mating :o
I did this in the on_event function--->
if (event==eEventGotScore && game.score==69)showTurtletreat();
if (event==eEventGotScore && game.score==169)showTurtletreat();

when the score gets to 69 or over...i see my window popup, (cool), but when the game continues and the score keeps going up, when it get to 169 or over, i dont see my turtle treats window :(
i DONt give points equally, sometime a turtle can get 1 pointm, sometime 6, so i never know when the playuer will get EXACTLY 69 points or 169.

Can someone help meeeeee???

Title: Re: eEventGotScore && game.score
Post by: Calin Leafshade on Fri 04/06/2010 22:38:10
Well you can use the greater than symbol (>) but then the turtle would be shown *every time* after 69.

So you need to set a flag of some kind.

Set a variable to the previous score before the new points were added. if that variable is less than 69 but the current score is greater than 68 you know that the threshold has only just been passed.


Title: Re: eEventGotScore && game.score
Post by: Joseph on Sat 05/06/2010 00:00:35
Mr. Leafshade, Im sorry but Im really pretty stupid, I dont realy understand how to do that :(
Title: Re: eEventGotScore && game.score
Post by: Dualnames on Sat 05/06/2010 04:39:21
Hey Jo, I'm wondering if this works your way better:

if (event==eEventGotScore && game.score>=69) {
if (Game.DoOnceOnly("scoresixnine")) {
showTurtletreat();
}
}
if (event==eEventGotScore && game.score>=169){
if (Game.DoOnceOnly("scoreonesixnine")) {
showTurtletreat();
}
}
Title: Re: eEventGotScore && game.score
Post by: Joseph on Sat 05/06/2010 16:48:01
WOwzers, if you guys were turtles I would offer you a 20% discount on turtle wax and throw in a few bags of treats for the kids  :o :o

Not only does it wurkk but I now LuVv you guys  :-* :-*

Title: Re: eEventGotScore && game.score
Post by: Calin Leafshade on Sat 05/06/2010 17:50:25
I totally forget about DoOnlyOnce. Nice one Dual