|
shadowsurfer Novice
Joined: 17 Dec 2004 Posts: 34
|
Posted: Sat Feb 20, 2010 6:17 pm
Random Emote w/ One Command |
I have a number of different emotes such as nod1, nod2, nod3 and bow1, bow2, bow3 etc. Each one is a different form of the emote. I would like a script where I could just type nod or bow and it would pick on of the emotes randomly and display it. Any ideas?
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Feb 20, 2010 7:46 pm |
#command_you_use %item(@list_of_emotes,%random(1,%numitems(@list_of_emotes)))
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
shadowsurfer Novice
Joined: 17 Dec 2004 Posts: 34
|
Posted: Sat Feb 20, 2010 9:09 pm |
So then it would look like this:
#nod %item(@nod1, nod2, nod3,%random(1,%numitems(@nod1, nod2, nod3)))
? |
|
|
|
Erasmus Wanderer
Joined: 04 Aug 2004 Posts: 82 Location: Philadelphia
|
Posted: Sat Feb 20, 2010 9:46 pm |
Try this:
#VARIABLE list_of_nods {nod1|nod2|nod3}
#ALIAS nod %item(@list_of_nods,%random(1,%numitems(@list_of_nods)))
edit: fixed spelling error |
|
_________________ Erasmus
Last edited by Erasmus on Sun Feb 21, 2010 3:53 am; edited 1 time in total |
|
|
|
shadowsurfer Novice
Joined: 17 Dec 2004 Posts: 34
|
Posted: Sun Feb 21, 2010 2:25 am |
It doesn't do random. The first time I type 'nod' it sets itself to nod3 and keeps repeating that one.
|
|
|
|
shadowsurfer Novice
Joined: 17 Dec 2004 Posts: 34
|
Posted: Sun Feb 21, 2010 4:32 pm |
Anyone have any correction or fix to this yet?
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Feb 21, 2010 6:32 pm |
There shouldn't need to be any fix. Erasmus's code works just fine. Try using the alias more than a few times, because with just three items in the list there's a high probability that it will simply pick the same one over and over.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
shadowsurfer Novice
Joined: 17 Dec 2004 Posts: 34
|
Posted: Mon Feb 22, 2010 12:41 am |
Well, I set three emotes titled nod1, nod2, nod3. I entered the script Erasmus wrote. I tested it by typing in nod 50 times. I got the same emote 50 times.
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Feb 22, 2010 3:34 am |
Maybe check the variable? If it's set as string(literal), it might not work properly. It should be Autotype or Stringlist.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
shadowsurfer Novice
Joined: 17 Dec 2004 Posts: 34
|
Posted: Mon Feb 22, 2010 4:59 pm |
I have no clue what you just said :)
I used the script listed a few sections above to the letter. |
|
|
|
shadowsurfer Novice
Joined: 17 Dec 2004 Posts: 34
|
Posted: Mon Feb 22, 2010 5:05 pm |
Ok, I figured out what you meant. I went to the variable and it was listed as string list. But I changed it to autotype and it didn't work either.
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Feb 22, 2010 6:12 pm |
The problem was that Erasmus forgot some braces:
Code: |
#VARIABLE list_of_nods {nod1|nod2|nod3}
#ALIAS nod {%item(@list_of_nods,%random(1,%numitems(@list_of_nods)))}
|
Actually, using the %item() as the first thing in a command line is not a good idea, so a better code would be:
Code: |
#VARIABLE list_of_nods {nod1|nod2|nod3}
#ALIAS nod {#SEND %item(@list_of_nods,%random(1,%numitems(@list_of_nods)))}
|
|
|
|
|
shadowsurfer Novice
Joined: 17 Dec 2004 Posts: 34
|
Posted: Tue Feb 23, 2010 12:19 am |
:)
Ok, now when I type nod (after using Rahab's second code above) I get an echo of the random nod (nod1 or nod2 or nod3) and then a what? If I actually type in the nod1, nod2 or nod3 the emote runs. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Feb 23, 2010 12:29 am |
Maybe use #SENDRAW instead of #SEND. Sounds like something in the nod emote is getting parsed, which #SEND allows to happen.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
shadowsurfer Novice
Joined: 17 Dec 2004 Posts: 34
|
Posted: Tue Feb 23, 2010 1:13 am |
The only thing that changed was now the command (nod1 or nod2, etc) doesn't get echoed (in other words I don't see it now). All I get now is what?
|
|
|
|
shadowsurfer Novice
Joined: 17 Dec 2004 Posts: 34
|
Posted: Tue Feb 23, 2010 1:15 am |
Should I be putting the actual emotes in where it says {nod1|nod2|nod3}?
|
|
|
|
shadowsurfer Novice
Joined: 17 Dec 2004 Posts: 34
|
Posted: Tue Feb 23, 2010 1:26 am |
Yeah, I just tested it by changing the #VAR part that shows {nod1|nod2|nod3}. I changed it, for testing purposes, to {emote nods|emote winks|emote pukes} and when I type "nod" I get one of those randomly. So I must not have explained myself in my original request.
I have aliases labeled nod1, nod2 and nod3. Each one is an ALIAS. For instance, nod1 is emote nods suspiciously, nod2 is emote nods and causes some garbage to fall out of it's hair, etc. I want to be able to type "nod" and have these go off randomly.
Or do I HAVE to put in each emote in the variable section for this to work? I recall when I had a version of zMud, I had a script that worked but I can't find it in the forums and I can't find it in my old zmud files. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Tue Feb 23, 2010 2:13 am |
Instead of #SEND use #EXECUTE
|
|
|
|
shadowsurfer Novice
Joined: 17 Dec 2004 Posts: 34
|
Posted: Tue Feb 23, 2010 4:15 am |
Eureka! That did it. Thanks everyone
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Feb 23, 2010 2:22 pm |
Yeah, sorry. If it's a command for the mud, then use #SEND, if it's a Cmud command or alias, use #EXEC.
|
|
|
|
|
|