|
Skaphia Beginner
Joined: 18 Dec 2002 Posts: 27 Location: USA
|
Posted: Wed Jan 08, 2003 10:35 am
Help to get a trigger responding from list? |
I play Realms of Despair and I need a way to have a line of text sauch as:
The dungeon bell rings loudly.
To trigger a random command from a list of about 1000 commands. Is that possible? And if it is possible, is there anyway to make that list be a variable? Thanks,
Skaphia |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Jan 08, 2003 12:38 pm |
Since we don't know anything about how you have the list stored, we can't provide help on turning it into a variable. However, it most likely is possible. The amount of work involved depends on how you have the list stored already.
To use the list from the trigger you could do something like:
#TRIGGER {The dungeon bell rings loudly.} {#EXEC %item(@mylist, %random(1, %numitems(@mylist)))}
Kjata |
|
|
|
Skaphia Beginner
Joined: 18 Dec 2002 Posts: 27 Location: USA
|
Posted: Wed Jan 08, 2003 5:04 pm |
quote:
Since we don't know anything about how you have the list stored, we can't provide help on turning it into a variable. However, it most likely is possible. The amount of work involved depends on how you have the list stored already.
To use the list from the trigger you could do something like:
#TRIGGER {The dungeon bell rings loudly.} {#EXEC %item(@mylist, %random(1, %numitems(@mylist)))}
Kjata
How I store the list is irrelevant as I just want the list to be something that Zmud randomly picks a command off of. So what I mean is, all 1000 commands are in a notepad file at the moment :p so as soon as I find a way to get zmud to look up the random commands off of this list.. I would just plug them in however anyone can help me to get it to work. And I don't want to turn a list into a variable.. that would just be an upside if one of the ways to make that list would BE a variable. However you can do it is fine.. so long as I can get the trigger to return one of 1000 different random commands. |
|
|
|
Skaphia Beginner
Joined: 18 Dec 2002 Posts: 27 Location: USA
|
Posted: Wed Jan 08, 2003 5:17 pm |
By the way, it has to do be something a little more in depth than #CASE %random or something because with 1000 commands it tends to lag my connection out whenever it has to randomly pick one of those and is hard to just throw 1000 commands into the command window :P
|
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Jan 08, 2003 7:22 pm |
How the list is stored determines the process that is used to get the random command. For example, if the list is currently stored in a text file with each command on its own line, then this should pick a random one:
#FILE 1 filename.txt
#GAG
#READ 1 %random(1,%filesize(1))
#CLOSE 1
#GAG
In programming, there are often many different ways to accomplish the same thing. What method is used is determined by the conditions under it will be used, which includes the input data available and how it is available.
Kjata |
|
|
|
Skaphia Beginner
Joined: 18 Dec 2002 Posts: 27 Location: USA
|
Posted: Wed Jan 08, 2003 8:17 pm |
thats perfect, thanks :)
Skaphia |
|
|
|
|
|