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


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Tue Sep 18, 2007 11:02 am   

Fixed prompt, sticky prompt
 
This is what i have:

Code:
#TRIGGER "prompt" {^~<(*)> $} {#var prompt %trigger} "Scirkhan" {nocr|prompt}
#TRIGGER "gag" {^~<(*)> } {#if (%line = @prompt) {#gag;#sayp @prompt;}

{#sub {1};#sayp @prompt}} "Scirkhan"


I need help stopping it from firing #sub, and #sayp(false statement, "not true") every line. I had tried doing this by making another trigger
and using #t-, #t+ and $. But I'm not sure if $ is for blank lines..

If you can post something that might help, thanks.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Sep 18, 2007 7:29 pm   
 
Your second trigger is creating the loop. You're saying if %line=@prompt, to gag it, and say @prompt. In my opinion, that's a bit redundant, since you're just repeating the same exact line. What is it you're really trying to do? There's no reason to gag the line only to show it again. But for the purpose of your question, I'll show you how to make it work.

#TRIGGER "gag" {^~<(*)~> } {#IF (%line=@prompt) {#T- {gag};#gag;#sayp @prompt;#T+ {gag}}

That'll turn off the trigger, finish the commands, and turn the trigger on again. By the way, the $ is to match the end of a line. But it can be tricky:

Code:
#TRIGGER {So and so$}

would match:
Code:
So and so(carriage return here)

but not:
Code:
So and so_______________________(carriage return here)


The "_" represents white space, and the "(carriage return here)" just indicates that it's a new line.

By the way, I'd love to know what you're trying to accomplish here. All you've given us is looped patterns and redundant code...

Charneus
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Wed Sep 19, 2007 8:37 am   
 
Yes it's a bit redundant, because it's a newline, and sayp being that it is prompt.. this way your prompt never moves.
so what would a trigger do if it was just #trigger {$} {pattern}. Similiar to #trigger {$} {pattern} {command input}. (%null?)

Having a line break after every line that is displayed as: @prompt(*), that is whenever it's not only your prompt on that line. May help. I had #t- and #t+ in my trigger but it would still fire every line, having a break line after the prompt may
work after i change the code a bit, as the problem here for me seems to be #sub, #sayp, and pattern matching in my opinion.
What I am trying to accomplish is a "fixed prompt".

Examples.. Note: triggers are turned off to show output from the Mud
Before you hit enter you have:

(your prompt here) on the prompt line.
Code:
< 450h 253v >


Once you've hit enter you have:

(your prompt) gets moved up to a newline
(a blank line) in the prompt line
Code:
< 450h 253v >
(blank line)


Once your prompt has arrived again:

The previous blank line has been moved up into a newline.
(your prompt) in the prompt line.
Code:
< 450h 253v >

< 450h 253v >


When I enter a command:
Code:
< 450h 253v > l
(blank line)

Of course this blank prompt line is filled with text if anything is received before your next (status)prompt.

command completed:
Code:
< 450h 253v > l
Across the tundra of death
   Frozen solid. Death lingers in the air, it is so not hot here or is it?
Description here. Description there and here. This is the description
line of the description.
Exits:
North  - A crystal lake
East   - Across the tundra of death
south  - A snowy trail
West   - Across the tundra of death

< 450h 253v >


I will modify the script to work properly when it is ready (when i finally know what i need to do), I know using @prompt = @prompt wouldn't work properly. The script I am trying to make is similar to moving your prompt to your status line.
These should probably be quotes, heh.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Sep 19, 2007 11:55 am   
 
Ah, so your MUD doesn't automatically print your prompt after every block of text appears, and you want to create a trigger that'll do what for you?

If it were me, I'd capture and gag the prompt (it doesn't have much info on it) and then use gauges to display the health and v - whatever that is - info.

Also, about your #trigger question - the commands you have there make no sense. The syntax of the trigger command is #trigger id pattern command class options. The commands aren't optional, so #trig {$} {pattern} makes no sense. #trig {$} {pattern} {command} will probably create a trigger whose id is "$".

If all you want to do is trigger on blank lines (perhaps to gag them) then all you need is

#trig {$} {#gag}

If you explain what you were trying to do with your command, we'll be able to tell you how to do it.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Wed Sep 19, 2007 1:22 pm   
 
In short I am making this script:
Code:
#trigger {^~<(*)> $} {#var prompt %trigger} "Scirkhan" {nocr|prompt}
#trigger {^~<(*)> $} {#gag;#sayp @prompt} "Scirkhan"


There seems to be two things that are making this difficult one is having your prompt disappear when a command is sent to the Mud, the another actually making it work properly. I've tried several things I need assistance.

Code:
#TRIGGER "gag" {^@prompt} {#if (%line = @prompt) {#gag;#sayp @prompt} {#sub {1};#sayp @prompt}}


Now as I have already explained this is basic, I want to modify it. I wish to be able to use #if (@prompt = ^@prompt$) {#gag} {#sub}.
I have created multiple triggers, turning on off etc, but there is one major thing i have ran across each time and that is having #sub and #sayp showing up on each line.. the script is completely successful if there is nothing else on the same line as the prompt.

Quote:
1l
1Room name
1 Room Description Room description................................................
1Room Description Line 2...................................................................
1This being description line number 3..................................................
1exits:
1North - Room Name to the north
1East - Room Name to the east
1South - Room Name to the south
1West - Room Name to the west
< 450h 253v > < 450h 253v >



Notice all the ones, I can't have it firing off each line like that. I have just been unable to create a way to stop it. I can change #sub {1} to #sub {}, but that still doesn't achieve my goal, it'll still fire on each line and i believe because of #sayp. I had thought of making a trigger that turns the trigger back on when a blank line is received, I do not know why that wasn't successful. (aka $)

There must be some other way going about this. thanks help is appreciated kind of blew my brains doing this.
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Wed Sep 19, 2007 1:40 pm   
 
This is what I have so far. many times I have felt I was almost there, I don't know to what benefit #cond could give me..


Code:
#TRIGGER "prompt" {^~<(*)> $} {#var prompt %trigger} "Scirkhan2" {nocr|prompt}
#TRIGGER {^~<(*)> } {} "Scirkhan2"
#TRIGGER "49" {^~<(*)> } {#if (%line = @prompt) {#gag;#sayp @prompt} {#t- "49";#t+ "66";#sub {1};#sayp @prompt}} "Scirkhan2"
#TRIGGER "66" {^~<(*)> } {#sub {2};#t- "66"} "Scirkhan" {disable}
#TRIGGER {$} {#t+ "49"} "Scirkhan2"



If you understand the triggers above, they should help clear some possibly confusing things.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed Sep 19, 2007 3:27 pm   
 
Well, based on what you've stated in this post, it appears that you're wanting to get rid of the blank line beneath the prompt. Understandable - I prefer to have an extra enter, though. :) I have everything in gauges with my prompts gagged. It makes for better eyesight. ;)

However, the following may be the best way to handle it.

#TRIGGER {^~<(*)~>} {}
#COND {$} {#gag} {Within|1}

So it'll check for a blank line received directly below the prompt and gag it. It'll still display your prompt, but instead of

< 1 2 > l

Blah

You'll get

< 1 2 > l
Blah

I hate not having zMUD in front of me to test my own interjections, but if it's wrong, I know someone will correct it. :P

Charneus
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