Label Problem

Post Reply
Yetzederixx
Posts: 186
Joined: Sun Nov 14, 2010 5:57 am

Label Problem

Post by Yetzederixx »

Using the Mudlet Manual I tried to create a label so that when I pressed a button it would bring up a label to let me know that some trigger/alias set is on, in this case crafting. Now, this worked last night at 0400 I swear, and now it won't.

Here's the code for the label generation:

Code: Select all

local w, h = getMainWindowSize()

if (createLabel("CraftingON", 0, 0, 0, 0, 1)) then 
	echo("LABEL CREATED \n")
else
	echo("LABEL CREATION FAILED \n")
end

resizeWindow("CraftingON", 200, 35) -- w, h
moveWindow("CraftingON", w-200, 0) -- x, y

setBackgroundColor("CraftingON", 0, 255, 0, 150) -- r, g, b, trans

setLabelClickCallback("CraftingON", "turnCraftingOff")

echo("CraftingON", [[<p><b><center><font size="14" color ="red">Crafting On</font></center></b></p>]])
showWindow("CraftingON")
The output when I click the button, I put the if test for debugging, is always: LABEL CREATION FAILED

Here is the code for the callback, not that it's important:

Code: Select all

function turnCraftingOff()
	disableTrigger("Crafting")
	disableAlias("Crafting")
	hideWindow("CraftingON")

	isCrafting = false
end --turnCraftingOff(void)
I'm using Mudlet 1.1.0 built: March 8, 2010 on Win XP Home.

Yetzederixx
Posts: 186
Joined: Sun Nov 14, 2010 5:57 am

Re: Label Problem

Post by Yetzederixx »

Oh, yes I tried changing the w, h, x, y in createLabel to no avail.

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

Re: Label Problem

Post by Heiko »

1. You should use the latest Mudlet pre-release 1.2.0pre6. The fact that it's not a full release just means that not all planned features have been added yet, but overall it's the best release available at the moment.
2. There's a major problem in your script: Labels cannot be deleted, they can only be hidden. You need to create all of your labels in an init script and hide those that are not supposed to be shown on the screen. Then you simply use showWindow( "foo" ) to show the label. Creating an existing label will always fail because a window with the name is already defined.

Post Reply