change rule
sonicm3
Member Posts: 141
Hi, i have created a boolean 0 = false and 1= true
how can i change a rule to OFF based on changing values.
if true, change rule to OFF
if false change rule to TRUE
Comments
change attribute: game.myBoolean To: not(game.myBoolean)
sorry i wasnt clear my fault.
i mean, how can i write a rule that turns off another rule.
You can't directly switch a rule off (that's to say, you can't disable it so it's ignored), but you can give a rule a condition - or wrap it in another rule - that it needs to meet in order for it to run.
So for example if you have a rule that says:
If High-score is higher than 10,000
--Change bonus to bonus+50
--Change colour to gold
And you wanted to disable the rule, then you'd simply wrap it in another rule like this . . .
If X is true
--If High-score is higher than 10,000
----Change bonus to bonus+50
----Change colour to gold
So, now by changing X to either 1 or 0 (true or false) you can switch the whole rule on or off.
Watch my GSlogic series or my video how rules work.....
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Socks thankyou very much and also lost_
You guys gave me a great workaround. Can you tell me how i can write this command properly.
IF game.rules is True
DO
*make the actor invisible
I think its via graphics, but not sure the command.
something like.. self.graphics.visibleFALSE or -1 ?
@sonicm3 if game.rules is true change attribute self.color.alpha to 0
Thanks icebox. That worked great, but it didnt solve my issue, i thought it would ahh!
My problem is, when im dragging an actor with my mouse during the game testing, if i hit another actor it moves it around. Im trying to look for a way where i can disable actor1s physics so when im moving actor2 it doesnt knock it off the platform, but still shows the actor.
Ive code all the code done ect for moving changing the boolean true and false, but need some way i can add to make actor1 disabled.
If game.rules is TRUE
DO
SOMETHING HERE to make this actor disabled until my other actor changed the attribute back to false
Switch moveable off on actor 2 so it doesn't get knocked off
Unfortunately you can't switch an actor's 'visible' attribute on or off at runtime (while the game is running).
But you can make the actor invisible in various other ways, change its size to 0 x 0, change its alpha channel value to 0 or move the actor off scene and so on.
So . . .
When game.rule is true
--Change self.colour.alpha to 0
When game.rule is true
--Change size width to 0
--Change size height to 0
When game.rule is true
--Change x position to -400
. . . etc.
They'll all have the effect of the actor instantly dissapearing from the scene.
Thanks both of you, PERFECT!!!
guys just really quickly, how would i write a command to turn moveable off?
DO
self.physics.movable to : false? or 0 ?
You cant turn moveable off during gameplay , you can keep moveable on and give the actor high density , maybe 100 + it will keep it from moving , or you can constrain its position so that it doesnt move.
thats a great idea, yeah done that, thanks alot mate, appreciate it alot.