Mudlet Questions

by Rika

Back to Mechanic's Corner.

Zalandrus2011-07-24 21:49:53
QUOTE (Lilia @ Jul 22 2011, 01:08 AM) <{POST_SNAPBACK}>
expandAlias("bash"), though that's not recommended. You should make a function that does what 'bash' does, and then any alias you need call that function.

That keybinding is inactive when you first install m&m. Double click it so there's a check mark in the box.


Time to delve into functions then. For reference, the expandAlias function also solved my keybinding problem (although the default macro for bashing that comes with m&m still isn't working for me for some reason). Thanks!
Calixa2011-07-30 15:57:37
I've created a script called test. I added gmcp.Char.Items.List to the event box, hit the + sign so it gets added. Script is one line: echo("test"). And for some reason this is the return error:

QUOTE
object: function:
<>


The bizarre thing is that if I use Demonic's GMCP events, those work fine. But for some reason adding something to the event box myself doesn't. Mind = blown really. Help? sad.gif
Unknown2011-07-30 16:09:52
QUOTE (Calixa @ Jul 30 2011, 11:57 AM) <{POST_SNAPBACK}>
I've created a script called test. I added gmcp.Char.Items.List to the event box, hit the + sign so it gets added. Script is one line: echo("test"). And for some reason this is the return error:



The bizarre thing is that if I use Demonic's GMCP events, those work fine. But for some reason adding something to the event box myself doesn't. Mind = blown really. Help? sad.gif



The script needs to be

CODE
function test()
  echo("test")
end


The script which is tied to the event calls a function of the same name when it is triggered. In this case, it will call test() . So you have to define that function.


ETA: It is for this reason it is recommended you not call it something like "Vitals" or what not, as part of the point is that you can have multiple scripts/packages which tie into the same event all calling different functions. If two people both use Vitals, whichever is lower in the script list is the one that will get called after loading the profile. So name it something like demonnicVitals , something you can feel pretty safe nobody else is going to be using.
Calixa2011-07-30 16:18:33
Oh wow, I'd have never thought of that. Now it works!
Siam2011-07-30 22:37:02
Hi!

I wanted to trigger this:

You see the following people here:
Ankastra, Adrien, Regnilolo, Siam

Granted, it may be 1 or 10 or 10000 people there, and what I'd like to do is that if someone there is from a list/table thing I have, I'd look to poke everyone one of them. Can someone help me do this, please? Thanks!
Unknown2011-07-31 00:11:45
QUOTE (thisismydisplayname @ Jul 30 2011, 07:37 PM) <{POST_SNAPBACK}>
Hi!

I wanted to trigger this:

You see the following people here:
Ankastra, Adrien, Regnilolo, Siam

Granted, it may be 1 or 10 or 10000 people there, and what I'd like to do is that if someone there is from a list/table thing I have, I'd look to poke everyone one of them. Can someone help me do this, please? Thanks!


...I'm not helping based on what you want to do with this.
Unknown2011-07-31 07:10:50
The "easiest" way would be to simply alias WHO HERE that enables a trigger: enableTrigger("Who Capture") - This trigger simply matches on (\\w+)

To reference your pre-defined table, use:

CODE
for _, v in pairs(pokeList) do
if matches == v then
   send("poke " .. v)
end
end


You will want to use disableTrigger() in order to turn that extremely greedy trigger off. I suggest doing this on your prompt trigger:

Disclaimer: I am seriously hoping this is not for poking people and you just wanted to know how to do this, heh. wink.gif
Ytran2011-07-31 07:16:51
QUOTE (Draylor @ Jul 31 2011, 02:10 AM) <{POST_SNAPBACK}>
The "easiest" way would be to simply alias WHO HERE that enables a trigger: enableTrigger("Who Capture") - This trigger simply matches on (\\w+)

To reference your pre-defined table, use:

CODE
for _, v in pairs(pokeList) do
if matches == v then
   send("poke " .. v)
end
end


You will want to use disableTrigger() in order to turn that extremely greedy trigger off. I suggest doing this on your prompt trigger:

Disclaimer: I am seriously hoping this is not for poking people and you just wanted to know how to do this, heh. wink.gif

This will work if there is exactly one person in the room, or the person you want is listed first on WHO HERE, since I'm pretty sure a given trigger only fires once per line.
Unknown2011-07-31 07:50:24
Not completely sure what you were trying to get across with that sentence. It was somewhat fragmented. Although...

QUOTE
since I'm pretty sure a given trigger only fires once per line.


This is why we have a "match all" option. wink.gif

That said, if you wanted to get really fancy with it:

CODE
(^|, )(*)(?=$|,)

Is one way to do this.

For something a little saner:

CODE
\\G(*)(?:,|$)
Janalon2011-08-02 19:36:58
Recently updated Mudlet from 2.0 rc1 Mac to 2.0 rc7 Mac. Notices enhancements to overall performance.

In the update, I now see there are now shortcuts assigned to the Apple (or command) key + letter. This also happens to be where I assign all of my hot keys. Mac already took away my function keys to laptop related business, and I can't stand to also lose my Apple+ keybinding combos.

Does anyone know a way to disable Mudlet menu shortcuts? If not... Vadi, can you pass on word this is an option that needs to have a settings based toggle.
Lilia2011-08-02 22:23:13
I wouldn't mind a way to disable reserved keybindings either, though for a slightly different reason. I'm on a mac as well, so I use ctl and alt for mine, but it won't let me use certain combinations used by Windows like clt+c
Lilia2011-08-03 09:09:12
Is there a way to count how many characters are in a string?
Neos2011-08-03 09:50:52
QUOTE (Lilia @ Aug 3 2011, 05:09 AM) <{POST_SNAPBACK}>
Is there a way to count how many characters are in a string?

The best I can think of is string.len(), but you'll have to account for spaces yourself.
Lilia2011-08-03 10:26:49
QUOTE (AquaNeos @ Aug 3 2011, 04:50 AM) <{POST_SNAPBACK}>
The best I can think of is string.len(), but you'll have to account for spaces yourself.

No, it's counting spaces. This exactly what I needed, thank you!
Unknown2011-08-03 12:04:42
A space is a character just like any other. Check out what ASCII codes are. They will help explain it.
Jalain2011-08-03 15:38:09
I'm trying to make it so "morrible211973" in Info Here sets off
CODE
deleteLine()
setFgColor(205,0,0)
echoLink("\\n Morrible", ], "Feed morrible", true)

