copy()/appendBuffer()

Post Reply
Fo-Rum
Posts: 32
Joined: Fri May 21, 2010 7:38 pm

copy()/appendBuffer()

Post by Fo-Rum » Mon Mar 11, 2013 3:49 am

So, I've been using these two functions for a while now, to retain the colour of maps in IRE games, which I redirect to a miniconsole.

There seems to be a small problem with one of the two. What happens is that Lua throws an error, something about a nil value, and then all of my game text is redirected into my map window instead of the game map. Also, parts of the game map do make it over at times. EDIT: I'd like to clarify that this isn't consistent. It does indeed copy and append perfectly fine, most of the time. I'd say over 95% of the time this works flawlessly.

Here is my trigger used to capture the map lines: ^.

I have also used .*, and begin of line substrings for each possible map character.

Here is my code:

selectCurrentLine()
copy()
appendBuffer("game_map")
deleteLine()

I spent about 20 minutes just now trying to figure out what was happening. I noticed absolutely no pattern on what could be triggering this. If I changed the code over to just echoing the line instead, there were no problems. Eventually, my client crashed! No same map will do this consistently, so this is why it is hard to find a pattern, and it seems pretty uncommon for most areas I've seen in these games.

I'm using windows XP SP3, on Mudlet 2.1.

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

Re: copy()/appendBuffer()

Post by Vadi » Mon Mar 11, 2013 5:05 am

It sounds like the code you have to stop capturing the map bugs out, and the command to stop capturing doesn't go through due to an earlier bug and hence it keeps capturing.

Fo-Rum
Posts: 32
Joined: Fri May 21, 2010 7:38 pm

Re: copy()/appendBuffer()

Post by Fo-Rum » Tue Mar 12, 2013 3:20 am

Hi!

I forgot to specify that the game map is 24 lines long, so the trigger chain is also only 24 lines. No code required to close it!

The reason I tried begin of line substrings for all map characters is to rule out "all captures". Most of the possible map characters, such as: space [ ] \ / | _ < > ^ will not trigger off of every game line when being used as a begin of line substring, so this helped to rule out the all capture scenario as was seen being sent to my miniconsole, which still happened. This is why I think there is a problem with copy or appenderBuffer, but I can't know for sure!

As noted before, I have done...

echo("game_map", line)

and of course for the same results

echo("game_map", matches[2])

These have never had a problem, they just lack colour. :(

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

Re: copy()/appendBuffer()

Post by Vadi » Tue Mar 12, 2013 3:28 am

There are no known problems with them, and they work reliably in many map/chat/game capture scripts. I think your issue lies elsewhere.

Lucky24
Posts: 49
Joined: Sun Sep 12, 2010 1:50 am

Re: copy()/appendBuffer()

Post by Lucky24 » Tue Mar 12, 2013 3:46 am

Note that when you use functions like selectLine(), it actually moves the mouse cursor and selects the line, so if you're doing anything else with selecting text in between it can get messed up. Also, when you delete lines it deletes the line the cursor is currently on, though I believe you can specify which line.

Fo-Rum
Posts: 32
Joined: Fri May 21, 2010 7:38 pm

Re: copy()/appendBuffer()

Post by Fo-Rum » Tue Mar 12, 2013 3:51 am

Thanks for reassurance! I've had unfortunate crashing issues with Mudlet in the past, that thankfully have all been solved with updates (with the exception of testing expandAlias, fun stuff).

I went back and tested a bit more and found the problem, but first: I don't know where the nil error was coming from that I got the other day (consistent, matched timestamps), since I wasn't getting it just now. I don't have an idea why it crashed (totally unrelated).

I had an additional trigger that I completely forgot about packed in with my general set of IRE stuff, that should have been separate. It's for for capturing maps in aetherspace on Lusternia, I guess! Begin of line substring: Floating, and then it just captures all text and closes after 19 lines. So, any place that happens to have floating stuff at the very start on it's own line will mess my map up. Fixed, to say the least!

Thanks again, I appreciate the help and I still love this client!

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests