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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
daemoan.vermillious
Apprentice


Joined: 28 Feb 2009
Posts: 135
Location: Chico, Ca

PostPosted: Wed Nov 11, 2009 5:15 am   

random trigger thing - make believe?
 
if I had a variable with a value like this?

bagvar

Value:
{One|Two|Three|Four|Five}

I made this up, I seen something somewhere like that.....

and i had a trigger like this

Pattern:
It is not in the bag.

Value:
Get %random@bagvar

I made that up too , it prolly donsnt work...

What can I do ?

Thanks
Reply with quote
orphean
Apprentice


Joined: 21 Oct 2008
Posts: 147
Location: Olympia, WA

PostPosted: Wed Nov 11, 2009 6:02 am   
 
First off, I'm not sure what you're asking.

If you're just trying to send a random item from a string list to the mud the way you are using just %random isn't going to work. From the documentation:

Quote:
random

Syntax: %random(min,max)

return a random integer >= min and <= max.


The script for the second pattern should be more like:
Quote:
get %item(@bagvar, %random(1, %numitems(@bagvar)))


If you could clarify what issue you're having that would help ensure you get help.
Reply with quote
daemoan.vermillious
Apprentice


Joined: 28 Feb 2009
Posts: 135
Location: Chico, Ca

PostPosted: Wed Nov 11, 2009 6:41 am   
 
I carry a bag around with healing friuts I jsut wanted it to "randomly" take one out every 30 ticks and eat it
at each feeding it would randomly pull one from the list
I wasnt having an issue I just didnt know how to do it... and wanted to know what would work.
but I was just using the numbers as an example

{Grapefruit|Bannana|Pear|Apple|Orange}

if this is so like this, this will still work?

get %item(@bagvar, %random(1, %numitems(@bagvar)))

Sry Spent last 2 days slowly absorbing different scripting techniques. getting jummbled...

thanks
Reply with quote
orphean
Apprentice


Joined: 21 Oct 2008
Posts: 147
Location: Olympia, WA

PostPosted: Wed Nov 11, 2009 6:59 am   
 
Yep that will work for that. Every time it gets called it will send 'get <random fruit from list>' to the mud.
Reply with quote
orphean
Apprentice


Joined: 21 Oct 2008
Posts: 147
Location: Olympia, WA

PostPosted: Wed Nov 11, 2009 7:01 am   
 
Also if @bagvar never changes you can replace %numitems(@bagvar) with the number of fruits in your list.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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