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
patryn
Apprentice


Joined: 26 Sep 2001
Posts: 124

PostPosted: Mon Feb 03, 2003 4:55 am   

command input trigger
 
I'd like to have a command line trigger that goes off every time I type "/" in the begining of the command line, but what id also like, is for that command line to 'not' get sent to the MUD.

Why arnt I using an alias isntead? True an alias would normally be fine for this sort of thing, but an alias wouldn't pick up something like: "/hello"

What id like is to be able to type "/hello" in the command line, capture the 'hello' part, do something with it, then clear that command line so it doesnt get sent to the mud.

I realise that "/ hello" would work with an alias, but i dont want to have to put a space between the "/" and the "hello"

Any ideas?





That which does not kill us, makes us stronger.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Feb 03, 2003 5:04 am   
 
quote:

I'd like to have a command line trigger that goes off every time I type "/" in the begining of the command line, but what id also like, is for that command line to 'not' get sent to the MUD.

Why arnt I using an alias isntead? True an alias would normally be fine for this sort of thing, but an alias wouldn't pick up something like: "/hello"

What id like is to be able to type "/hello" in the command line, capture the 'hello' part, do something with it, then clear that command line so it doesnt get sent to the mud.

I realise that "/ hello" would work with an alias, but i dont want to have to put a space between the "/" and the "hello"

Any ideas?





That which does not kill us, makes us stronger.



A command input trigger will not be stopping what you type from going to the mud (at least, I don't think that's the case; a simple attempt to sub the trigger text to nothing should clear this up). An alias doesn't send stuff to the mud except in two cases: you send something from within the alias code, or you aren't "using" all of the arguments passed to the alias (ie, if you send four arguments to the alias and you don't have a %4 in the code). In the latter case, these unused arguments are simply appended to whatever output is sent to the mud.

A fairly decent solution to the problem you're having might be to write up the alias and then use a command-line trigger to separate things like "/hello". I'm not really sure that ZMud will treat the subbed text as an alias, though.

li'l shmoe of Dragon's Gate MUD
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Mon Feb 03, 2003 5:09 am   
 
actually, i believe this will work for you:

#oninput {^~/(*)} {#sub {commandyouwant %1}#gag;commands you want to do}

when i put ooc in where commandyouwant was, i was able to type
/hi everyone
and the command got seperated out before hitting the mud.



--edit--
whoops, i posted before looking closely enough at what you were trying to do. if you can't interpret that mess above, this is the trigger you want:

#oninput {^~/(*)} {#gag;thingsyouwanttodo = %1}

and the mud shouldn't ever hear a word about it
--------

moon.icebound.net:9000
Reply with quote
patryn
Apprentice


Joined: 26 Sep 2001
Posts: 124

PostPosted: Mon Feb 03, 2003 7:36 am   
 
woo :) Thanks Emit, that works like a charm :)

I didnt realise that #gag would prevent sending to the mud :)

Cheers :)
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Feb 03, 2003 1:57 pm   
 
Yup, it has a different meaning when used inside oninput triggers.

Kjata
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