Axe Software Forums
  Quest Developer Forum
  Nesting if statements


Author Topic:   Nesting if statements
BigDaddy posted 19-12-2001 07:23 GMT     
I wanted to find out if nesting if statements in a command was the acceptable method of doing the following

This the statment I am usuing to handle droping things from above the ground, i.e. on a ladder, in a tree, onm the side of a cliff...

If the player moves into a room that is suppose to be above ground I load the variable Drop_to_room with the name of whatever room is the ground below them and I have this drop command in the define game block.

command <Drop #ItemToDrop#> if ( #Drop_to_room# <> ) then {
lose <#ItemToDrop#>
move <#ItemToDrop#; #Drop_to_room#>
msg <you drop the #ItemToDrop# and it falls down to the ground>
}
else {
lose <#ItemToDrop#>
msg <You drop the #ItemToDrop#>
}

My question is this, I can anticipate wanting to do more specialized results when certain things are dropped. Should I nest more if statements within this code or should I define special drop commands in the room and object blocks?

passerby posted 19-12-2001 12:36 GMT          
i'm not that familiar with Quest 3.x, but from a purely design point of view, it depends on how many specialized actions you will need. If you don't know how many you will need yet, it is much better to use specialized drop commands for rooms and objects.

Using nested ifs really only works if you're testing for three or less conditions, any more and you will become confused as to what you are trying to do.