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
Pogi
Newbie


Joined: 04 Aug 2008
Posts: 9
Location: Washington

PostPosted: Mon Aug 04, 2008 10:42 pm   

Help please. Problem with %random
 
Hi everyone. I'm hoping someone can help me with this issue, and I'll try to word it as clear as possible.

(This problem doesn't exist in ZMUD btw)

For one of the MUDS I play I run some XP scripts in a high mob density area. It has 6 different mobs in it and I'm triggered to kill each mob upon successful killing of the previous one. Once there is no more the message "They aren't here" occurs. My trigger for that looks like this.

<trigger priority="5660" id="566">
<pattern>They aren't here</pattern>
<value>par%random(1,6)</value>
</trigger>

It looks different in ZMUD as there is no XML, but I'm hoping you guys are familiar with how triggers look in both.

Now the purpose of this trig is that I have 6 aliases. Par1 through Par6. Each one is set to a different mob along with our travel skill.

Par1 Alias equals

swoop (travel command) dove
kill dove

The other aliases are for the other mobs. However the problem with this in CMUD is that it sends to the mud Par 1 with a space. Makes the alias not work. I have no clue how to fix this. Any help would be greatly appreciated. Thanks!

P.S. If I need to provide more information please let me know.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Aug 04, 2008 11:26 pm   
 
Change it to #EXEC {%concat("par",%random(1,6)} for your value.

Charneus
Reply with quote
Pogi
Newbie


Joined: 04 Aug 2008
Posts: 9
Location: Washington

PostPosted: Tue Aug 05, 2008 9:06 pm   
 
I tried that but it didn't work. I got his error message



[They aren't here-> #EXEC {%concat("par",%random(1,6)} ]
ERROR: Trigger "They aren't here" fired but did not compile

Any more ideas please?
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Tue Aug 05, 2008 9:15 pm   
 
not sure why it wouldnt work...

I did this from the command line...

Code:

#ALIAS par1 {#SAY Test Worked}

#EXEC {%concat("par",%random(1,1))}


This worked...

Oh I see your problem, your missing the closing ) for your concat...

it should be
#EXEC {%concat("par",%random(1,6))}
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Aug 05, 2008 10:16 pm   
 
That was my fault. I forgot to close out the concat.

Sorry!

Charneus
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Wed Aug 06, 2008 1:41 pm   
 
Good job Charn... geez... Im throwing away all your code I have, it could be buggy :(
Reply with quote
Pogi
Newbie


Joined: 04 Aug 2008
Posts: 9
Location: Washington

PostPosted: Thu Aug 07, 2008 8:46 pm   
 
Awesome it worked thanks! now can you explain real quick please on what it means exactly.. I mean what makes this different I'm not familiar with concat and exec. Thanks again!
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Aug 08, 2008 12:28 am   
 
Well, concat means "put these items together, exactly as it is." So, if I wanted to make the following sentence:

This is a sentence.

I could do %concat("this ","is ","a ","sentence.")

Of course, that's a silly example, but hopefully you see what it does. In your situation, it takes a random number between 1 and 6 and affixes it to par, so it becomes par1 through par6.

Exec is short for "execute," and basically, it's function in your script is to execute the alias after the concat has put it together.

Charneus
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