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


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Wed Mar 04, 2009 7:09 am   

#SEND and Oninput triggers
 
I'm not sure why this isn't working. I have a db variable that tracks the state of certain curing routines. I can turn any one of these off and on via ONINPUT triggers like CureAon or CureAoff. I also have buttons that change based upon whatever that state is if it is on or off so I can see what is active and what isn't.

Well I tried to create a script to turn everything on and everything off with another oninput trigger ^o(n|ff)$. Simple right?

So in that trigger I put the a list of all the items and then just do a #forall $list {#send %concat(%i,"on")} or #forall $list {#send %concat(%i,"off")}. It just doesn't work. It doesn't change the values in the db variable. It is like it doesn't execute the oninput triggers at all. If I do each one separately on the command line, like #send CureAon or #send CureAoff, it does work. If I take out the #noinput at the end of the script it sends all the commands to the screen as if I had typed them, but it isn't firing any of the scripts in those oninput triggers.

Why isn't it working?

Script looks like this for the trigger ^o(n|ff)$

Code:

$a = %1
$list = "a|b|c|d|e|f|g"
#if ($a == "n") {
  #forall $list {#send %concat(%i,"on")}
  } {
  #forall $list {#send %concat(%i,"off")}
  }
#noinput
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed Mar 04, 2009 8:44 am   
 
Try using #EXEC instead of #SEND. Please don't ask me the difference. I'm much too tired (shouldn't be up) to explain everything right now. ;)

Charneus
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Wed Mar 04, 2009 9:01 am   
 
No need to explain. I know very well about #Execute. However, it doesn't work either because I already tried it.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Mar 04, 2009 11:23 am   
 
Zugg must have put in a general protection at some point so that #ONINPUT triggers can't get into a loop.
Code:
#noinput
$a = %1
$list = "a|b|c|d|e|f|g"
#if ($a == "n") {
  #forall $list {#THREAD {%i} {#send %concat(%threadname,"on")}}
  } {
  #forall $list {#THREAD {%i} {#send %concat(%threadname,"off")}}
  }
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Wed Mar 04, 2009 1:41 pm   
 
That doesn't work either. It sends "#send a", "#send b" and so on to the screen. The # on #send also shows up green as if there is a missing bracket, but there isn't. It does not like the {%i} and expects "%i". Also it completely ignores the #noinput and sends it all to the screen anyway. Razz
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Wed Mar 04, 2009 2:01 pm   
 
This doesn't even work if you type all of them out individually instead of using #forall.

#send aoff
#send boff
#send coff

It does nothing.

If I type #send aoff on command line and hit enter it fires that oninput trigger and the script runs and the button updates as well. For some reason, apparently you can't use #send from an oninput trigger to fire another oninput trigger? Even just putting #send aoff by itself does nothing.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Mar 04, 2009 5:23 pm   
 
Something else is wrong with your scripts. There isn't any problem calling one oninput trigger from another. Here is a simple test that I did:
Code:
#oninput {aoff} {#noinput;#send boff;#show "a fired"}
#oninput {boff} {#noinput;#show "b fired"}

Now I type "boff" on the command line, and it shows:

b fired

Next I type "aoff" on the command line, and it shows:

a fired
b fired

So the #noinput worked in both cases, and the "aoff" oninput trigger was able to fire the "boff" oninput trigger via #send without any problem. You don't need fancy threads or anything. You don't need #exec. I have no idea why your specific triggers don't work, but try these simple test cases in a blank session and see if they work for you. Then we can try to figure out why your other triggers are not working.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Mar 04, 2009 9:20 pm   
 
Zugg, using your exact scripts in a blank session works.

Close CMud, relaunch, and try them this way:
Code:
#oninput {boff} {#noinput;#show "b fired"}
#oninput {aoff} {#noinput;#send boff;#show "a fired"}
Now they don't work. The problem is the priority, as soon as that is adjusted oldguy2's trigger will be working. I don't think that is the way it is supposed to be though.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Wed Mar 04, 2009 11:20 pm   
 
Even setting the priorities didn't change anything. It still doesn't work in blank session.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <class name="Test" copy="yes">
    <trigger type="Command Input" priority="10" regex="true" copy="yes">
      <pattern>^o(n|ff)$</pattern>
      <value>$a = %1
$list = "a|b|c|d|e|f|g"
#if ($a == "n") {
  #forall $list {#send %concat(%i,"on")}
  } {
  #forall $list {#send %concat(%i,"off")}
  }
#noinput</value>
    </trigger>
    <trigger type="Command Input" priority="20" regex="true" copy="yes">
      <pattern>^ao(n|ff)$</pattern>
      <value>$a = %1
#if ($a == "n") {#print aon fired} {#print aoff fired}
#noinput</value>
    </trigger>
    <trigger type="Command Input" priority="30" regex="true" copy="yes">
      <pattern>^bo(n|ff)$</pattern>
      <value>$a = %1
#if ($a == "n") {#print bon fired} {#print boff fired}
#noinput</value>
    </trigger>
    <trigger type="Command Input" priority="40" regex="true" copy="yes">
      <pattern>^co(n|ff)$</pattern>
      <value>$a = %1
#if ($a == "n") {#print con fired} {#print coff fired}
#noinput</value>
    </trigger>
    <trigger type="Command Input" priority="50" regex="true" copy="yes">
      <pattern>^do(n|ff)$</pattern>
      <value>$a = %1
#if ($a == "n") {#print don fired} {#print doff fired}
#noinput</value>
    </trigger>
    <trigger type="Command Input" priority="60" regex="true" copy="yes">
      <pattern>^eo(n|ff)$</pattern>
      <value>$a = %1
#if ($a == "n") {#print eon fired} {#print eoff fired}
#noinput</value>
    </trigger>
    <trigger type="Command Input" priority="70" regex="true" copy="yes">
      <pattern>^fo(n|ff)$</pattern>
      <value>$a = %1
#if ($a == "n") {#print fon fired} {#print foff fired}
#noinput</value>
    </trigger>
    <trigger type="Command Input" priority="80" regex="true" copy="yes">
      <pattern>^go(n|ff)$</pattern>
      <value>$a = %1
#if ($a == "n") {#print gon fired} {#print goff fired}
#noinput</value>
    </trigger>
  </class>
</cmud>
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Mar 04, 2009 11:20 pm   
 
Ah ha! That was it. Very weird bug, but I have it fixed for 3.04 now. Thanks for the help.

Edited: Oh yeah, another note. You need to be sure to turn on the "Trigger on Trigger" option for the "aoff" trigger to allow it to process the additional oninput trigger. 2.37 still doesn't work with that option set, but 3.04 will. Just don't forget about that option. When it's off, no other triggers (including OnInput) are processed when the trigger is running.
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