Variable Contents as a Trigger

Lideron
Posts: 4
Joined: Fri Feb 05, 2010 2:45 am

Variable Contents as a Trigger

Post by Lideron »

I've been working on porting over all my Mush scripts to Mudlet, and so far, I've been pretty pleased. Everything's more or less worked with just some minor tweaks, and I really like the look of the client.

One of my favorite highlights though I'm not sure how to go about making happen in mudlet. Basically, I just want the contents of my 'target' variable to be highlighted whenever it's displayed. I remember this was a little tricky in Mush, but I got it to work, and what I did I'm not able to just 'port' over.

I'd appreciate any help... thanks!

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Variable Contents as a Trigger

Post by Vadi »


Lideron
Posts: 4
Joined: Fri Feb 05, 2010 2:45 am

Re: Variable Contents as a Trigger

Post by Lideron »

Got it, thanks Vadi.

One more hopefully quick question, didn't think it warranted it's own topic... I can't get newlines after the prompt to work properly for me, I've played with a number of the settings to no avail.

Here's what I'm getting... various lines, especially room titles are displaying on the same line as the previous prompt. I even tried echoing a newline in my prompt trigger, but it would actually get sent _after_ the room title, which seemed really odd. An example, I added an "echo("hi\n") first thing in my prompt trigger, and this is what I would get:

Code: Select all

6380h, 5538m, 21900w cexkdb-The mines of Moghedu. (Moghedu)hi
Here's what I'm just seeing otherwise:

Code: Select all

 
6380h, 5538m, 21900w cexkdb-The mines of Moghedu. (Moghedu)
An enormous cavern carved into the surrounding stone creates the immediate surroundings. From the ceiling, huge, thick stalactites hang down almost
halfway to the ground, the girth at their tops as big as the ancient trees in the Aalen. Mining tools are propped against the walls. The ends of the
picks are jabbed into the ground and their handles jut up in odd angles, casting strange shadows about the huge cavern walls. Several dirty mining
carts stand here, empty of the precious ores they contain during their daily work. Two sets of railtracks dip down steeply into the murky depths
directly ahead.
You see exits leading south and down.
6380h, 5538m, 21900w cexkdb-
6218h, 5566m, 21900w cexkdb-

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Variable Contents as a Trigger

Post by Heiko »

Looks like you are using a proxy client like Mudbot for a mapper probably. You have to configure Mudbot to properly forward telnet GA events. There is an option somewhere.

Lideron
Posts: 4
Joined: Fri Feb 05, 2010 2:45 am

Re: Variable Contents as a Trigger

Post by Lideron »

I'm using Vadi's mapper on Achaea. Not sure what I'd need to config with it. I've been using the same setup with Mush for quite a while, and never had an issue with newlines.

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: Variable Contents as a Trigger

Post by tsuujin »

ok, so I tried your workaround for variable highlighting and I have one small issue with it: it only highlights the first capture of the variable.

I would like it to be recursive through the entire line, highlighing each occurance of the captured variable. Any ideas?

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Variable Contents as a Trigger

Post by Heiko »

Not difficult. You can loop through all matches of your target on the current line with while selectString(target, numofmatch+1) > -1 then highlight.

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: Variable Contents as a Trigger

Post by tsuujin »

Ok, so try as I might, I can't seem to get this code to work in a tempTrigger. Think you could post some more specific code to make this work directly from a temp trigger?

User avatar
Rakon
Posts: 350
Joined: Tue Feb 16, 2010 7:41 pm
Contact:

Re: Variable Contents as a Trigger

Post by Rakon »

I'd really like to see this functionality in Mudlet.

As it stands, I have a trigger in MUSHclient that matches a variable.
Match: \b(!@enemies)\b
Color: red
Regex: y

Enemies Variable: 1800 names(words) separated by |

Running that trigger with Mushclient, it outputs and highlights correctly the full list of 1800 names, in less than a second.

Attempting the same trigger on Mudlet:

Match:\b (list of names)\b
Type: Regex
Color: Red

To color the entire list of 1800 names, it took mudlet :
From 00:36:47.215 to 00:39:12.379

I tried doing a log with the replay function, but without the trigger enabled it just pops up like normal, and doesn't show how long it ACTUALLY took for the output to be processed.

naftali
Posts: 138
Joined: Wed Jan 20, 2010 8:42 pm

Re: Variable Contents as a Trigger

Post by naftali »

@Rakon - If you make the variable a table where each entry is a name then you could do the following:

Code: Select all

for i, name in ipairs(enemies) do
	echo(name)
	if i ~= #enemies then echo(", ") else echo(".") end
end
That should output the contents of your enemies variable separated by commas, and since you don't need to use regexp matching it should be alot quicker.

Post Reply