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
Jaiven
Wanderer


Joined: 03 Oct 2007
Posts: 66

PostPosted: Wed Jun 27, 2012 1:53 am   

Trigger problem for bags
 
Hello, this trigger in zmud would check for crafting components and give the amount to the crafter. in cmud it is giving too little and not the correct amount
Trigger:
^ ? (%n) ? ? scraps ? a shred of (%w)

Value:
#add %2 %1
#if (@%2>=3) {#3 give %2"," stacy}
#var %2 0

line from game
[ 2 ] < scraps > a shred of charred scales
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Jun 27, 2012 4:34 am   
 
1)Indirect variable reference MUST be enclosed in curly braces: @{%2}

2)you are using ? far too much.
_________________
EDIT: I didn't like my old signature
Reply with quote
Jaiven
Wanderer


Joined: 03 Oct 2007
Posts: 66

PostPosted: Wed Jun 27, 2012 10:50 am   
 
is there a better way to tell cmud to ignore [ ] < > from the mud?
Reply with quote
hadar
Apprentice


Joined: 30 Aug 2009
Posts: 198
Location: my apt, in california

PostPosted: Wed Jun 27, 2012 2:49 pm   
 
Here is way 1. only check for items currently got not how mant you have, the same way it is currently written

Code:

<trigger priority="37930" id="3793">
  <pattern>^~[ (%n) ] ~< scraps ~> a shred of (%w)</pattern>
  <value>#if (%1>=3) {#loop %1 {#send "give "%2", stacy"}}</value>
</trigger>


Way 2 counts all "scraps" that way over time if you are only getting 1-2 once you hit 3+ it will fire

Code:


<trigger priority="37930" id="3793">
  <pattern>^~[ (%n) ] ~< scraps ~> a shred of (%w)</pattern>
  <value>#add %2 %1
#if (@{%2}>=3) {#loop @{%2} {#send "give "%2", stacy"};#var %2 0}</value>
</trigger>
_________________
if you build it they will come, assuming that they have not already come to build it
Aardwolf Bootcamp
My youtube channel
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Jun 27, 2012 6:55 pm   
 
You can use ~ to indicate that the next character is to be treated literally. <> are not special characters in the trigger parser, so you do not need to use ~ on them. By using ?, you are telling the trigger parser that it doesn't matter what character is there, which means you can get false-positives that mess up your script.
_________________
EDIT: I didn't like my old signature
Reply with quote
Jaiven
Wanderer


Joined: 03 Oct 2007
Posts: 66

PostPosted: Sat Jun 30, 2012 3:57 am   
 
thanks for the help guys got it working with your assistance!
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