 |
TerrellKl Novice
Joined: 30 Aug 2005 Posts: 49
|
Posted: 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 |
|
|
 |
TerrellKl Novice
Joined: 30 Aug 2005 Posts: 49
|
Posted: 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 |
|
|
 |
TerrellKl Novice
Joined: 30 Aug 2005 Posts: 49
|
Posted: 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 |
|
|
 |
Insomniac Wanderer
Joined: 25 Mar 2004 Posts: 78 Location: United Kingdom
|
Posted: 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. |
|
|
 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: 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} |
|
|
 |
TerrellKl Novice
Joined: 30 Aug 2005 Posts: 49
|
Posted: 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? |
|
|
 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: 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) |
|
|
 |
|
|