Quick Coding Questions

1235724

Comments

  • edited January 2016
    I seem to be double/triple moving on all directions after making a new Mudlet profile. Does anyone happen to have any idea why this is happening?

    Example : https://ada-young.appspot.com/pastebin/3644fd58https://ada-young.appspot.com/pastebin/d4161748

    [ SnB PvP Guide | Link ]

    [ Runewarden Sparring Videos | Link ]
  • Fixed it, ahem. Disregard please.

    [ SnB PvP Guide | Link ]

    [ Runewarden Sparring Videos | Link ]
  • I'm looking for a copy of Zulah's seafaring map window script. Can anyone provide a link? 
  • edited January 2016
    When switching between Mudlet profiles - one profile per class - is there a way to automatically reconfigure the serverside class defense list based on my current svof profile?

    Edit : To clarify, I have one Mudlet profile per class with its own standalone svof triggers.

    [ SnB PvP Guide | Link ]

    [ Runewarden Sparring Videos | Link ]
  • You could go into empty mode before switching profiles, I guess.
  • Is there an easy way to pre-populate a variable?

    For example, I've modifed Zulah's  GUI to display my Target and Friend variable:

    function updateScoreBox()

    clearWindow("scorebox")

    cecho("scorebox", "<white>"..gmcp.Char.Status.name.." ")

    cecho("scorebox", "<white>Target:<red>" ..target.. " ")

    cecho("scorebox", "<white>Friend:<green>" ..fri.. " ")

    cecho("scorebox", "<white>Level:<gold>"..gmcp.Char.Status.level.." ")

    cecho("scorebox", "<white>Race:<gold>"..gmcp.Char.Status.race.." ")

    cecho("scorebox", "<white>Class:<gold>"..gmcp.Char.Status.class.." ")

    cecho("scorebox", "<white>Gold:<gold>"..gmcp.Char.Status.gold.." ")

    cecho("scorebox", "<white>Unbound Credits:<gold>"..gmcp.Char.Status.unboundcredits.." ")

    cecho("scorebox", "<white>Bound Credits:<gold>"..gmcp.Char.Status.boundcredits.." ")

    end

    But the GUI alias won't run until I populate Target and Friend. Typing T Bob and F bob when i log in isn't so bad, but would rather not have to. I also want to add the output from Battlefury Perceive to be listed there so would like those set to 0 when I log in anyway without having to perceive someone to set them. I've tried something along the lines of target = bob triggering when I log in, but doesn't seem to work as I had intended. 


    I'm sure it's very simple...


    (Party): Mezghar says, "Stop."
  • AustereAustere Tennessee
    edited January 2016

    target = target or "Austere"
    fri = fri or "Austere"
  • edited January 2016
    Just make a script that does target = "bob"  somewhere. Scripts run on startup so any variables you just outright declare in one will start like that each time you load your profile. Make sure the script is above the GUI in the little folder list in the mudlet scripts window and it'll run first.
  • AhmetAhmet Wherever I wanna be
    Sobriquet said:
    Is there an easy way to pre-populate a variable?

    For example, I've modifed Zulah's  GUI to display my Target and Friend variable:

    function updateScoreBox()

    clearWindow("scorebox")

    cecho("scorebox", "<white>"..gmcp.Char.Status.name.." ")

    cecho("scorebox", "<white>Target:<red>" ..target.. " ")

    cecho("scorebox", "<white>Friend:<green>" ..fri.. " ")

    cecho("scorebox", "<white>Level:<gold>"..gmcp.Char.Status.level.." ")

    cecho("scorebox", "<white>Race:<gold>"..gmcp.Char.Status.race.." ")

    cecho("scorebox", "<white>Class:<gold>"..gmcp.Char.Status.class.." ")

    cecho("scorebox", "<white>Gold:<gold>"..gmcp.Char.Status.gold.." ")

    cecho("scorebox", "<white>Unbound Credits:<gold>"..gmcp.Char.Status.unboundcredits.." ")

    cecho("scorebox", "<white>Bound Credits:<gold>"..gmcp.Char.Status.boundcredits.." ")

    end

    But the GUI alias won't run until I populate Target and Friend. Typing T Bob and F bob when i log in isn't so bad, but would rather not have to. I also want to add the output from Battlefury Perceive to be listed there so would like those set to 0 when I log in anyway without having to perceive someone to set them. I've tried something along the lines of target = bob triggering when I log in, but doesn't seem to work as I had intended. 


    I'm sure it's very simple...

    cecho("scorebox", "<white>Target:<red>" ..(target or "").. " ")

    cecho("scorebox", "<white>Friend:<green>" ..(fri or "").. " ")

    Huh. Neat.
  • Or that!
  • Is torso damage trackable via gmcp? I've had several people tell me they use a gmcp torso tracking script and I can't seem to get around it even with blackout to hide torso slices.

    [ SnB PvP Guide | Link ]

    [ Runewarden Sparring Videos | Link ]
  • Currently, yes. I bugged it months ago and hasn't been fixed yet. It shows up on my prompt because I can't really make it not, but I haven't coded actually telling the game about it because that's obviously abuse of a bug.
  • I can't seem to get this script to fire properly - would I need event handlers or is there an error with my code/logic?

    function heartseed_sequence()	
    	if svo.classes[class].fighting == sylvan then
    		if svo.affl.mangledleftleg and svo.affl.mutilatedrightleg and svo.valid.simpleprone() then
    			svo.toggle_ignore("mangledrightarm") svo.toggle_ignore("mangledleftarm") svo.toggle_ignore("mangledrightleg") svo.toggle_ignore("mangledleftleg")
    		end
    	end
    end
    
    function heartseed_cured() if svo.classes[class].fighting == sylvan then if svo.valid.heartseed_cured() then svo.toggle_ignore("mangledrightarm") svo.toggle_ignore("mangledleftarm") svo.toggle_ignore("mangledrightleg") svo.toggle_ignore("mangledleftleg") end end end

    [ SnB PvP Guide | Link ]

    [ Runewarden Sparring Videos | Link ]
  • AhmetAhmet Wherever I wanna be
    I can't seem to get this script to fire properly - would I need event handlers or is there an error with my code/logic?

    function heartseed_sequence()	
    	if svo.classes[class].fighting == sylvan then
    		if svo.affl.mangledleftleg and svo.affl.mutilatedrightleg and svo.valid.simpleprone() then
    			svo.toggle_ignore("mangledrightarm") svo.toggle_ignore("mangledleftarm") svo.toggle_ignore("mangledrightleg") svo.toggle_ignore("mangledleftleg")
    		end
    	end
    end
    
    function heartseed_cured() if svo.classes[class].fighting == sylvan then if svo.valid.heartseed_cured() then svo.toggle_ignore("mangledrightarm") svo.toggle_ignore("mangledleftarm") svo.toggle_ignore("mangledrightleg") svo.toggle_ignore("mangledleftleg") end end end
    Well your script declares the functions. It doesn't call them. You'll have to call them in an alias/trigger or set an event handler to the function name.
    Huh. Neat.
  • I was wondering about that, thanks. Will create an event handler l8rz.

    [ SnB PvP Guide | Link ]

    [ Runewarden Sparring Videos | Link ]
  • edited February 2016
    What are class and sylvan defined as? Is sylvan supposed to be a variable?
  • Just looking at some of the coding suggestions mentioned in another thread. If i was to look to check for Battlefury balance, would I be looking for "gmcp.Char.Vitals.charstats, "Battlefury: Yes"

    I might have asked this before, but is there a list or way to found out all the GMCP values available?

    (Party): Mezghar says, "Stop."
  • On mobile, so no direct link from me, but my signature has a link to my rxtension of the official documentation. I don't have all charstats values listed there (might be worth adding) but beyond that its pretty complete.
  • edited February 2016
    Sobriquet said:
    Just looking at some of the coding suggestions mentioned in another thread. If i was to look to check for Battlefury balance, would I be looking for "gmcp.Char.Vitals.charstats, "Battlefury: Yes"

    I might have asked this before, but is there a list or way to found out all the GMCP values available?
    What you would be is sad.

    GMCP only has two bits of information for you regarding Battlefury.

    The first is Rage, which shows up in the charstats array of Char.Vitals.

    The second is IRE.Display.ButtonActions, which you can use to indirectly figure out balance (kinda sorta). So for instance Miasma shows up on Button 2 for Alchemists, and you can look at IRE.Display.ButtonActions.button2.highlight and if it's 1 that means you have enough rage to use Miasma, Miasma is off-cooldown, and the global cooldown isn't in effect.

    Unfortunately, IRE.Display.ButtonActions is actually bugged. It shows up the message after you'd expect it to get sent. So if I use Miasma, putting it on cooldown and triggering the global cooldown, I don't get an updated IRE.Display.ButtonActions with the Miasma message itself, instead I get one on the next message from the game. It looks like the code that checks whether a new IRE.Display.ButtonActions message needs to be sent is happening too early, so it's not taking into account the effects of the actual actions that change your rage/cooldowns.

    I submitted a bug on this, but it hasn't been reviewed yet.
  • That's Battlerage, no? Battlefury would be the two-handed spec balance, and as far as I know it's not included in GMCP at all.
  • Antonius said:
    That's Battlerage, no? Battlefury would be the two-handed spec balance, and as far as I know it's not included in GMCP at all.
    Yeh, was looking at the battlefury balance for 2H. Not a huge issue, just something I thought would be a good place to start with testing out GMCP info.

    (Party): Mezghar says, "Stop."
  • edited February 2016
    Antonius said:
    That's Battlerage, no? Battlefury would be the two-handed spec balance, and as far as I know it's not included in GMCP at all.
    Nevermind, I'm dumb.

    Would be worth looking at the charstats array though. That's where class-specific stuff goes.

    Just turn on GMCP debugging and look at Char.Vitals.
  • I'm trying to learn Mudlet, but it's not going well. Basically, I want a status bar above my command line, like CMUD has, where I can put basic info like my targets. It seems like making a miniconsole seems to be the best option, but I can't for the life of me figure out how to make it work. Here is what I have so far (ignore the ugly background color; that's just there to help me see it while I try to make it move around). I have a trigger/alias to create placeholder variables when I login, since it seems this won't work without that...buuuut the bar keeps disappearing. :(

    WindowWidth = 0;
    WindowHeight = 0;
    WindowWidth, WindowHeight = getMainWindowSize();
    createMiniConsole("botbox",100,100,0,0)
    setBackgroundColor("botbox",85,55,0,255)
    moveWindow("botbox", 5, WindowHeight-20)
    resizeWindow("botbox", WindowWidth,15)
    setWindowWrap("botbox", 1000)
    setMiniConsoleFontSize("botbox", 8)
    clearWindow("botbox")
    cecho("botbox", "<dark_violet>~*~* <violet_red>Current Victim: <red>" .. targ.."<medium_orchid> | ")
    cecho("botbox", "<violet_red>Next in Line: <red>" .. targ2.." <medium_orchid> | ")
    cecho("botbox", "<red>" .. targ3.." <medium_orchid> | ")
    cecho("botbox", "<red>" .. targ4.." <medium_orchid> | ")
    cecho("botbox", "<red>" .. targ5.."<medium_orchid> | ")
    cecho("botbox", "<red>" .. targ6.."")
    cecho("botbox", " <dark_violet> *~*~ ")
  • There's a thread somewhere here called free gui or something  by Zulah, you can grab that package to use as a base to learn all the GUI stuff you need
  • I tried that initially. It is a nice comprehensive GUI, but not exactly basic building blocks for a newbie.
  • edited February 2016
    Modifying the UI is by far the hardest thing to do in Mudlet (not that it's really tremendously easier in any other client). So don't get discouraged about learning Mudlet as a whole if it's giving you trouble.

    Most people mucking around with the UI in Mudlet are going to use geyser, the layout manager built into Mudlet. This is the reference for it: http://wiki.mudlet.org/w/Manual:Geyser

    It's been too long since I used it, so I can't tell you exactly where you're going wrong, but I can offer a few things that will at least help:

    First, I'm not really sure what you're talking about with regard to aliases and triggers - what you're trying to do thus far shouldn't involve any aliases or triggers. You want this miniconsole to be created at startup, and the way to run code at startup in Mudlet is with a Script (that's all Scripts do - run code at startup).

    Second, the way to set "placeholder variables" (what you're trying to do is called "initializing" variables - giving them an initial value) in Lua looks like this:
    target = target or "rat"
    That basically means "if the target exists, keep it the same, but if the target isn't anything yet, make it "rat"".

    You want to just initialize all the variables at the top of the script that creates the miniconsole. They need to be initialized before trying to reference their values like you're doing here. So put an initialization for each variable above WindowWidth = 0; in your script (not in some separate alias or trigger or whatever).

    Not sure why the bar keeps disappearing - hopefully someone else can help with that.
  • edited February 2016
    The trigger was off my login to set all my target variables to make sure they all exist from the start of my session, so the variables do exist, they just aren't in the bit I pasted, so I don't think that's the issue. The or option you showed is super helpful, so I'll clean that up and put them there. I'm used to CMUD where I can have variables persist between sessions. I'll look over the wiki page you linked, thanks!

    Just to double-check - there isn't some inbuilt option for a basic status bar in Mudlet like in CMUD that I'm just completely missing is there?

    Question about scripts - you said they run at startup. Do all your scripts automatically run at startup? Can you reference a script to make it run again? Can you exclude a script from running at startup? Like, if I wanted to make a setup for milling inks or gathering herbs, could I write a script for the bulk of the work and just feed in values, and only run it when I tell it to run? I had assumed that's what they did, and now I'm a bit confused.

    Thanks for the help!
  • Scripts not within a function run at startup. Your best bet if you want to input your own info before it fires is to put it in a function.
  • Ok! I think I'm getting my head wrapped around this. Now, if I click on a script in the settings menu in Mudlet, it will run it. How do I make it do that within another setting? For example, I want the display to update when I change my target, so I imagine I need to put something in my target alias to make the script run again.
  • edited February 2016

    @Qwyn: Make a function that updates the UI element, something like this:

    function updateMyGUI()
        -- code to update the content of the miniconsole here 
    end
    

    Then you'd just call

    updateMyGUI()

    at the end of your target alias. The same principle would apply to anything else in your mini console - call the function whenever the value is set.

Sign In or Register to comment.