Mudlet Questions

by Rika

Back to Mechanic's Corner.

Rika2010-10-06 08:57:49
I thought we should have a thread like Mushclient questions except for Mudlet, especially with a growing number of users. I'll start us off. happy.gif

I'm currently trying to make an alias, song1, that will play my song, but can also take one of six words after it, but does not have to. If it does, I want it to do one thing, if it doesn't, I want it to do anything. Here's what I currently have.

Pattern:
^song1 *(?:bind|summon|chill|harrow|freeze|recall)?$

Script:
if matches == nil then
send("perform song song1 " .. target)
else
send("perform song song1 " .. target " " .. matches)
end

Just doing song1 works, but when I do something like song1 bind, it still only does perform song song1 target, without the bind at the end. I think my regex is wrong, but I have had no luck trying to fix it. Help please!
Unknown2010-10-06 10:57:40
Remove the ?: in your wildcard, as that makes it a non-capturing wildcard.
Lilia2010-10-06 17:57:46
You don't really need that list either. I would do: ^song1\\s*(\\w*)$ That way you have song1 then maybe a space, and maybe a word, and that word would be matches. You're also missing some dots. It should be: send("perform song song1 " .. target .. " " .. matches)
Vadi2010-10-06 18:44:43
Good start!

I'd reconsider having to type 'song1 recall' each time... that's way too much typing to do in combat. 's1 rc' is what I'd personally shorten to (and even that's not perfect).
Rika2010-10-06 20:19:23
Thanks everyone!

This is the final product:
^song1\\s?(bind|recall|chill|harrow|freeze|recall)?$

I'm still relatively new to wildarrane, so I'm making myself type the various cairnlargo abilities out in full. I have shortened my song1 to s1 like you suggested, though. Eventually, I'll probably use numbers, depending on how many spirits the ability takes. For now though, words makes more sense.
Calixa2010-10-07 08:46:41
I got the idea to use buttons as a sort of "training wheels" to memorize just what skills you got and what they do, and use them when clicking the button of course (like a skill toolbar in a graphical mmo). I've managed to get a bar with buttons on it, one of each skill name, and I see you can use CSS to decorate them.

Now the question is: If I want to assign a background image to the button, where would I need to put this image?

I know the css for this would be background-image:url('gradient2.png'); but where on disk do I put gradient2.png?

Hope that makes some sense. If not possible I guess I'll just assign colors or something sad.gif
Thendis2010-10-07 14:32:01
QUOTE (Calixa @ Oct 7 2010, 03:46 AM) <{POST_SNAPBACK}>
I got the idea to use buttons as a sort of "training wheels" to memorize just what skills you got and what they do, and use them when clicking the button of course (like a skill toolbar in a graphical mmo). I've managed to get a bar with buttons on it, one of each skill name, and I see you can use CSS to decorate them.


I got that idea too! Though you are obviously much further along than I.
Vadi2010-10-07 20:27:42
If you use a relative path, then I'm guessing where the mudlet binary itself is... so I use absolutely paths instead, like so:

background-image: url("/home/vadi/Games/Mudlet/Offensive/Artwork/dialog-ok.png");

On windows you'd do:

background-image: url("C:\\Blah\\blah.png"); and or whatever.

edit: oh and http://doc.qt.nokia.com/4.6/stylesheet-reference.html is real helpful for all the fiddling options. Does take a bit of time to learn what you want though.
Calixa2010-10-07 23:27:11
CODE
background-image: url("C:\\Users\\Nina\\AppData\\Local\\Mudlet\\hellokitty.gif");


Added that to the css field but no luck. Have tried with ' and without quotes, and with QPushButton { } around it, but still nothing. Also tried it with relative paths, but no change.

The mudlet manual isn't helping either, there's just one screenshot, of course only with things like background color that do work. Not to mention I see all kinds of different options on that screenshot wondering just which release that is. I have the 1.2.0 pre 6 and had 1.1.0 before and both didn't have that many options like an icon path file.
Neos2010-10-07 23:33:04
QUOTE (Calixa @ Oct 7 2010, 07:27 PM) <{POST_SNAPBACK}>
CODE
background-image: url("C:\\Users\\Nina\\AppData\\Local\\Mudlet\\hellokitty.gif");


