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


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri Apr 11, 2008 12:47 pm   

OnInput Delay
 
How can I take all commands being sent to the Mud, put them in a list, and then run a while loop that basically says while I have a certain condition, don't send anything to the Mud without a certain delay between the commands. I really hate how Muds do this crap to you, but you can't even use your scripts if you have this condition going on. You can't send anything together. So I have no idea how to do this. I'm not sure where to start. I can do this pretty easy with my attack commands, but then I would have to go and change everything, all my curing and so on, to deal with it and I really hate to do that. Any of you coding gurus have an idea? An oninput trigger won't work because it still sends the stuff to the Mud and captures on top of that.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri Apr 11, 2008 1:24 pm   
 
This is what I was trying to do and what I have so far. The only problem is it sends everything at once and then also in slow motion. I am using #noinput and it isn't supposed to do that right?

In the alias to run the list I have:

Code:
#while ((%numitems(@slowmotiontlist) > 0) and @slowmotion) {
  #if (!@slowmotion) {#exit}
  #exec %pop(slowmotionlist)
  #wait 1000
  }


For the #oninput trigger I have:

Code:
#if (@slowmotion) {
  #noinput
  #additem slowmotionlist %1
  runslowmotion
  } {#T- SlowOutput}


Any ideas on how to make this work? Sad
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Fri Apr 11, 2008 1:32 pm   
 
Something very close to this. In fact this might just work... Although it sounded like you were talking about sluggishness, I forget the real name, for that there are cures, again which I forget Embarassed


#oninput (*) {#noinput;#additem commands %1;#if (@sedationRitual) {#T+ SedAlarm} {#send %pop(commands)}}
#alarm "SedAlarm" 2 {#send %pop(commands);#if (@sedationRitual==0) {#Forall @commands {#send %pop(commands)};#T- SedAlarm}}
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Fri Apr 11, 2008 1:35 pm   
 
Ah, ninja'd fun!

It looks like you have the idea. Although a while loop like that will work now in Cmud I really shy away from threads and would use an alarm for this.

Instead of the single problem. AKA Sedation ritual use your list.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri Apr 11, 2008 1:53 pm   
 
Haha you are almost right! It's those damn mists. You can't chain any commands at all. I quit playing Avalon about 3 years ago, but recently started playing again.

Hmm do you think this will work? Even with my while loop, it still shows all the commands being sent and then it shows them being sent with the delay as well. I don't understand it. I used #send on all my commands too. Zugg said that using #send will make it go through the oninput trigger in this thread http://forums.zuggsoft.com/forums/viewtopic.php?t=29626&highlight=delaying+all+input
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri Apr 11, 2008 2:09 pm   
 
Okay Arminas I tried your version and that will just keep the alarm running endlessly. Then when I run a macro that sends like 5 commands, it populates the list but the alarm stops and nothing happens. It doesn't send anything. Sigh.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Fri Apr 11, 2008 2:09 pm   
 
If I understand correctly it isn't Actually being sent the first time you see it on the screen. If you want to make it not show on the screen you need to gag it as well.

Now, that said what Zugg meant was not that Oninput Noinput was defeated by #send but that you needed to use #send to assure that they WORKED.

An example was that for a while if you used a macro an oninput trigger would not catch the command going to the mud.
Zugg changed things so that if you used #send in the macro the trigger would catch it as if you entered it into the command line.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Fri Apr 11, 2008 2:11 pm   
 
I didn't actually put that into Cmud before I wrote it up here. Try putting {} around the %pop(commands)
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Fri Apr 11, 2008 2:15 pm   
 
Maybe what you want is #SENDRAW to bypass the #ONINPUT trigger, unless I'm misunderstanding the purpose of that command...
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Fri Apr 11, 2008 2:17 pm   
 
I had forgotten something else too!
Try this one while connected to the mud. The idea is to have #sendraw bypass the oninput trigger...
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger name="SedAlarm" type="Alarm" priority="20" copy="yes">
    <pattern>2</pattern>
    <value>#sendraw {%pop( commands)}
#if (@sedationRitual==0) {
  #Forall @commands {#sendraw {%pop( commands)}}
  #T- SedAlarm
  }</value>
  </trigger>
  <trigger type="Command Input" priority="10" trigontrig="false" copy="yes">
    <pattern>(*)</pattern>
    <value>#noinput;#additem commands %1;#if (@sedationRitual) {#T+ SedAlarm} {#sendraw {%pop(commands)}}</value>
  </trigger>
  <var name="SedationRitual" copy="yes">1</var>
  <var name="commands" type="StringList" copy="yes"/>
</cmud>
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram

Last edited by Arminas on Fri Apr 11, 2008 2:18 pm; edited 1 time in total
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Fri Apr 11, 2008 2:18 pm   
 
Hehe, ninja'd again!

Thanks Larkin Laughing I just realized that an instant after my last post.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri Apr 11, 2008 2:31 pm   
 
Well I can't get it to work. It won't send anything. THe alarm won't work.

Edit:

Sigh...I don't understand it. The Alarm is going continuously and as soon as I populate the command list it just stops and nothing happens.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri Apr 11, 2008 2:44 pm   
 
Hmm well normally when you have timestamps on you can see when the alarm is firing. I turned on debugger and it is working and firing every one second interval. Too bad I can't tell if #sendraw is actually sending the output.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri Apr 11, 2008 2:48 pm   
 
Arminas wrote:
If I understand correctly it isn't Actually being sent the first time you see it on the screen. If you want to make it not show on the screen you need to gag it as well.

