Targetting help

Share your scripts and packages with other Mudlet users.
Duugan
Posts: 25
Joined: Fri Aug 26, 2016 4:00 am

Targetting help

Post by Duugan »

I've recently started playing Realms of Despair with my wife. She's played it for years but doesn't know all the technical stuff. I was hoping someone here could help with that aspect.

I was wanting to set up a trigger or alias that would help with fights. I've done some simple stuff like mapping movement keys or setting up things for eating/drinking.

I know there is a way, but I'm not sure how to set it up. What I'm looking for is along the lines of she says 'heal' and my guy casts a heal on her. Another option would be to have a trigger for healing when she gets low or gets hit.

She has a lot of characters though, so ideally there is a way to set target = whoever is talking or getting hit, etc. Any help world be greatly appreciated. Thanks in advance!

Duugan
Posts: 25
Joined: Fri Aug 26, 2016 4:00 am

Re: Targetting help

Post by Duugan »

I tried making a trigger for this. If I put the condition as (%w) tells you 'heal me' and then put cast 'heal' %1 in the box for send plain text it didn't show any errors. When I tested it, it didn't result in anything being cast though. I tried putting it in the code box instead, but kept getting errors. Anyone know what the syntax would be for that? Do I instead need to make something similar in the script section? If so, what would that entail?

chrio
Posts: 73
Joined: Mon Aug 22, 2016 11:34 am

Re: Targetting help

Post by chrio »

To do what you described I would add a perl regex trigger, like this:
^(\w+) tells you: heal me$
and the action would be something like:
send("cast heal on " .. matches[2])

tiny intro to perl regex:
  • ^ notes beginning of a line, so no one can abuse the trigger by saying ABC tells you: heal me
    $ is end of the line.
    \w is a single word char
    + means 1 or more of the character before.
    and matches[2] is the first capture group (stuff inside parenthesis).
the two dots concatenates strings and variables. I hope that's enough to get you started.

Duugan
Posts: 25
Joined: Fri Aug 26, 2016 4:00 am

Re: Targetting help

Post by Duugan »

Thanks Chrio. I will try that tomorrow.
I had something similar, but I didn't make it a perl regex, and I used (%1) instead of ..matches [2]

I'll update after I try it out. Thanks again!

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Targetting help

Post by SlySven »

Also the 'send("cast heal on " .. matches[2])' should go in the "script" area underneath where you enter all the triggering details (so it gets run by the lua sub-system) rather than in the "send plain text" line entry place in the top right corner - as that would just send the literal contents straight to the MUD server when it is triggered - which is not appropriate for this usage... :geek:

Duugan
Posts: 25
Joined: Fri Aug 26, 2016 4:00 am

Re: Targetting help

Post by Duugan »

Thanks Sven! I wasn't sure if there was a difference or not. If I'm understanding this right, the trigger always goes on the top (and you change the menu for lua vs regex vs perl etc) and the action to be taken goes in the bottom unless it's something basic (like eat meat bag or kill rat as opposed to actual coding).....yes?

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Targetting help

Post by SlySven »

By golly, the chap has got it! :razz:

Duugan
Posts: 25
Joined: Fri Aug 26, 2016 4:00 am

Re: Targetting help

Post by Duugan »

Awesome! Now that I understand the basics, I'll have to read up on the differences on when to use what type. Learning is fun! :D

chrio
Posts: 73
Joined: Mon Aug 22, 2016 11:34 am

Re: Targetting help

Post by chrio »

Duugan wrote:Awesome! Now that I understand the basics, I'll have to read up on the differences on when to use what type. Learning is fun! :D
Yeah, it sure is! I hope it works out for you. :)

I have just started scratching on the surface of what mudlet is capable of and is currently working on a mapping script for my mud. Making everything work the way I want is a mini-game in itself, and very rewarding. :)

Duugan
Posts: 25
Joined: Fri Aug 26, 2016 4:00 am

Re: Targetting help

Post by Duugan »

Ok, so this is working great but I have a new question. How would I go about "fizzles"? I can put all the phrases (twitch in your eye, lose concentration, etc) in a new trigger but I'm not sure where to go from there.

I imagine I'd either have to figure out how to send previous command, or find a way to save my last spell as a variable and my current target as another variable and send ("cast ".. var1.. var2). Obviously the simpler solution would be resending if that's possible.

Post Reply