Mudlet questions & answers!

1568101114

Comments

  • That led me to find the problem. I had an old display function buried in my limbcounter, and it was causing issues of course! Thanks.
    Chat with other players in real time on your phone, browser, or desktop client:
    Come join the Achaea discord!
  • 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:

    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?


  • Vastus said:
    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:

    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?


    You probably need to escape the whitespace in the url:

        border-image:url(C:/Users/Eigenaar/Pictures/FMA\ Circle.jpg)

    I think just putting quotes around the string, 

        border-image:url("C:/Users/Eigenaar/Pictures/FMA Circle.jpg")

    will also work, but I haven't done much with URLs in CSS, so not 100% sure.
  • Eld said:
    Vastus said:
    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:

    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?


    You probably need to escape the whitespace in the url:

        border-image:url(C:/Users/Eigenaar/Pictures/FMA\ Circle.jpg)

    I think just putting quotes around the string, 

        border-image:url("C:/Users/Eigenaar/Pictures/FMA Circle.jpg")

    will also work, but I haven't done much with URLs in CSS, so not 100% sure.
    Tried it, still doesn't work. Perhaps any other ideas?
  • 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.
  • Hrm, I think I did not have the end originally, but I will check it as soon as I can log in.
  • 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..
  • edited November 2013
    Vastus said:
    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.
  • I think you need to use a .png file - I'm not 100% though
    Achieved dragon on the 13th of Aeguary, 634 - aged 21 and 1 month and 21 days.

    Elder dragon on the 6th of Chronos 635 - aged 22 and 8 months and 14 days.
  • Thank you @Hegua and @Cathy, I changed it to png and it works now. My gui is finished, hurray!
  • JonathinJonathin Retired in a hole.
    Is there any way to set the container for a geyser label using a variable?

    It would make it a whole hell of a ton easier if I could have a k,v pair as container/labelname.
    I am retired and log into the forums maybe once every 2 months. It was a good 20 years, live your best lives, friends.
  • Geyser.Label:getWindow(label) might do it. Haven't tested.
  • edited November 2013
    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:

    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 :(


  • 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:

    table.remove( AllyList, table.index_of(AllyList, matches[2] ))
  • Thanks! As far as I can tell, I got everything to work :)
  • 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?
    Chat with other players in real time on your phone, browser, or desktop client:
    Come join the Achaea discord!
  • Rom said:
    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.
  • Antonius said:
    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.
  • You can, both via GUI and functions.
  • Vadimuses said:
    You can, both via GUI and functions.
    Hm, is being able to do it via the GUI new? If you do it that way, how do you do the naming, just name the script "a.b.c" for @Antonius's example?
  • @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.
  • Looks like I've got some scripts to change!
  • 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.
  • I'll add a note to http://wiki.mudlet.org/w/Manual:Technical_Manual#Event_System when I can, or if you'd like, you can add it in as well.
  • 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. 
  • expandAlias("whatever it is")
    Achieved dragon on the 13th of Aeguary, 634 - aged 21 and 1 month and 21 days.

    Elder dragon on the 6th of Chronos 635 - aged 22 and 8 months and 14 days.
  • Cathy said:
    expandAlias("whatever it is")
    Thanks Cathy! I always heard 'expandalias' was something we should not use. Is this still true? 
Sign In or Register to comment.