Starter help (alias, variables)

Post Reply
chosig
Posts: 13
Joined: Sun Dec 13, 2009 10:08 am

Starter help (alias, variables)

Post by chosig »

Hey, trying to bend my head around Mudlet, and need some help with a jump start.
I'm not the greatest Lua coder, but I know my way around, but I'd need some help with global variables and usage in aliases.

First example, it's for Aardwolf MUD if that makes a difference:
I usually wield a harp(!) and dual-wield a dirk, but sometimes I use a shield.

I've written this in pseudo code, $foo = a variable, I need the variables to be global as I want to use them in other scripts.

$dualwield = boolean, true if not using a shield
$weaponprimary = harp
$weapondual = dirk
$shield = wreath
alias portal ($destination):
if ($dualwield) {
dual remove
}
get $portal $container
hold $portal
enter
if ($dualwield) {
dual $weapondual
} else {
hold $shield
}
put $portal $container
end
edit: made mud commands bold, for easier reading

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Starter help (alias, variables)

Post by Vadi »

I'll write the answer for you later, but for now try to figure it out after watching the screencasts: http://www.mudlet.org/media/

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Starter help (alias, variables)

Post by Vadi »

Alias pattern:

Code: Select all

^portal (\w+)$
Alias script:

Code: Select all

if duelwield then
send ("dual remove")
end

send ("get " .. portal .. " " .. container)
send ("hold " .. portal)
send ("enter")

if dualwield then
send ("dual " .. weapondual)
else
send ("hold " .. shield)
end
send ("put " .. portal .. " " .. container)

Post Reply