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 Goto page 1, 2  Next
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sat Nov 22, 2008 10:19 pm   

Oninput Trigger acting funky
 
Code:

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


Remember this guy? Well, how it's supposed to work is that command goes through, then hide is sent. However, now, for some unknown reason, it sends hide first and then the command.

video
As you can see in the video, the hides only come when something comes RIGHT after them. However, if I wait a little bit nothing comes up after them. They only seem to precede things.

I also added say to the trigger and here's the output:
Quote:

reply You frowned because of eyestrain? <- Say
You attempt to fade into the darkness. <- Hide attempt

<1554/1554hp 381/433m 406/406mv 826tnl 50pq 113/333w 55g/76s
[Shalonesti Storehouse] [WD] 3:00am [Night Time] [Elvish] [Offensive]>
You tell Annemari (Elvish) 'You frowned because of eyestrain?' <- My other command


It should be:
Quote:

reply You frowned because of eyestrain? <- Say
You tell Annemari (Elvish) 'You frowned because of eyestrain?' <- My other command

<1554/1554hp 381/433m 406/406mv 826tnl 50pq 113/333w 55g/76s
[Shalonesti Storehouse] [WD] 3:00am [Night Time] [Elvish] [Offensive]>
You attempt to fade into the darkness. <- Hide attempt


Code:

<trigger name="hiding" type="Command Input" priority="790" id="79">
  <pattern>(*)</pattern>
  <value>#send %1
#say %1
#IF (@idle=1)
{
 #if (!%ismember(%1,@nointerrupt)) {hide}
}</value>
</trigger>
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Nov 23, 2008 12:38 pm   
 
It is working exactly as it should. To explain it step by step:
You type "text" that activates the trigger.
Your #SEND command adds that "text" to the end of the outgoing commands bypassing aliases and oninput triggers
When it gets down to the #IF, evaluating to true causes "hide" to be set as a substitution for the orginal "text".
Finally everything is sent in its new state.

What you want to do is eliminate the "#SEND %1" line, you will permit the text to go through unchanged.
Then change your "hide" to "#SEND {hide}" so that the additional command is appened into the queue.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Nov 23, 2008 2:42 pm   
 
Thank you, I didn't know it worked that way.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Sun Nov 23, 2008 4:20 pm   
 
Shouldn't he also be able to change the pattern from (*) to *?
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Nov 23, 2008 4:29 pm   
 
Well, when I didn't have %1 in there it would only send hide, so I changed it to:

Code:

#IF (@idle=1)
{
 #if (!%ismember(%1,@nointerrupt))
 {
  #send %1
  #send hide
 }
}


But apparently send is ignoring the fact that I've aliased hide because it sends hide directly to the MUD... I thought send could handle aliases?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Nov 23, 2008 7:29 pm   
 
Also, apparently, with how ismember works, it does not make exceptions for commands that start with the variable word but then have things following. For instance:

In the variable I have the word: cut

however, if I type cut <name>, it doesn't recognize it as cut and sends the command through with a hide after which interrupts the cut action. Isn't there a function for these sort of exceptions?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Sun Nov 23, 2008 9:35 pm   
 
Sure, change your %ismember to this:

%ismember(%word(%1,1),@nointerrupt)
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Nov 23, 2008 11:06 pm   
 
Will that do it only for the beginning word, or for wherever the word might be in the pattern?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Mon Nov 24, 2008 12:22 am   
 
only the beginning...
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Mon Nov 24, 2008 12:35 am   
 
Addendum to that...

However you can do:
#FORALL %subchar("%1", " ","|") {%ismember(%i,@nointerrupt))
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Nov 24, 2008 1:37 am   
 
Why did you post the new one? I can sort of see what it's doing but I'm not sure which is better?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Mon Nov 24, 2008 3:53 pm   
 
The new one is if you want it to pick up the word anywhere in the line. If you don't, then ignore it.
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Nov 24, 2008 4:01 pm   
 
Nope, just the beginning. Thanks.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Nov 24, 2008 10:43 pm   
 
If it is just the beginning word you are concerned about then do it it in the pattern. Setting the pattern to "^(%w)({ *|})$" should cause CMud to seperate the first word out properly. If it has any problems then you will have to switch to a regex pattern. I don't expect any problems though since we had a discussion about the use of '{list|}' in patterns a while back and arrived at a proper conversion.

Yes, #SEND bypasses aliases. That is the entire point of the command. You never mentioned that "hide" is an alias or I might have suggested a more comprehensive solution. You will have to provide the script details of your "hide" alias if you want this solved.

Also you shouldn't be doing a "#SEND %1" within the trigger script. If nothing messes with the orginal command of the trigger then it will go through. Using #SEND to put the command in again is just asking for trouble. Evidently you didn't understand all the things I explained, so please read my explanation again.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Nov 24, 2008 11:24 pm   
 
Currently, what should happen is that it will take the command, and, if it's set to idle (I should change the variable name as it doesn't reflect what it's going anymore) then it sends the command first, followed by hide. Hide is an alias, which does this:

Code:

<alias name="hide" id="81">
  <value>#IF (@night)
{
 #sendraw nightmeld
}
{
 #sendraw hide
}
 </value>
</alias>


It's just an easy way for me to use a better hide ability which I can only use at night.

Now with the trigger as this:

Code:

<trigger name="hiding" type="Command Input" priority="790" id="79">
  <pattern>(*)</pattern>
  <value>#IF (@idle=1)
{
 #if (!%ismember(%word(%1,1),@nointerrupt))
 {
  #send {hide}
 }
}</value>
</trigger>


