A friend of mine had the desire to create a timer that, every five minutes, used the 'qmorph <name>' command to randomly change his description to one of fourteen designed choices. He came to me asking how it could be done, and I showed him a sample alias that had a 50% chance to smile and a 50% chance to grin. Based off of that and a little independant research, he came up with the code that follows, which is having problems.
He has a MUSHclient variable named 'number' that's blank by default, which stores the random number generated by the randomizer. When he runs the script (I made it into an alias and it's doing the exact same thing), it almost always chooses 'qmorph prinny', despite the 5% chance he assigned to it. Occasionally, it'll 'qmorph delibird', but the other options seem to be completely ignored. I watched the 'number' variable between commands and it is changing as it should, the script just seems to be getting stuck at prinny/delibird.
Anyway, without further ado, I present the script (yes, it's bad code, but it's one of his first attempts at it):
Randomize
world.SetVariable "number", Rnd
If world.getvariable ("number") > "0.95" Then
world.Send "qmorph delibird"
Elseif world.getvariable ("number") > ".90" Then
world.Send "qmorph prinny"
Elseif world.getvariable ("number") > ".85" Then
world.Send "qmorph metro-taur"
Elseif world.getvariable ("number") > ".80" Then
world.Send "qmorph gamma"
Elseif world.getvariable ("number") > ".75" Then
world.Send "qmorph tundraswan"
Elseif world.getvariable ("number") > ".65" Then
world.Send "qmorph sinow"
Elseif world.getvariable ("number") > ".60" Then
world.Send "qmorph lerk"
Elseif world.getvariable ("number") > ".55" Then
world.Send "qmorph fade"
Elseif world.getvariable ("number") > "0.50" Then
world.Send "qmorph sawfly"
Elseif world.getvariable ("number") > "0.45" Then
world.Send "qmorph normal"
Elseif world.getvariable ("number") > "0.40" Then
world.Send "qmorph dragon"
Elseif world.getvariable ("number") > "0.35" Then
world.Send "qmorph blackswan"
Else
world.Send "qmorph porpoise"
End If
Any idea what might be causing this to happen?
He has a MUSHclient variable named 'number' that's blank by default, which stores the random number generated by the randomizer. When he runs the script (I made it into an alias and it's doing the exact same thing), it almost always chooses 'qmorph prinny', despite the 5% chance he assigned to it. Occasionally, it'll 'qmorph delibird', but the other options seem to be completely ignored. I watched the 'number' variable between commands and it is changing as it should, the script just seems to be getting stuck at prinny/delibird.
Anyway, without further ado, I present the script (yes, it's bad code, but it's one of his first attempts at it):
Randomize
world.SetVariable "number", Rnd
If world.getvariable ("number") > "0.95" Then
world.Send "qmorph delibird"
Elseif world.getvariable ("number") > ".90" Then
world.Send "qmorph prinny"
Elseif world.getvariable ("number") > ".85" Then
world.Send "qmorph metro-taur"
Elseif world.getvariable ("number") > ".80" Then
world.Send "qmorph gamma"
Elseif world.getvariable ("number") > ".75" Then
world.Send "qmorph tundraswan"
Elseif world.getvariable ("number") > ".65" Then
world.Send "qmorph sinow"
Elseif world.getvariable ("number") > ".60" Then
world.Send "qmorph lerk"
Elseif world.getvariable ("number") > ".55" Then
world.Send "qmorph fade"
Elseif world.getvariable ("number") > "0.50" Then
world.Send "qmorph sawfly"
Elseif world.getvariable ("number") > "0.45" Then
world.Send "qmorph normal"
Elseif world.getvariable ("number") > "0.40" Then
world.Send "qmorph dragon"
Elseif world.getvariable ("number") > "0.35" Then
world.Send "qmorph blackswan"
Else
world.Send "qmorph porpoise"
End If
Any idea what might be causing this to happen?