But to make it so it takes the number in the name and puts it in the give wad part, so I don't need to create a seperate trigger for every different one.
I tried "morrible(\\d+)" (which I took from the news summery replacement), but I can't get it to trigger.
Lilia2011-08-03 16:26:12
I don't know how echoLink works, but ^"morrible(\\d+)" should work. That's what I use for polyhedrons on Continuum. I just trigger it to send("give crystal to " ..matches) on its own, I don't worry about an intermediary step. I occasionally try to give a crystal to the Institute champion pet, but that's rare enough that it doesn't bother me.
Jalain2011-08-04 13:23:34
I worked it out through trial and error..
CODE
deleteLine()
feed = matches
setFgColor(205,0,0)
echoLink("\\n Morrible", ], "Feed morrible", true)


Oh, and echoLink is what you use so "Morrible" appears on the screen and it only sends the command if you click on it. Very useful, far as I'm concerned.
Jalain2011-08-04 14:32:08
Hmm. I just noticed that if there were two different mobs of the same type ("morrible136724" "morrible211998"), then both of the 'links' both have the same number when clicked. Anyone know how to fix that?
Unknown2011-08-04 17:25:45
CODE
echoLink("\\n Morrible", ] .. feed..], "Feed morrible", true)

Might be what you are after, I suspect.