Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Wed Apr 03, 2002 4:50 pm   

problem with %case
 
Ok, now I got this script acting wierd:

#TR {You receive (%d) experience points.} {#IF (%1>0) {%case( %random( 6), skin boots, skin leggings, skin sleeves, skin cloak, skin gloves, skin helm)}}

Every now an again(like 30-40 percent of the time) it wont actually send the command to the mud. It puts a carraige return where the command should go, but no command. I know because the output looks like this:

An orc screams as the flames engulf her!!
You receive 99 experience points.
You hear An orc's death cry.
You get An Orkish Scimitar from the charred corpse of An orc.
You get 1917 gold coins from the charred corpse of An orc.

Thats without the script running, but when it runs properly it looks like this:

An orc screams as the flames engulf her!!
You receive 99 experience points.
skin helm
You hear An orc's death cry.
You get An Orkish Scimitar from the charred corpse of An orc.
You get 1917 gold coins from the charred corpse of An orc.

But when it goofs, it looks like:
An orc screams as the flames engulf her!!
You receive 99 experience points.

You hear An orc's death cry.
You get An Orkish Scimitar from the charred corpse of An orc.
You get 1917 gold coins from the charred corpse of An orc.

Any idea where I went wrong?
Reply with quote
Stryfe
Wanderer


Joined: 16 Oct 2000
Posts: 50
Location: USA

PostPosted: Wed Apr 03, 2002 7:48 pm   
 
....(%1>0) {%case( %random( 6), skin ....

%random(6) can return 0, and when that happens, I think %case just returns nothing. To prevent it from returning 0, do %random(1,6)
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Wed Apr 03, 2002 11:08 pm   
 
Yup, that was it, thanks a bunch :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net