Jump - why does 'not' work
![](https://i.imgur.com/Lzd3mOwb.jpg)
Doctor Agon
25 Feb 2024, 23:44Hi guys,
In my game, I want to be able to stand on a bed and jump, this then gets me into the attic
I have a local command called jump set up in the room, as follows
if (player.posture = "stand" and player.posture_object = "bed") {
MoveObject (player, attic)
}
else {
msg ("You jump in the air.")
}
which doesn't work, but...
if (not player.posture = "stand" and not player.posture_object = "bed") {
msg ("You jump in the air.")
}
else {
MoveObject (player, attic)
}
does.
Why? They look essentially the same apart from the fact that they are reversed with the included 'not'
Ip Man
26 Feb 2024, 02:53I think you need some more parenthesis?
If ((player.posture = "stand") and (player.posture_object = "bed"))
I can't remember for sure. Or it might be that "and" needs to be uppercase?
![](https://i.imgur.com/8BcaZCyb.png)
DavyB
26 Feb 2024, 09:39Note:
not(player.posture = "stand" and player.posture_object = "bed") = (not player.posture = "stand" OR not player.posture_object = "bed")
![](https://i.imgur.com/Lzd3mOwb.jpg)
Doctor Agon
26 Feb 2024, 22:15Ok. Tried
if ((player.posture = "stand") and (player.posture_object = "bed")) {
MoveObject (player, attic)
}
else {
msg ("You jump in the air.")
}
as suggested by Ip Man above - No movement of player to attic, just kept printing the message "You jump in the air."
Also tried
if (not (player.posture = "stand" and player.posture_object = "bed")) {
MoveObject (player, attic)
}
else {
msg ("You jump in the air.")
}
As suggested by DavyB. You're able to jump to the attic, regardless of standing on the bed or not.
I wanted to 'stand' on the 'bed' and jump to the attic.
![](https://i.imgur.com/8BcaZCyb.png)
DavyB
27 Feb 2024, 08:34Are you sure that player.posture
and player.posture_object
have the correct values when this code is executed? If not, just put a debugging print statement before the code: msg(player.posture + ", " + player.posture_object)