Modify Zmud alias to work in Mudlet

User avatar
demonnic
Posts: 886
Joined: Sat Dec 05, 2009 3:19 pm

Re: Modify Zmud alias to work in Mudlet

Post by demonnic »

Sivan wrote:
naftali wrote:you should use '^rooms (\d+)$' otherwise the alias won't pay attention to any other number you try to use.

edit: to clarify - if you just use '^rooms$' then the only thing that will set off the alias is when you type 'rooms' - nothing before and nothing after.

if you used '^rooms' it would set off the alias but ignore everything typed after it.

you need to use what I said above so that Mudlet knows to take the number you type after rooms and store it as matches[2]

Probably still incomprehensible, but I'm too tired to do a better job of translating from tech-speak.
That makes sense. And it is now attempting to run it when I specify the vnum, but I get an error every time it tries to do the command now.

Lua error:[string "send("at " .. i + vnumin.. " look")"]:1: attempt to perform
arithmetic on global 'i' (a nil value)Lua error:[string "send("at " .. i + vnumin.. " look")"]:1:
attempt to perform arithmetic on global 'i' (a nil value)

I see what's happening. it's not expanding out the value of i until it runs the timer's script... by that point, the local value i is long gone. I think the following code will do it.
Code: [show] | [select all] lua
vnumin = matches[2]
vnumtable = {vnumin}
for i = 1,100 do
table.insert(vnumtable, vnumin + i )
tempTimer(i, [[send("at " .. table.remove(vnumtable) .. " look")]])
end


Sivan
Posts: 49
Joined: Tue Jun 23, 2009 3:54 am

Re: Modify Zmud alias to work in Mudlet

Post by Sivan »

When I try this now I get the below Lue debug error when I try and save it.

Lua error:[string "function Alias4()..."]:8: 'end' expected (to close 'function' at line 1) near '<eof>'

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

Re: Modify Zmud alias to work in Mudlet

Post by Vadi »

Code: [show] | [select all] lua
vnumin = matches[2]

for i = 1,100 do
tempTimer(i, [[send("at ]] .. i + vnumin.. [[ look")]])
end
w/ ^rooms (\d+)$ pattern.

Sivan
Posts: 49
Joined: Tue Jun 23, 2009 3:54 am

Re: Modify Zmud alias to work in Mudlet

Post by Sivan »

Thanks Vadi, it works now.

Thanks also goes to demonnic who also helped me with this.

:)

Post Reply