Added that to the css field but no luck. Have tried with ' and without quotes, and with QPushButton { } around it, but still nothing. Also tried it with relative paths, but no change.

The mudlet manual isn't helping either, there's just one screenshot, of course only with things like background color that do work. Not to mention I see all kinds of different options on that screenshot wondering just which release that is. I have the 1.2.0 pre 6 and had 1.1.0 before and both didn't have that many options like an icon path file.


If you can find the Lusternia GUI script, you could use that as an example on how to do it. dunno.gif
Calixa2010-10-08 01:37:55
That uses scripted elements. Which at a first glance are all labels. I have a hunch you can script buttons and bars and could probably solve it that way, but having an actual set of buttons through the button interface would be nicer. Not a bad idea though, will consider it if all else fails.
Vadi2010-10-08 02:23:15
I don't think gifs work on Windows actually. Patent issues and whatnot. re-save it as .png

edit: better answer, on a non-commercial version of qt gif support is disabled due to patent issues on windows. so, just convert it to png and it'll go.
Xiel2010-10-08 03:57:07
Is there some randomizer command thing in Mudlet that would enable me to say, do an alias and have that alias make me randomly hop, skip or jump?
Vadi2010-10-08 04:10:48
QUOTE
local commands = {"hi", "wave", "bye"}

send(commands)


explanation - commands is an indexed table. commands is "hi", commands is "wave", commands is "bye". we want to get a random thing out of it though. math.random(number) will return is a random integer between 1 and number. So... math.random(3) will give us either 1, 2 or 3 randomly, which we can plug into commands to access a random command. #commands gets us the amount of items in our table though, so instead of hard-coding 3 and changing the number each time, lua fills in the proper amount for us.
Thendis2010-10-08 04:25:35
QUOTE (Vadi @ Oct 7 2010, 11:10 PM) <{POST_SNAPBACK}>
explanation - commands is an indexed table. commands is "hi", commands is "wave", commands is "bye". we want to get a random thing out of it though. math.random(number) will return is a random integer between 1 and number. So... math.random(3) will give us either 1, 2 or 3 randomly, which we can plug into commands to access a random command. #commands gets us the amount of items in our table though, so instead of hard-coding 3 and changing the number each time, lua fills in the proper amount for us.


You sir, have won my Highfavour. wub.gif
Xiel2010-10-08 04:28:48
Whee, it works AND I understand it. dazed.gif
Unknown2010-10-08 04:57:24
QUOTE (Xiel @ Oct 8 2010, 12:28 AM) <{POST_SNAPBACK}>
Whee, it works AND I understand it. dazed.gif


Lua is pretty wonderful that way. And the API function names make sense to me. MUSHs I found to be slightly more confusing. tempTimer() just sticks better than DoAfter() for me.

:shrug:

Calixa2010-10-08 17:13:47
QUOTE (Vadi @ Oct 8 2010, 04:23 AM) <{POST_SNAPBACK}>
I don't think gifs work on Windows actually. Patent issues and whatnot. re-save it as .png

edit: better answer, on a non-commercial version of qt gif support is disabled due to patent issues on windows. so, just convert it to png and it'll go.


Yay, that did it, would have never thought of it myself smile.gif

Correct syntax ended up being: QPushButton{ background-image: url(hellokitty.png); }. The image is sitting in the Mudlet root folder.
Janalon2010-10-08 19:52:09
How do I gag lines? Can this be easily accomplished through the Trigger editor?
Lilia2010-10-08 19:59:19
QUOTE (Janalon @ Oct 8 2010, 02:52 PM) <{POST_SNAPBACK}>
How do I gag lines? Can this be easily accomplished through the Trigger editor?


deleteLine()

Just put that in the script, and you only need one trigger for spam, just add all the lines you want deleted as different patterns.