Welcome to the Achaea Forums! Please be sure to read the Forum Rules.

Mudlet keeps erasing/forgetting a variable?

AzjopasAzjopas Member Posts: 9
Maybe a stupid question, but I have a core variable I use: "Class" --> all my bashing stuff depends on what the class variable is.

Every single time I login to Achaea, my bashing aliases are all broken, because the 'Class' variable is missing. I have to re-add it. I thought maybe Mudlet wasn't pulling my most recent profile, but other changes and upgrades I've done are carrying over from one session to the next, except for this one variable. Any ideas?

Comments

  • JaceroJacero Member Posts: 37 ✭✭ - Stalwart
    edited April 2016
    When loading scripts in Mudlet, the order they're in matters. The script that defines Class needs to be above (in the list on the left) the scripts that call that variable.

    E: Also, if Class is a local variable, other scripts won't be able to use it since it'll be out of scope.
  • KlendathuKlendathu Eye of the StormMember Posts: 3,178 @@ - Legendary Achaean
    At the top of every script that requires it put the following line:

    Class = Class or "unknown"

    That way, the variable is initialised ready to be populated before a script tries to use it.

    What are you populating it with for nomal use? gmcp.Char.Status.class?

    Tharos, the Announcer of Delos shouts, "It's near the end of the egghunt and I still haven't figured out how to pronounce Clean-dat-hoo."
  • AntoniusAntonius Member Posts: 4,805 @@ - Legendary Achaean

    Variables don't persist through Mudlet sessions by default, you have to explicitly tell Mudlet to save them. However, for something like your class, you're better off just pulling it from GMCP. Create a script that does the following:

    function gmcpClass()
        Class = gmcp.Char.Status.class
    end
    registerAnonymousEventHandler("gmcp.Char.Status", "gmcpClass")
    
  • AzjopasAzjopas Member Posts: 9
    @Antonius wow I actually didn't know that. I haven't been using Mudlet for very long and for the longest time I was using Zmud, which kept track of variables from each session.

    Can I ask a follow up question? I made an alias "ds" (short for DSL) which works great, but whenever the letters "ds" appear together in a line I send, it replaces the whole line with my ds alias. For example, typing HONOURS DEEDS AZJOPAS just sends the command "ds" and tries to bash. Is there a way to set it so the "ds" alias only activates when that is the only thing on the line?
  • DalranDalran Member Posts: 227 ✭✭✭ - Distinguished
    Azjopas said:
    @Antonius wow I actually didn't know that. I haven't been using Mudlet for very long and for the longest time I was using Zmud, which kept track of variables from each session.

    Can I ask a follow up question? I made an alias "ds" (short for DSL) which works great, but whenever the letters "ds" appear together in a line I send, it replaces the whole line with my ds alias. For example, typing HONOURS DEEDS AZJOPAS just sends the command "ds" and tries to bash. Is there a way to set it so the "ds" alias only activates when that is the only thing on the line?
    ^ds$
    Antidas
  • AhmetAhmet Wherever I wanna beMember Posts: 3,370 @@ - Legendary Achaean
    Dalran said:
    Azjopas said:
    @Antonius wow I actually didn't know that. I haven't been using Mudlet for very long and for the longest time I was using Zmud, which kept track of variables from each session.

    Can I ask a follow up question? I made an alias "ds" (short for DSL) which works great, but whenever the letters "ds" appear together in a line I send, it replaces the whole line with my ds alias. For example, typing HONOURS DEEDS AZJOPAS just sends the command "ds" and tries to bash. Is there a way to set it so the "ds" alias only activates when that is the only thing on the line?
    ^ds$
    To elaborate a little bit, use the pattern ^ds$ instead of just ds. The characters ^ and $ denote the start and end of the regex match for your alias, so when those are not present, the regex "ds" matches on the "ds" in deeds.
    Huh. Neat.
    Dalran
  • DalranDalran Member Posts: 227 ✭✭✭ - Distinguished
    Ahmet said:
    Dalran said:
    Azjopas said:
    @Antonius wow I actually didn't know that. I haven't been using Mudlet for very long and for the longest time I was using Zmud, which kept track of variables from each session.

    Can I ask a follow up question? I made an alias "ds" (short for DSL) which works great, but whenever the letters "ds" appear together in a line I send, it replaces the whole line with my ds alias. For example, typing HONOURS DEEDS AZJOPAS just sends the command "ds" and tries to bash. Is there a way to set it so the "ds" alias only activates when that is the only thing on the line?
    ^ds$
    To elaborate a little bit, use the pattern ^ds$ instead of just ds. The characters ^ and $ denote the start and end of the regex match for your alias, so when those are not present, the regex "ds" matches on the "ds" in deeds.
    Was on my phone and my phone sucks so I was hoping a quick answer would help for the time and someone else would elaborate.  :D
  • AntoniusAntonius Member Posts: 4,805 @@ - Legendary Achaean
    Ahmet said:
    Dalran said:
    Azjopas said:
    @Antonius wow I actually didn't know that. I haven't been using Mudlet for very long and for the longest time I was using Zmud, which kept track of variables from each session.

    Can I ask a follow up question? I made an alias "ds" (short for DSL) which works great, but whenever the letters "ds" appear together in a line I send, it replaces the whole line with my ds alias. For example, typing HONOURS DEEDS AZJOPAS just sends the command "ds" and tries to bash. Is there a way to set it so the "ds" alias only activates when that is the only thing on the line?
    ^ds$
    To elaborate a little bit, use the pattern ^ds$ instead of just ds. The characters ^ and $ denote the start and end of the regex match for your alias, so when those are not present, the regex "ds" matches on the "ds" in deeds.

    ^ and $ denote the start and end, respectively, of the string (or line, in the case of a perl regex type trigger pattern), which I assume is what you mean by "regex match", but that terminology is incorrect. The pattern ^ds$ matches: start of string, the character d, the character s, end of string. Or, in other words, it matches only the specific string "ds", and won't match anything with anything before or after ds.

Sign In to Comment.