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
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Nov 19, 2008 1:17 pm   

Oninput question
 
Here's the code:
Code:

<trigger name="hiding" type="Command Input" priority="790" id="79">
  <pattern>*</pattern>
  <value>#IF (@idle)
{
 %-1
 hide
}</value>
</trigger>


It's supposed to put in hide after every command that I input, but it's only putting in hide, how can I make it so that it puts a hide after everything sent to the MUD (even triggers too) when I'm set to idle?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Nov 19, 2008 2:16 pm   
 
You aren't capturing anything in the trigger pattern, so there is no %1 etc. You have two options. Either put parentheses around the "*" in the trigger pattern, in which case you can use %1 instead of %-1 in the trigger value. Or use %trigger in the trigger value, which is the string which matched the trigger.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Nov 19, 2008 3:14 pm   
 
It works now, thanks. Except now it's sending a line to the MUD that isn't recognized, giving a "huh?", but I don't know what it's sending, would rather have that stopped though.

Code:

<trigger name="hiding" type="Command Input" priority="790" id="79">
  <pattern>(*)</pattern>
  <value>#IF (@idle)
{
  %-1
  #wait 100
  hide
}</value>
</trigger>


Edit 1: It seems that #wait is being parsed by the trigger. It doesn't show up as bold in the editor and is probably being sent literally.
Edit 2: a) When I take %-1 out it goes back to normal and #wait stays bold again.
Edit 2: b) ((@idle) AND (%-1!=@nointerrupt)) is not firing like it should.
_________________
Listen to my Guitar - If you like it, listen to more

Last edited by chamenas on Wed Nov 19, 2008 3:51 pm; edited 1 time in total
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 873
Location: USA

PostPosted: Wed Nov 19, 2008 3:43 pm   
 
chamenas wrote:

It seems that #wait is being parsed by the trigger. It doesn't show up as bold in the editor and is probably being sent literally.


Find out:

From the command line,
#debugfile log.txt log.raw

Then look at log.raw to see what's going in and out.

-Tarn
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Nov 19, 2008 4:00 pm   
 
Here it is:

http://www.savefile.com/files/1893921
http://www.savefile.com/files/1893916
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Nov 19, 2008 8:25 pm   
 
You can't start a line with a %. Replace %-1 with #send %1
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Nov 19, 2008 8:43 pm   
 
Thanks, that worked, though the #IF statement for strings in the @nointerrupt variable are not skipping the hide.

Code:

<trigger name="hiding" type="Command Input" priority="790" id="79">
  <pattern>(*)</pattern>
  <value>#NOINPUT
#IF (%1=@nointerrupt)
 {
  #send %1
 }
 {
  #IF (@idle)
  {
   #send %1
   #wait 100
   #SENDRAW hide
  }
}</value>
</trigger>


Don't know how to export my stringlist.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Nov 19, 2008 9:02 pm   
 
I'm not sure what you're doing with the @nointerrupt statement. From what you are saying, it sounds like @nointerrupt is a stringlist? And you want the #if to check whether %1 is a string in the stringlist? If that's correct, what you want is (%ismember(%1,@nointerrupt))
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Nov 19, 2008 9:22 pm   
 
Ah, I've seen the ismember function but forgot about it. So I always need that for stringlist comparisons?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Nov 20, 2008 1:52 am   
 
Yes, you do, unless you're specifically checking that two lists are identical.

If it were me, I'd be doing this like so:

Code:
#send %1
#if (!%ismember(%1,@nointerrupt)) {hide}


Oh, and you should never be using %-1 in triggers - it's for aliases.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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