It only sends the hide command when I try to move. This is what I thought you were describing. If it is not then I didn't understand what you were describing, but clearly rereading it didn't help. Right now I'll keep the "%1" in because it works, but I would of course like to know what I'm not understanding so I can fix it. My initial inclination would have been to not have it since I didn't put in a #noinput or anything else that would have stopped the command from going through.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Tue Nov 25, 2008 1:32 am   
 
Just change your #SEND {hide} to a #EXEC to make it perform the alias.
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue Nov 25, 2008 1:37 am   
 
ralgith wrote:
Just change your #SEND {hide} to a #EXEC to make it perform the alias.


Did you understand Vigilante's post better than I did, about how the command should still go through anyways, etc?

Edit: Using #exec causes the same problem as before, I'm guessing it's how #send works as opposed to #exec. So essentially I get "hide" and then "command", which defeats the purpose.

Edit 2:

Changed to
Code:

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


Now I don't have %1 in there, but I still have the problem of hide coming before the command.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Tue Nov 25, 2008 1:56 am   
 
Not really ;) lol
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Nov 26, 2008 3:52 pm   
 
Well, I suppose I'll switch it back to how I had it, because I'm lost.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed Nov 26, 2008 5:02 pm   
 
Personally, I don't see what the issue is. Vijilante explained it perfectly. However, this is untested, but you can try this:

Code:
#ONINPUT {(*)} {#IF (@idle AND %ismember(%word(%1,1),@nointerrupt)) {#EXEC %1;hide}}


Definitely can clean it up a little using an AND statement anyway. Try that and see if it does what you want.

Charneus
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Wed Nov 26, 2008 5:07 pm   
 
chamenas
#ONINPUT trigger delays its network communication until the last line of the trigger code will not be executed. Naturally that the line which call your "hide" alias will be executed BEFORE that moment.

Something like this:

Entering OnInput trigger with message: " test ".
Calling the HIDE alias.
...About to send NIGHTMELD directly to MUD with #SENDRAW.

...nightmeld
...Have sent NIGHTMELD directly to MUD with #SENDRAW.
Have exited from the HIDE alias.
Exit the OnInput trigger.

test <- this is the final result from the #ONINPUT trigger

You may test this yourself with script debugger or with this code (it is your code from the first post)
Code:

  <trigger name="hiding" type="Command Input" priority="790" id="1">
    <pattern>(*)</pattern>
    <value>#PRINT "Entering OnInput trigger with message: " %1 ".";
#IF (@idle=1)
{
 #if (!%ismember(%1,@nointerrupt))
 {
    #PRINT "Calling the HIDE alias.";
    hide;
    #PRINT "Have exited from the HIDE alias.";
 }
#PRINT "Exit the OnInput trigger.";
}</value>
  </trigger>
  <alias name="hide" id="2">
    <value>#IF (@night)
{
  #PRINT "About to send NIGHTMELD directly to MUD with #SENDRAW."
  #sendraw nightmeld
  #PRINT "Have sent NIGHTMELD directly to MUD with #SENDRAW."
}
{
  #PRINT "About to send HIDE directly to MUD with #SENDRAW."
  #sendraw hide
  #PRINT "Have sent HIDE directly to MUD with #SENDRAW."
}</value>
  </alias>
  <var name="night" type="Integer" id="3">1</var>
  <var name="idle" id="4">1</var>
  <var name="nointerrupt" type="StringList" id="5">testA|testB</var>


Last edited by Arde on Wed Nov 26, 2008 5:12 pm; edited 1 time in total
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Nov 26, 2008 5:11 pm   
 
Arde wrote:
chamenas
#ONINPUT trigger delays its network communication until the last line of the trigger code will not be executed. Naturally that the line which call your "hide" alias will be executed BEFORE that moment.

Something like this:

Entering OnInput trigger with message: " test ".
Calling the HIDE alias.
...About to send NIGHTMELD directly to MUD with #SENDRAW.

...nightmeld
...Have sent NIGHTMELD directly to MUD with #SENDRAW.
Have exited from the HIDE alias.
Exit the OnInput trigger.

test <- this is the final result from the #ONINPUT trigger


Thank you. I'm sure this is what Vigilante was explaining, but I only just got it from this. That makes sense. So I'm thinking what I want to do is do a noinput and force the trigger with %1 to put it before the alias?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Nov 26, 2008 6:43 pm   
 
Charneus, I tried yours and I tried mine with a #noinput and both work like it is right now with action first, hide after.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri Nov 28, 2008 1:18 am   
 
Code:

<trigger name="hiding" type="Command Input" priority="790" id="95">
  <pattern>(*)</pattern>
  <value>#IF (@idle=1)
{
 #if (!%ismember(%word(%1,1),@nointerrupt))
 {
  #send {hide}
 }
}</value>
</trigger>


This is following everything Vigilante said and the command I type is never sent, all I get is "hide" being sent to the game. Also, I want to switch #send to #exec so I can send it as an alias, but I wanted to make sure I was following everything Vigilante said.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Fri Nov 28, 2008 5:59 am   
 
Code:
#NOINPUT {(*)} {
   #IF (@idle = 1 AND !%ismember(%word("%1",1),@nointerrupt)) {
      #SEND "%1"
      #EXEC hide
   }
}


Not sure if thats the right way to do it, since I've never messed with NOINP, but I would guess its darned close. As Charn noted, combine the 2 #IFs using AND.
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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