Map capture causing crash

Post Reply
sephiel
Posts: 17
Joined: Mon Nov 30, 2009 10:35 am

Map capture causing crash

Post by sephiel »

So, my map capture code is causing mudlet to crash for some reason. I've isolated the following code as causing the crash, as with the triggers disable - or if the code has yet to run (these triggers haven't been fired yet), no crash.

Script: mapWindow

Code: Select all

WindowWidth, WindowHeight = getMainWindowSize()
createMiniConsole("map",0,0,0,0)
setBackgroundColor("map",0,0,0,255)
setMiniConsoleFontSize("map", 10)
resizeWindow( "map", 350, 385 )
moveWindow( "map", 1550, 0 )

function mapCapture()
setBgColor(0,0,0)
copy()
appendBuffer("map")
deleteLine()
end
Trigger: mapEnable

Code: Select all

Pattern:  v\d+ -
Code:
echo("map", "\n" )
mapCapture()
enableTrigger("mapCapture")
Trigger: mapCapture

Code: Select all

Pattern: (.*)
Code:
mapCapture()
Trigger: mapDisable

Code: Select all

Pattern:  -?\d+:-?\d+:-?\d+ -
Code:
mapCapture()
disableTrigger("mapCapture")
The three triggers are within a folder called "mapWindow". Is there anything in my coding that's making it crash, or anything I can do to make it run better? I swear I've run this code in past, even on my current version (1.0.5) without any hassles.


ETA: I've changed my capturing trigger to a tempLineTrigger() and that seems to have stopped the crashes, though I'm curious as to what I did that caused the initial problem.

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

Re: Map capture causing crash

Post by Heiko »

In the map capture trigger you call setBgColor() on an undefined selection. The result is undefined.
Correct would be:
selectCurrentLine()
setBgColor( 0,0,0)

sephiel
Posts: 17
Joined: Mon Nov 30, 2009 10:35 am

Re: Map capture causing crash

Post by sephiel »

Ah, thank you!

Post Reply