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
boblinski
Novice


Joined: 05 Dec 2005
Posts: 49
Location: New Zealand

PostPosted: Thu Jul 18, 2019 10:29 am   

Help with trigger syntax
 
Code:
<trigger priority="13990" id="1399">
  <pattern>Bob [says|tells you|tells the group] '*%w*'</pattern>
  <value>#if (%1 = drink) {wa;ceb;ceb} {}
#if (%1 = eat) {wa;ceb;ceb} {}
#if (%1 = sleep) {rest;sleep} {}
#if (%1 = rest) {rest} {}
#if (%1 = stand) {stand} {}
#if (%1 = wake) {stand} {}
#if (%1 = flee) {flee;flee} {}
#if (%1 = run) {RUNTIME} {}
#if (%1 = sanc) {sanc ilmryn} {}
#if (%1 = farewell) {RUNTIME} {}</value>
</trigger>


Says to me anything containing those keywords.. I want to act accordingly... I think I have the matching syntax's wrong?

Any help?
Basically if
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Thu Jul 18, 2019 12:30 pm   
 
Bob {says|tells you|tells the group} '(*)'

String lists in patterns need to be wrapped in curly brackets
You need to wrap the part of your pattern you want to test against in parenthesis for it to capture into the %1 %2 %3 etc variables.'
_________________
Discord: Shalimarwildcat

Last edited by shalimar on Thu Jul 18, 2019 11:13 pm; edited 1 time in total
Reply with quote
boblinski
Novice


Joined: 05 Dec 2005
Posts: 49
Location: New Zealand

PostPosted: Thu Jul 18, 2019 5:16 pm   
 
Will this still recognise and trigger accordingly even with different messages?...

for example will "eat" proc with both:

Bob says 'Eat something, would you?'

And

Bob tells you 'Why don't you eat?'
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Thu Jul 18, 2019 11:13 pm   
 
#IF (%match(%1, "eat")) {wa;ceb;ceb}

Will work, if you edit the pattern further to use just a * instead of %w.
_________________
Discord: Shalimarwildcat
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