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


Joined: 29 Jan 2015
Posts: 9

PostPosted: Thu Jan 29, 2015 9:32 am   

Trigger fired but did not compile (problem with defining new variable)
 
Code:

<trigger priority="1080" id="108">
  <pattern>Some text</pattern>
  <value>$VAR location Name_of_location</value>
</trigger>


The result is
Code:

ERROR: Trigger "Some text" fired but did not compile


What is the problem?
Reply with quote
shalimar
GURU


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

PostPosted: Thu Jan 29, 2015 11:30 am   
 
are you trying to create a local variable, or a reuseable one?

#VAR location {some value}
location=some value

thats how you define a normal variable (either syntax works)

for local variables you want

#LOCAL $location
$location=some value

the local command is only needed if you need to declare the variable with a null value
(such as if it will be defined inside an #IF)
_________________
Discord: Shalimarwildcat
Reply with quote
bskrzysiek
Newbie


Joined: 29 Jan 2015
Posts: 9

PostPosted: Thu Jan 29, 2015 11:50 am   
 
Thank you! {} works just fine :)!
Reply with quote
Pogi
Newbie


Joined: 04 Aug 2008
Posts: 9
Location: Washington

PostPosted: Fri Jan 30, 2015 8:18 pm   
 
I had the same error. I've never really had to make very complex triggers before so I'm kind of stuck on this. What I want to do is make a trigger that does this:

Pattern. one last time before fading from sight
I then want it to cast mirage
if the next line is You lose your concentration I want it to cast again. I had an easier time in Zmud then Cmud with stuff like this. Help appreciated thanks.
Reply with quote
shalimar
GURU


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

PostPosted: Fri Jan 30, 2015 8:41 pm   
 
you want a variable to hold your lastSpell

#TR {one last time before fading from sight } {lastSpell=mirage;cast mirage}
#TR {You lose your concentration} {cast @lastSpell}

by the nature of your issue, a local variable just won't work
In the future though, please create your own thread.
_________________
Discord: Shalimarwildcat
Reply with quote
Pogi
Newbie


Joined: 04 Aug 2008
Posts: 9
Location: Washington

PostPosted: Fri Jan 30, 2015 8:55 pm   
 
Thanks I'll try that and sorry I thought it was the same type of stuff. I'll make a new thread next time.
Reply with quote
apfinger
Novice


Joined: 19 Nov 2006
Posts: 40

PostPosted: Sat Jan 31, 2015 7:03 am   
 
I may be facing the wrath of forum protocol for bumping this thread again, but thought I would comment on the last topic since it is already resolved and no longer in need of its own thread.

You can also add an extra layer in there to handle your spell casting.

You can create a separate trigger
#TR {cast (*)} {lastSpell=%1}

There is a setting in the Package Editor(view the trigger, open the Pattern tab, change Type to Command Input) that tells the trigger to fire on input commands. This changes the trigger to do as you would expect - fire on your input text instead of the MUD output text.

Now whenever you manually cast a spell, it will record it as the last one so that if you lose your concentration, it will attempt the most recently cast spell regardless if it was cast from a trigger, alias, or manually.

This is not a foolproof mechanism, but is a good start for this type of repetitive work.
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