Well I am back again. Anyway, because of those GUI threads I wanted to make one too and after the room inventory, the tabbed chat and the mapper there is still room for a picture, but I can't get it to work. It is pretty much copied from the Mudlet lua site except I changed the coordinates and ofcourse the picture location. I got the label, but the picture is not showing, been looking at it for hours now. Here is the code:
Well I am back again. Anyway, because of those GUI threads I wanted to make one too and after the room inventory, the tabbed chat and the mapper there is still room for a picture, but I can't get it to work. It is pretty much copied from the Mudlet lua site except I changed the coordinates and ofcourse the picture location. I got the label, but the picture is not showing, been looking at it for hours now. Here is the code:
Well I am back again. Anyway, because of those GUI threads I wanted to make one too and after the room inventory, the tabbed chat and the mapper there is still room for a picture, but I can't get it to work. It is pretty much copied from the Mudlet lua site except I changed the coordinates and ofcourse the picture location. I got the label, but the picture is not showing, been looking at it for hours now. Here is the code:
Oh, looking at it again, if that's the entire script, that "end" is extraneous. Unless this whole thing is inside a function or something that you haven't shown. Wouldn't expect that to affect it, though, as it should execute everything before that and then throw an error.
It did seem to remove the error, but the image is still not showing, it is still just a grey label. Tried it with another picture too, didn't change anything. I really don't see why it doesn't work..
It did seem to remove the error, but the image is still not showing, it is still just a grey label. Tried it with another picture too, didn't change anything. I really don't see why it doesn't work..
It looks like you're trying to use JPG images on Windows which does not work unless things have changed recently.
Hi I'm new. I've been trying to make an list to exclude announcing certain people on mindnet but I've hit a bit of a wall. I can add people to the list but I can't seem to remove them. As follows:
The table.remove function expects a number indicating the index of the value in an indexed table; it doesn't work on the value itself. Personally I use the following code to add a function to remove by value:
table.remove_value = table.remove_value or function(t, v)
local i = table.index_of(t, v)
if i then
table.remove(t, i)
end
end
Then you'd call table.remove_value(AllyList, matches[2])
bad argument #2 to 'remove' (number expected, got string)
That's table.remove() telling you that you gave it a string (text), but it expects (wants) a number. So it doesn't take a name to remove! Looking at the explanation of table.remove(), the second argument is "pos" (position). So you give it the position of the item you'd like to remove (why this seemingly more difficult way is done so, you'll find out later as you learn more Lua. It's actually pretty great and gives you good flexibility).
Thankfully Mudlet introduces a function for you, table.index_of(), which tells you what index is an item at. So you can remove your item with:
Hi, I've recently grown envious of people that have everything logged so I decided to start doing it! So far I've been using the built-in HTML logging in Mudlet and it's great except it will stop logging without warning at seemingly random points. Once it stops logging on its own accord it will not resume logging until I restart Mudlet, and the button remains in its "pressed" state the entire time. The activities I'm doing when the logs abruptly end seem to have no correlation with eachother, and the length/size of the logs don't either. Any thoughts?
Hi, I've recently grown envious of people that have everything logged so I decided to start doing it! So far I've been using the built-in HTML logging in Mudlet and it's great except it will stop logging without warning at seemingly random points. Once it stops logging on its own accord it will not resume logging until I restart Mudlet, and the button remains in its "pressed" state the entire time. The activities I'm doing when the logs abruptly end seem to have no correlation with eachother, and the length/size of the logs don't either. Any thoughts?
My only real thoughts are that a) it sucks and b) it ain't just you, bub. For HTML logging I use other scripts. Mudlet's built-in logging does work pretty reliably when using plain text logs.
Yeah, the built-in html logging is pretty turrible. There are a few html logging scripts available on the Mudlet forums. I think Wyd's is one of the more popular ones. I haven't tried any of them myself, so can't recommend one in particular, though.
Is it possible to namespace event handler functions?
So if I had a script called a.b.c with a registered event handler (for, say, a GMCP event), and then inside it had:
a.b.c = function() some code to handle an event end
would it work?
I had a brief read through the Mudlet Event Engine doc and couldn't see anything that suggested an answer either way, and I can't currently try it out for myself.
Is it possible to namespace event handler functions?
So if I had a script called a.b.c with a registered event handler (for, say, a GMCP event), and then inside it had:
a.b.c = function() some code to handle an event end
would it work?
I had a brief read through the Mudlet Event Engine doc and couldn't see anything that suggested an answer either way, and I can't currently try it out for myself.
Not with the gui "register event handler" mechanism, as far as I know, but you can do it with registerAnonymousEventHandler.
registerAnonymousEventHandler("My event","a.b.c")
That's a relatively new feature, documentation may not have caught up.
@Eld: Yeah, I finally got an opportunity to test it out. Just naming the script with the full namespace of the function (so a.b.c if we stick with my example) seemed to do it.
Yeah, I rearranged a load of things a couple of weeks ago, but in the process ended up with two "update" scripts with gmcp.Char.Item.Update event handlers, so obviously they were conflicting with each other. I probably could have just merged them into a single function, but then I'm joining together two totally unrelated sections of my scripts just to solve a problem; namespacing is a lot cleaner and keeps them separate.
Simple question: How do I execute an alias inside of a key or 'macro?'
I downloaded Wieczo's Harvester and want it to fire the 'harvest' alias every time I move a direction using my keypad. I tried adding the functions listed in the alias to the key, but no luck.
Comments
Come join the Achaea discord!
picture_label = Geyser.Label:new({
name = "picture_label",
x = "900px", y = "0px",
width = "300px", height = "250px"
})
picture_label:setStyleSheet[[
border-image: url(C:/Users/Eigenaar/Pictures/FMA Circle.jpg);
]]
end
Any idea?
Svof
Mudlet Discord join up
I made this to add:
table.insert( AllyList, matches[2] )
echo( "Added a new ally:" .. matches[2] .. "\n" )
table.save(getMudletHomeDir() .. "/AllyList", AllyList)
echo(string.format("AllyList saved in: '%s'", getMudletHomeDir() .. "AllyList"))
That works fine. Presumably my remove alias should just swap the insert with a remove but....
table.remove( AllyList, matches[2] )
echo( "Removed Ally: " .. matches[2] .. "\n" )
table.save(getMudletHomeDir() .. "/AllyList", AllyList)
echo(string.format("AllyList saved in: '%s'", getMudletHomeDir() .. "AllyList"))
I keep getting this error message in debug:
Alias name=Remove from Allies(^Remove Ally (.*)$) matched.
Alias: capture group #1 = <Remove Ally Anedhel>
Alias: capture group #2 = <Anedhel>
LUA: ERROR running script Remove from Allies (Alias128) ERROR:[string "function Alias128()..."]:2:
bad argument #2 to 'remove' (number expected, got string)
I don't understand why it says it's expecting a number.
edit: Ugh, actually it seems the trigger itself isn't referencing the list properly
EchoLine = string.title(matches[1])
cecho("\n<red>"..EchoLine)
cecho("\n<yellow>"..EchoLine)
cecho("\n<green>"..EchoLine)
if AllyList ~= string.title(matches[2]) then
send("pt " ..EchoLine)
end
I am still calling names on the list
table.remove_value = table.remove_value or function(t, v)
local i = table.index_of(t, v)
if i then
table.remove(t, i)
end
end
Then you'd call table.remove_value(AllyList, matches[2])
Results of disembowel testing | Knight limb counter | GMCP AB files
Svof
Mudlet Discord join up
Come join the Achaea discord!
So if I had a script called a.b.c with a registered event handler (for, say, a GMCP event), and then inside it had:
would it work?
I had a brief read through the Mudlet Event Engine doc and couldn't see anything that suggested an answer either way, and I can't currently try it out for myself.
Results of disembowel testing | Knight limb counter | GMCP AB files
Svof
Mudlet Discord join up
Results of disembowel testing | Knight limb counter | GMCP AB files
Results of disembowel testing | Knight limb counter | GMCP AB files
Svof
Mudlet Discord join up