Parnassus wrote: I'd like to know what the difference is between a random switch and a random if.
You mean how the script Rumble posted differs from the one below?
Code:
Name: 'Switch Echo Example', VNum: [ 18], RNum: [ 18]
Trigger Intended Assignment: Rooms
Trigger Type: Enter , Numeric Arg: 100, Arg list: None
Commands:
wait 1
set num %random.3%
if %num% == 1
* only the person entering the room will see this.
%send% %actor% You trip over a root as you walk into the room.
* everyone in the room except the actor will see this.
%echoaround% %actor% %actor.name% trips on a root while walking into the room.
* everyone in the room will see this.
%echo% The root suddenly springs to life and attacks!
* let everyone in the zone hear about this.
%zoneecho% %self.vnum% %actor.name% is a clutz.
elseif %num% == 2
%send% %actor% You strut into the room.
%echoaround% %actor% %actor.name% Seems to have a big head..
%echo% A strong breeze kicks some leaves up into the air.
elseif %num% == 3
%echo% A light breeze picks up, causing the leaves to rustle quietly.
else
* this should be here, even if it's never reached
%echo% This is the default case, just in case I missed something. Get it? Just in case!
end
If so there's no difference, none that particularly matter anyway, just a matter of personal preference, and a potential difference in the amount of cpu time needed to run them both (I think the if check route actually uses less cpu time, but really, it's negligible).
Often switch cases are shorter, but in this instance it's actually less verbose to use the if check route.