Super basic mudlet stuff

So, I have no scripting/coding know-how at all. 
I'd like to start slowly building up my knowledge base into a functional approach to hunting and eventually pvp. 

Right now, I'm trying to figure out how to do this:
I would like to be able to do something like: t guard    to target "guard"
                                                                     k               to then "kill guard"

I figure eventually I'll know how to do neat stuff having to do with equilibrium and corpse gathering, but this is where I want to start.

«1

Comments

  • Mudlet actually answers this in their guide on the wiki:
    http://wiki.mudlet.org/w/Manual:Introduction#Making_a_Targetting_Alias

  • Amranu said:
    Mudlet actually answers this in their guide on the wiki:
    http://wiki.mudlet.org/w/Manual:Introduction#Making_a_Targetting_Alias

    You are an excellent person.
  • For the record, the Mudlet manual is actually SUPER helpful, so long as you know what you're looking for.
    Omor Ceberek - Targossas

    got gud
  • So, this is easily done in an ALIAS with a single variable  for each one.

    Make a new ALIAS:
    Name: Whatever you want.  I called mine TARGET
    Pattern:  ^t (\w+)
    Then in the large box:  target = matches[2]
    (  This sets the variable named "target" to whatever follows the t )

    You can make another ALIAS for k that does what you want...
    ALIAS - PATTERN:  ^k$
    Big box:  send("kill "..target)

    Be sure to leave a space after "kill".  And when you call a variable in this manner (in this case, your "target" variable) you do so by using the ..<variable name>.  You close the quotes before the variable so it won't just output kill ..target to your screen.

  • If you want to make it so when you hit, say, the F1 key, it will KILL your target, go into KEYS.

    You can do it a couple ways.  Make a new KEY
     Name it whatever you want
     Key Binding:  Click "Grab New Key" and hit F1
     in the large box you can just put the send("kill "..target)

    OR if you made the alias already for kill..  you change the last step to : 
             expandAlias("k")

  • Don't use expand alias. If you're going to do that you may as well make a function and send that instead.

    Too cost intensive down the line when you need to worry about process speed etc





    Penwize has cowardly forfeited the challenge to mortal combat issued by Atalkez.
  • I was looking at a lua guide trying to figure this stuff out. 
    Looking in the wrong place is super unhelpful.
  • to do keybinding, does it have to be a file key?
  • @Eidra Can be any key you want, as far as I know. Also includes CTRL+(key), and the like. 
    Omor Ceberek - Targossas

    got gud
  • edited October 2016
    Just make sure not to use key combinations that are already used by windows/mudlet.
    Ctrl+C, for instance.

  • What version do you guys use, 2.1 or 3.0 ?
  • edited October 2016
    Atalkez said:
    Don't use expand alias. If you're going to do that you may as well make a function and send that instead.

    Too cost intensive down the line when you need to worry about process speed etc

    Just trying to keep it simple for them in the beginning...   

    Chances are if all they are doing is bashing to start, they don't need to have 1337 processing, ya know?

  • Atalkez said:
    Don't use expand alias. If you're going to do that you may as well make a function and send that instead.

    Too cost intensive down the line when you need to worry about process speed etc

    Key point being when. Unless you're trying to run Mudlet on a literal potato, I can't see anybody ever getting to the point where they need to worry about process speed; it's a definite case of premature optimisation. If you're suffering noticeable performance loss due to using expandAlias you'd also notice that same poor performance any time you enter anything in Mudlet's command line and hit enter.

    That said, my general rule (that I often don't follow when quickly hacking things together) is that if you're repeating code in more than one place, it should be a function. Use of expandAlias is a pretty good indicator that it's being used in more than one place (even if you're not actually duplicating the code) and therefore should probably be a function.
  • I've always looked at it like practising bad habits. If there's a right/better/efficient way to do it, you should do it that way from the start, before you get into a habit of doing it the wrong/inefficient way. 
  • What Viho said.

    I'm still finding code from years ago that makes me twitch to read it.




    Penwize has cowardly forfeited the challenge to mortal combat issued by Atalkez.
  • edited October 2016
    I want to use functions but they still don't make a lot of sense to me.  By that I mean, hrm.  Sort of like the events manager thing doesn't make sense to me.  Both of them need something that I have heard described as a "hook", but I don't truly understand the ins and outs of what makes a valid hook (I know you can use mudlet's pre-defined "events", but I still get sort of lost in the weeds on it).  There is some sort of weird circular dependency that I get stuck in a literal loop on.

    Basically, with both of these things, and actually also with a lot of gmcp stuff (which is related to the event stuff) you can't "get the thing" or "do the thing with the function" until you somehow "call" the function.  

    Other than that, I understand a function as being almost like an alias... or really, just about ANYTHING.  It is like some kind of "script" that you can plug in multiple places without rewriting it over and over (which yes, I get it, it's silly, and I actually am well past the point where it's genuinely cumbersome).  But I just do not understand how to "talk" to the function to say "come HERE and do those things I have in you", and all of the tutorials I have ever watched or read just don't make sense (which is why the above is almost certainly a bit word salad-y).  

    I feel like if I could get functions, I could finally consider tackling tables sometime after that.  Maybe.
  • ZahanZahan Valhalla
    Kiskan said:
    I want to use functions but they still don't make a lot of sense to me.  By that I mean, hrm.  Sort of like the events manager thing doesn't make sense to me.  Both of them need something that I have heard described as a "hook", but I don't truly understand the ins and outs of what makes a valid hook (I know you can use mudlet's pre-defined "events", but I still get sort of lost in the weeds on it).  There is some sort of weird circular dependency that I get stuck in a literal loop on.

    Basically, with both of these things, and actually also with a lot of gmcp stuff (which is related to the event stuff) you can't "get the thing" or "do the thing with the function" until you somehow "call" the function.  

    Other than that, I understand a function as being almost like an alias... or really, just about ANYTHING.  It is like some kind of "script" that you can plug in multiple places without rewriting it over and over (which yes, I get it, it's silly, and I actually am well past the point where it's genuinely cumbersome).  But I just do not understand how to "talk" to the function to say "come HERE and do those things I have in you", and all of the tutorials I have ever watched or read just don't make sense (which is why the above is almost certainly a bit word salad-y).  

    I feel like if I could get functions, I could finally consider tackling tables sometime after that.  Maybe.

    You're there.  I first viewed functions as aliases that were hard-coded into the system.  You could actually put your code into an alias, and then call that alias on a couple different triggers to produce an effect like having a function.  But functions are better - like super aliases.

    Just like any alias, the function has to be defined.  For that, you'll need a new script file.  Then just define your new function inside the script item like so:


    clock = {}; -- create an empty table when the script loads

    function ClockSetTime (set_hour, set_minute, is_exact)
      local hour = tonumber(set_hour);
      local minute = tonumber(set_minute);
      if is_exact == 'yes' then
        clock.hour = hour;
        clock.minute = minute;
      else -- if not exact
        if not clock.hour then -- only set if not already set
          clock.hour = hour;
          clock.minute = minute;
        end
      end
    end



    That alone will do nothing.  It shines when we put it in a couple triggers though:

    trigger 1 - string to match:
    The glassy obsidian of Achaea's innermost ring gleams with a dark lustre in the swiftly advancing daylight.

    trigger 1 - in the box:
    ClockSetTime("8", "48", "yes")



    trigger 2 - string to match:
    The shadows have lengthened. It is late afternoon in Achaea.

    trigger 2 - in the box:
    ClockSetTime("15", "12", "no")



    If you wanted to flesh out that clock, you'd get the couple dozen other time patterns from the game and tie them to the corresponding numbers (you can find by timing out an achaea day, grabbing those patterns, and checking TIME for the related patterns there).  Then you could add a timer that fires every 2.5 seconds (an achaean minute) and adjusts the clock table's variables.  Now stick those tabled variables, clock.hour and clock.minute, in a miniwindow somewhere and you have an in-game wristwatch.


    I don't mess with event handlers in mudlet (i use mushclient) so I can't offer as much help there, but it helps to think of event handlers as pre-defined triggers, of sorts.  For example, you create a trigger for "You bleed 100 health."  Think of that now as an event, that fires on bleeding 100 health.  

    When achaea sends you gmcp info, for example your vitals, there is an "event" for it that will execute (like a trigger) the functions that are tied to it.  Events are nice because they can be triggered by something you don't see (like receiving gmcp info).


    Hopefully that helped a little.
    Click here for Nexus packages
    Currently available: Abs, Cnote, Keepalive, Lootpet, Mapmod
  • I'm using 3.0

  • God, that makes actual sense.  Thanks.
  • edited October 2016
    Events are nice because it provides a sort of hotplug into a script.

    When you create an event you're essentially creating a code trigger that tells the code looking for that particular event to fire, so you can effectively modify a script without actually changing that script - by having the original script send an event, and creating scripts that use that event to do something.

    An example of where this is useful - say you want to keep a third party script up to date but also have your own additions to the code that you need. Instead of having to rewrite the script every time the original author updates it, if they include events you can write your own script that hooks into the code seamlessly after updates.
  • Okay. How do I set up a thing like the website has that puts things people say to me to one side so I can read them while I'm doing stuff?
  • Eidra said:
    Okay. How do I set up a thing like the website has that puts things people say to me to one side so I can read them while I'm doing stuff?
    http://wiki.mudlet.org/w/TabbedChat


    http://forums.achaea.com/discussion/1264/mudlet-caputring-tells-to-a-separate-window

  • Caelan said:
    Eidra said:
    Okay. How do I set up a thing like the website has that puts things people say to me to one side so I can read them while I'm doing stuff?
    http://wiki.mudlet.org/w/TabbedChat


    http://forums.achaea.com/discussion/1264/mudlet-caputring-tells-to-a-separate-window
    I...don't know what to do with these things.
  • I tried to use the code provided, but I must be doing something wrong because no window is coming up
  • Options > Package Manager > install.  Then you've just got to find the file on your comp and open it.   If you're using the Tabbed Chat package, there should be a few things you'll need to do before it's fully functional but the second link (or someone here) can help with that.  
  • edited October 2016
    "I am trying to trigger a "say something on the channel" of a 
    specific line from that channel, which includes a variable name. I want the trigger to pick up on the statement, and sent to the channel a specific response which includes that name. I think I have everything right. It was able to "activate" but it's not working and it is making me sad.

    Such as 

    (Clan): Please welcome Smith to the Clan!

    I would like to say:

    (Clan): Welcome, Smith!

    This is what I have that is not working:

    ^\(Clan\): John says, "Please welcome (\w+)


    send("clt Welcome, " ..matches[2].."! Enjoy!")

    --- It will "activate" but is not working.

    I used to have a bunch of these in ZMud, but can't figure out how to do it in Mudlet.

    - To love another person is to see the face of G/d
    - Let me get my hat and my knife
    - It's your apple, take a bite
    - Don't dream it ... be it


  • Do you have the trigger set the Perl Regex?

    You might be missing a few of the '\'.

    Try this: \(Clan\)\: John says\, \"Please welcome (\w+)

    send("clt Welcome, " ..matches[2].."! Enjoy!")
  • Make sure you change the drop down menu on the right to regen.

    Side note, you usually don't want to do this because you will get newbies like "Turdswallower" that you'd probably rather not greet.

    Or someone illusioning other stuff. 

  • Thank you @Jinara and @Cooper

    You're right. Do NOT want to greet the Turdswallower!

    But it does frustrate me when I can't figure something out.

    Can't make sounds work at all - and that was another zMud favorite.

    I would send a Grove Gate on certain triggers, and my computer play would "Carry on my Wayward son" and I'd come running if I was slightly afk.

    Although could also auto rezz a dropped body.

    That did get me in trouble once.

    :)

    - To love another person is to see the face of G/d
    - Let me get my hat and my knife
    - It's your apple, take a bite
    - Don't dream it ... be it


  • KresslackKresslack Florida, United States
    I used to have sound set up for certain things, before I lost all of my stuff, But they do work with Mudlet. I'll give it a try tonight.


Sign In or Register to comment.