Now, that said what Zugg meant was not that Oninput Noinput was defeated by #send but that you needed to use #send to assure that they WORKED.

An example was that for a while if you used a macro an oninput trigger would not catch the command going to the mud.
Zugg changed things so that if you used #send in the macro the trigger would catch it as if you entered it into the command line.


Didn't see this post. Yes I completely understand that. This is why I referred to that thread and stated that I used #send in all my commands so they should all work with the Oninput trigger. I didn't say it was defeated by it. I also understand about using #sendraw to bypass the Oninput.

What threw me was I could see my timestamps scrolling up the left side of the screen due to the alarm firing and as soon as I hit a macro to send a bunch of commands it just stopped. I thought the alarm just stopped firing completely, however, when I opened the debugger it was still going.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri Apr 11, 2008 3:03 pm   
 
Ok seems to be working great. Will have to test online later. Thanks guys. Hopefully Vijillante can help me out with that pouchlist script soon.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Apr 11, 2008 8:40 pm   
 
Yeah, sorry about that I got massively sidetracked. I should be able to throw something together.
_________________
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: Sun May 04, 2008 7:58 pm   
 
Well crap...I just went and changed a ton of my aliases to oninput triggers. I had a lot of them as basically just shortcuts with the same letter then a couple letters of the action. For example, to drop something. I had like 6 aliases like d(word). I can use only one oninput to replace them all! HOWEVER, now it breaks my wonderful oninput delay script. When I use my other oninput trigs it just sends that word to the mud.

Basically, I have an oninput alias \bdune\b for "drop rune".

Well now it shows "dune" as being sent when my oninput delay script is running. Is there any way to get around this and make my other oninput triggers actually work instead of changing them all back to aliases? :(


Edit: The word showing on the screen was me. I forgot I added in to #say the word so I could debug when I created it. lol
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sun May 04, 2008 8:19 pm   
 
Bah nevermind. What the heck I can't seem to concentrate today. All I needed to do was change the priority of my slowmotion trigger and alarm to higher than all my other oninputs.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun May 04, 2008 8:21 pm   
 
How about posting what you are using currently for the delay system. Then posting some of the things that are failing, and finally posting some examples of things that work the way you want. Basically I would need to be able to see what should happen in a blank session and what does happen, and the format of what is broken.
_________________
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: Sun May 04, 2008 8:26 pm   
 
No it's okay now. :-) It was the priorities that made all the difference. Basically since I created that script awhile back all the new oninput triggers were a much higher priority. Now I changed that script to be higher so the other oninputs work fine now.

Example, instead of dune sending drop rune, the slowmotion script sent dune.


Here is the slowmotion script. The necessity of it is due to the fact that if you have a certain condition, you can only send a command once every second or so.

Code:
<trigger name="SlowMotionAlarm" type="Alarm" priority="11460" enabled="false" id="926">
  <pattern>*1</pattern>
  <value>#if (@slowMotion) {
  #if (%numitems(@slowMotionList) > 0) {#say {%item(@slowMotionList, 1)}}
  #sendraw {%pop( slowMotionList)}
  } {
  #forall @slowMotionList {#sendraw {%pop(slowMotionList)}}
  #T- SlowMotionAlarm
  #T- SlowMotionOutput
  }</value>
</trigger>


Code:
<trigger name="SlowMotionOutput" type="Command Input" priority="11470" regex="true" enabled="false" id="923">
  <pattern>(.*)</pattern>
  <value>#noinput
#additem slowMotionList %1
#if (@slowMotion) {#T+ SlowMotionAlarm} {#sendraw {%pop( slowMotionList)}}</value>
</trigger>


Basically, when I had for example the following trigger:

Code:
<trigger name="info" type="Command Input" priority="11450" regex="true" id="1145">
  <pattern>\b(i[ih])\b</pattern>
  <value>#noinput
$word=%1
#switch ($word)
  ("ii") {#send {info inventory}}
  ("ih") {#send {info here}}</value>
</trigger>


It added "ii" or "ih" to the list and not "info inventory" or "info here".
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sun May 04, 2008 11:02 pm   
 
Well...this doesn't work with an oninput but with an alias it does. If I use an oninput for it, it will only add the first item to the list.

Code:
<trigger type="Command Input" priority="50" regex="true" id="5">
  <pattern>\bdo\b</pattern>
  <value>#noinput
$list="item1|item2|item3|item4|item5|item6|item7|item8|item9|item10"
#forall $list {#send {do %i}}</value>
</trigger>


As an alias it will add all the items to the slowmotionlist and send them...
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon May 05, 2008 11:49 am   
 
Your "do" command input trigger will match your #SEND {do %i} there, won't it? Seems like a bad thing. Might want to anchor it, if you intend it to only be executed without parameters being passed to it.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Mon May 05, 2008 12:17 pm   
 
Well it's not really called do. That was an example I just made up, granted a bad one using the same word like that. It doesn't matter though what the name is it will only add the first item as an Oninput trigger while the other script is running. As an alias it adds all the items and the question is why?
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon May 05, 2008 2:14 pm   
 
It seems to be a timing (i.e., thread?) issue. I added a #WAIT 50 after the #SEND {do %i} and it added all the items to the slowMotionList.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Mon May 05, 2008 3:07 pm   
 
While I haven't read this whole thread so could be massively off, I'll add that there's a difference between aliases and oninput triggers when using the #send command. #send won't activate aliases, but it'll fire oninput triggers. That's the difference. Use #sendraw to avoid triggers too.
_________________
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
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