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
lizard42069
Beginner


Joined: 15 Dec 2014
Posts: 19

PostPosted: Mon Dec 15, 2014 2:41 pm   

Help writing some window-gag-triggers
 
Hey there. I'm just getting into all these cool features and need a bit of help.

CMUD v2.37

So, I'm trying to do something that seems like it should be pretty simple.

I've got a window set up titled Who. I want to have the line command who displayed in this window about every 5 minutes. And I want to GAG the entirety of the who result from my main window. I got a trigger so that it will send the who result to the who window. The gag seems to be the problematic part. I'm only able to gag at -1 or 2, and there's about 20 lines involved in the who result.

Any help would be appreciated.

Edit: Is there any way to basically loop an alarm to call a command to the window and gag the command's result?

Edit2: Ok, so I've played around some more and made progress.

In a Trigger:
\--------------------------------------------------------/ (((when this is posted to the window))

#CAP -14 who ((will send the previous 14 lines to the who window))
#GAG -14 ((will remove the 14 lines before the trigger line from the main window))

This is all well and good, but I'm still seeing the trigger line itself, and since this particular command, 'who' can change the number of lines displayed depending on how many players are logged in, its hard to dial it in. The Trigger itself identifies the bottom-most line of the who result, which is the most unique and identifiable line of the result. I still feel like there should be a better way to handle this. Some way to tell the trigger that when the command 'who' is sent that the next return should be entirely GAG and CAP to the Who window. Any thoughts?

Edit3: An additional note on what's happening here. The CAP is sending all text on the display behind the trigger line, including all text not associated with the 'who' command, so anything posted before the who command was sent is also transferring to the Who window. This is not a huge problem, but I feel like it could be cleaner. I'm going to try reversing the order of CAP and GAG to positive values, but I doubt the first line of the 'who' return will be recognized, and I'd rather not have it triggering anything at all due to its nature.

I'd still like to see if there's some way of having the execution of the who command being the trigger before anything is posted.

Edit 4: Breakthrough.

By including a blank #GAG I've omitted the triggering line from displaying on the main window.

So the code now looks like this and works rather well.

Trigger: \--------------------------------------------------------/
#WIN -20 who
#GAG
#GAG -14

However, if more players log in, the GAG is not going to be in effect beyond the 14th line above the Trigger. I have tried to use the first line of the who return as a trigger, but its a no go, the code doesn't like noticing that line so it can't be used.

Edit 4.1: While the GAG is working, it is also flashing the text to the display window before the GAG removes it. I was hoping that dialing the number lines sent to the WIN would get rid of the flicker, but its continuing. I'll try restarting my client and see if that issue is resolved with a fresh cache.

Edit 4.2 Restarting the client seemed to help. But it seems that part of the flicker issue might have to do with having a lower than optimal connection speed at the moment. With no browsers open the flicker was unnoticeable, closing more browsers reduced the flicker time.
Reply with quote
hogarius
Adept


Joined: 29 Jan 2003
Posts: 221
Location: islands.genesismuds.org

PostPosted: Mon Dec 15, 2014 6:54 pm   
 
Can you post some actual output from the MUD's who command, without your trigger affecting it? And also indicate exactly what parts of the output you want redirected to your Who window.

Since you don't know how many lines will be output, perhaps your alias should turn on a trigger that detects every line. Then depending on whether that line is introductory stuff, player info or ending stuff, you process the line differently. The final line of the [b]who[\b] output triggers a closing script that turns off the alias.

It shouldn't be too difficult to create an alarm that runs the alias every 5 minutes.
Reply with quote
lizard42069
Beginner


Joined: 15 Dec 2014
Posts: 19

PostPosted: Mon Dec 15, 2014 8:00 pm   
 
I want essentially everything between the command prompts to go to the who window, and nothing else.



| _____ _____ |
0 |o o o| |o o o| 0
/ \ ___|o o o|=====|o o o|___ / \
||| |o o|o o o| |o o o|o o| |||
/===\ ___|o o|o o o| |o o o|o o|___ /===\
\ / |o o|o o|o o o| |o o o|o o|o o| \ /
| | |o o|o o|o o o| |o o o|o o|o o| | |
/ \ |0 0|o o|o 0 o| |o 0 o|o o| 0 | / \
-=============== Runners In the Shadows ================-
Midnight
Draft

-=============~.~.~.~.~.~.~.~.~.~.~.~.~=================-
/ There are [ 2] characters on, the most on today [ 3].\
\--------------------------------------------------------/

(E-S-Se-) (¥:254891) Resting
Health:[10] Stun:[10] mv:275 Wait[0]


So here you see the who's display and below is the status prompt which gets refreshed with every command.

Currently I have this working as follows:

The Trigger recognizes: \--------------------------------------------------------/

#GAG
#CAPTURE -20 who
#GAG -14

And that's that. It gags everything and sends just the who list (including the building graphics which is fine.) to the who window

To get the refresh alarm going I worked out when I discovered you can set a trigger to be an alarm, so I set up a simple trigger that looks like the following.

Trigger: -2:00
who

All of this is working very well, except that I'm still getting a flicker of the who list on the main window before it gets GAGed once the GAG kicks in it only shows in the who window.

I've got another window set up similarly for an ascii map inside the mud and its behaving the same, but the flicker is much quicker on the map than the who before the GAG erases it.

Edit: I'm not going to add the spaces into the graphic up there.

Edit2: I just had a brainstorm that I think explains the flicker. The GAG line is based on the \---------/ at the bottom of the who list (same setup for the map trigger) so the GAG can't start working UNTIL THAT LINE happens right?

I have a good feeling about this being the reason, thoughts?

Edit3: Made a small tweek that drastically reduced the flicker.

Reviewing my map code I found that the CAP was a positive number.

Changed CAP

#CAPTURE 20 who

Edit4: Ah, a 3rd person has just logged in and made my who command even more problematic. With a 3rd person in the MUD the line is pushed up beyond the GAG parameters.

Edit5: I'm very interested in the idea of specifically identifying each line of the who result, as you suggested. I'm not sure how to start on that though. Especially since the ascii graphic has a lot of empty space in it, probably filled with some invisible code.
Reply with quote
hogarius
Adept


Joined: 29 Jan 2003
Posts: 221
Location: islands.genesismuds.org

PostPosted: Mon Dec 15, 2014 11:52 pm   
 
I doubt the graphic has some invisible embedded code, especially if the graphic appears the same way each time. If the MUD is going to transmit hidden information, it probably would use one of the MUD protocols designed to do just that.

I'm going to presume capturing the graphic to your Who window isn't necessary. So, instead of triggering off a line at the end of the list, we should trigger on the line just before the actual list of names.

Pattern:
Code:
-=============== Runners In the Shadows ===============-

Script:
Code:
#capture Who
#gag
#T+ Names

Now, create a trigger with an ID of Names as follows:

Pattern:
Code:
(*)

Script:
Code:
#capture Who
#gag
#if (%1 = "\--------------------------------------------------------/") {#-T Names)

This trigger will capture every line that comes in. When it detects the last line of the who output, it captures that line and turns itself off.
Reply with quote
lizard42069
Beginner


Joined: 15 Dec 2014
Posts: 19

PostPosted: Tue Dec 16, 2014 12:18 am   
 
In that last script did you mean {#T- Names} ?

Also as is, I'm getting a fired but failed to compile on both of those..
Reply with quote
hogarius
Adept


Joined: 29 Jan 2003
Posts: 221
Location: islands.genesismuds.org

PostPosted: Tue Dec 16, 2014 12:20 am   
 
Yes, I did mean #T- . I apologize.
Reply with quote
lizard42069
Beginner


Joined: 15 Dec 2014
Posts: 19

PostPosted: Tue Dec 16, 2014 12:29 am   
 
should that second trigger be a different type than pattern?

The first one turned out ok, I double hashtaged in it, fixed. That one's firing and compiling now.

Error compiling code:
Illegal Token:


but its not telling me anything more about what's wrong with (*)
Reply with quote
lizard42069
Beginner


Joined: 15 Dec 2014
Posts: 19

PostPosted: Tue Dec 16, 2014 12:39 am   
 
Ok, there we go(ish)

There were some typos with your code and I copy pasted it Laughing

it is firing now and compiling now.

However it is NOT sending to the who window, it is posting to the main window and everything below Runners in the Shadows is GAG but the buildings are still there..

(Honestly I'm not quite grasping this code you got here yet)

What is the %1 telling the code to do?
Reply with quote
hogarius
Adept


Joined: 29 Jan 2003
Posts: 221
Location: islands.genesismuds.org

PostPosted: Tue Dec 16, 2014 1:03 am   
 
%1 should return what's in the first set of parentheses in the trigger's pattern. The second set of parentheses would be %2, etc.

* indicates all characters.

Try changing the trigger pattern to ^(*)$

^ in a pattern specifies the beginning of a line, $ in a pattern specifies the end of the line.

Regarding your other questions...

You can either #GAG the building lines individually, or begin your capture with the first line of the building instead of the "Runners In the Shadows" line.

Make sure the name of the window and the window name in the trigger scripts are both Who, capitalized the same way.

If that doesn't make a difference, try writing the capture lines as follows:
Code:
#CAPTURE 1 Who
Reply with quote
lizard42069
Beginner


Joined: 15 Dec 2014
Posts: 19

PostPosted: Tue Dec 16, 2014 1:18 am   
 
Hey, you know what? Huzzah!

So specifically here we:

TRIG: -=============== Runners In the Shadows ================-
#CAPTURE 1 Who
#GAG +8
#T+ Names

TRIG: Names:^(*)$
#CAPTURE 1 Who
#GAG
#IF (%1 = "\--------------------------------------------------------/") {#T- Names}

TRIG (ALARM) : -2:00
who

AND it works.

Hey thanks a great deal hogarius!

deckeon.mine.nu
2065

if you ever feel like joining us
_________________
Step into the shadows of Deckeon
deckeon.mine.nu :: 2065
----------
3rd Edition Shadowrun MUD
----------
http://deckeon.net/
http://deckeon-mud.wikidot.com/
https://www.facebook.com/deckeonMUD
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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