About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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
TerrellKl
Novice


Joined: 30 Aug 2005
Posts: 49

PostPosted: Sun Oct 09, 2005 4:36 am   

Variable Trouble
 
itemlist {Hammer of Hatred|Axe of Agony|Sword of slaying|Mace of Might}

#var item %item( @Itemlist, %random( %numitems( @itemlist)))
#echo Random Item: @item

Shows "Random Item: Axe"
example2 "Random Item: Sword"
example3 "Random Item: Hammer"
example4 "Random Item: Mace"

How can i make it show
Random Item: Sword Of Slaying
?


Last edited by TerrellKl on Sun Oct 09, 2005 4:53 pm; edited 1 time in total
Reply with quote
TerrellKl
Novice


Joined: 30 Aug 2005
Posts: 49

PostPosted: Sun Oct 09, 2005 4:41 am   
 
nevermind.. figures 3 seconds after i make the thread i find how to fix it

New problem:

It seems that my >= or <= do not work.. why? it's really annoying
Reply with quote
TerrellKl
Novice


Joined: 30 Aug 2005
Posts: 49

PostPosted: Sun Oct 09, 2005 5:09 pm   
 
Bump.. I still cant figure out why
#if (@variable <= 25) {say your score was less than or equal to 25}

That doesn't fire if @variable is 25, but does if its 24. I dont know why. HELP!

also.. when i use
#var rps {Rock|Paper|Scissors}
#var rpsplayer {%item( @rps, %random( %numitems( @rps)))}
say @rpsplayer

sometimes the variable is blank
most the time it works.. anyway to stop that?

After putting this
#echo {%item( @rps, %random( %numitems( @rps)))}
into the command line line 20 times i got this.. (Example)

Paper
Rock

Scissors
Rock
Rock


Rock

Rock


Last edited by TerrellKl on Sun Oct 09, 2005 6:42 pm; edited 2 times in total
Reply with quote
Insomniac
Wanderer


Joined: 25 Mar 2004
Posts: 78
Location: United Kingdom

PostPosted: Sun Oct 09, 2005 5:44 pm   
 
I'm sorry, but it works fine for me when I tested it, using exactly the same code as you are...
_________________

No-one ever gets flamed for posting too much information. Conform to the PPP (Preferred Posting Protocol) and give as much information as possible, including MUD output where needed.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Oct 09, 2005 7:46 pm   
 
Well the variables are not needed for rps

#ALIAS rps {
say %item("Rock|Paper|Scissors",%random(1,3))!
}

and try this for the <=

#if (@variable<=25) {say your score was less than or equal to 25}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
TerrellKl
Novice


Joined: 30 Aug 2005
Posts: 49

PostPosted: Sun Oct 09, 2005 9:21 pm   
 
Well the variables are not needed for rps

#ALIAS rps {
say %item("Rock|Paper|Scissors",%random(1,3))!
}

That was just an example
I have a bigger variable.. a very big one..
and every now and then it sends Blankness.. any other way to stop it?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon Oct 10, 2005 4:11 am   
 
from the help for %random

return a random integer >= I and <= J. If J is omitted, then I specifies the maximum value, and 0 is used as the minimum value.

so why not try %random(1,blah)
_________________
Zmud Support Library
Zmud Knowledge Base
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