Double Checking Syntax Again ^_^

Anonynn
05 Oct 2016, 17:49Hey all!
I was wanting to double check my syntax, or if it isn't correct figure out how to do this.
I want to apply a global "Command" to all rooms with a boolean check. Adding the boolean to the rooms is easy enough, but I'm not sure how to set up the check in a Command. Would this work?
if (GetBoolean(player.parent, "dance")) {
msg ("You can't dance here...")
}
else {
if (HasScript(player.parent, "dance")) {
do (player.parent, "dance")
}
else {
msg ("You dance!")
}
}
The Pixie
05 Oct 2016, 19:33Looks fine, but are you flagging rooms where the player cannot dance or where she can? If rooms she cannot, I would call it "nodance" rather than "dance". If flagging rooms she can dance, the first line would be:
if (not GetBoolean(player.parent, "dance")) {

Anonynn
05 Oct 2016, 19:48I guess marking rooms where she/he cannot dance would be a lot easier. Would that be this then?
if (GetBoolean(player.parent, "nodance")) {
msg ("You can't dance here...")
}
else {
if (HasScript(player.parent, "nodance")) {
do (player.parent, "nodance")
}
else {
msg ("You dance!")
}
}
The Pixie
06 Oct 2016, 07:08You should flag the rooms that are in the minority, just because it is less work for you. If there are less rooms the player cannot dance, flag them, because there are less of them.
I would leave the script attribute as "dance"; it is just better to have meaningful names for attributes so you know what they are in three months.