Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
adamwalker
Apprentice


Joined: 12 Mar 2005
Posts: 195

PostPosted: Mon Mar 13, 2006 2:15 pm   

Using ONINPUT to prevent mud inputs?? (as part of a system)
 
In the mud i play there is a skill that reduces your command input speed. For example

light pipe;smoke pipe;fill pipe

would work normally. however when afflicted by the skill you would fail on 2 out of the 3 commands as a pause is needed between each... eg

#if (@trip = 1) {
light pipe
#wait 2
smoke pipe
#wait 2
fill pipe
}

This works just fine for my autocuring system however if i want to enter commands aswell it gets complicated and i often trip. so what ive been working on is this...

using an ONINPUT trigger, subregex and %additem i have added every command i send to the mud to an alias. then once ever 2 seconds the command is used and deleted from the list. also im working on it move certain commands up the list according to importance.

the problem is how do i stop inputs being sent to the mud except when the alias dealing with the @variablelist sends a command.

so in summary

- enter input manually or from my trigger system
- gets added to @variable list but NOT actually sent to the mud
- #alias runs ever 2 sec, activates mud input, and sends the next item from @variablelist
-deletes item from the list
- repeats

I know its quite a complicated request, and how possible it is to do i dont know. but any input or advice would be very much appreciated.

thanks

Adam
Reply with quote
adamwalker
Apprentice


Joined: 12 Mar 2005
Posts: 195

PostPosted: Mon Mar 13, 2006 2:18 pm   
 
edit - also i would prefair not to have to edit ever command to send it to an alias first...

Eg..

#alias mylist {#additem mylist %1}

then in every trigger/command put something like "mylist smoke pipe423"

i know it would be possible that way... but it would mean editing hundreds of commands to accomodate this

i hope ive explained all this clearly enough
Reply with quote
Vodoc
Apprentice


Joined: 11 Apr 2003
Posts: 119
Location: Sweden

PostPosted: Mon Mar 13, 2006 4:15 pm   
 
It should be as simple as putting #GAG on the first line in the trigger and it won't send the input to the mud.

Update:
I did some testing since the subject interested me and it took a few tries to get this right.
Here is what I ended up with:
Code:
#ALIAS mylist {#show Queued command: '%1';mylist=%additem( %1, @mylist)}
#ALARM mylistalarm {*2} {#if %numitems( @mylist) {dosend %pop( mylist)}}
#ONINPUT {^{^dosend }(*)$} {#gag;mylist "%1"}
#ONINPUT {^dosend (*)$} {%1}

It's very important that those two #ONINPUT triggers are entered in that order or it won't work as expected.

Usage:
Simple enter all commands as usual and they will be sent to the mud with a 2 second interval. If you really need to send something right away then use dosend this is sent right away e.g. dosend rec recall
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Mon Mar 13, 2006 8:16 pm   
 
You can use #SEND to send command directly to the mud without the ONINPUT trigger picking up the command. I have a system that uses this method and it works perfectly.
Basically, it's setup like this:
Code:
#ONINPUT {*} {#GAG;#ADDITEM Queue {%1}}

Then I have an alias that fires whenever my prompt indicates I can send another command. It contains this, among other things:
Code:
#SEND %pop(Queue)
I have other code that evaluates the commands and orders them in the queue, but this is just the basics of it.
Reply with quote
adamwalker
Apprentice


Joined: 12 Mar 2005
Posts: 195

PostPosted: Tue Mar 14, 2006 9:38 am   cool ideas
 
some very interesting and contrasting ideas guys. ill try them both out and see where i get.

ive also incorporated some #IFs into all of this... if health > xx and healthpotion %ismember of @mylist then bump healthpotion to #1 slot.

ill whack on my fullcode when im done

chears everyone
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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