# repeat alias
# repeat alias
Import xml, and you can do #number thing.
For example, #5 hi will send hi five times.
For example, #5 hi will send hi five times.
- Attachments
-
- #-repeat-alias.xml
- (411 Bytes) Downloaded 1862 times
Re: # repeat alias
This is very nice, but what happens if you want to repeat an alias defined in MUDlet. In this case it doesn't work as it sends the alias string to the mud.
Wod
CthulhuMUD
www.cthulhumud.com
A hugely entertaining MUD based on the horror writings of HP Lovecraft.
CthulhuMUD
www.cthulhumud.com
A hugely entertaining MUD based on the horror writings of HP Lovecraft.
Re: # repeat alias
Replace 'send(matches[3])' with 'expandAlias(matches[3])'
Re: # repeat alias
Parfait! Excellent! Thanks!
Wod
CthulhuMUD
www.cthulhumud.com
A hugely entertaining MUD based on the horror writings of HP Lovecraft.
CthulhuMUD
www.cthulhumud.com
A hugely entertaining MUD based on the horror writings of HP Lovecraft.
Re: # repeat alias
Actually that only works with single line aliases. For multi-line aliases it does not work! For example I have a alias
Code: Select all
pp
Code: Select all
send("open pouch")
send("put "..matches[2].." in pouch")
send("close pouch")
Wod
CthulhuMUD
www.cthulhumud.com
A hugely entertaining MUD based on the horror writings of HP Lovecraft.
CthulhuMUD
www.cthulhumud.com
A hugely entertaining MUD based on the horror writings of HP Lovecraft.
Re: # repeat alias
No idea. Check the errors view, might give you a clue.
Re: # repeat alias
There is an error, it says;
Code: Select all
LUA: ERROR running script # repeat alias (Alias23) ERROR:expandAlias: wrong argument type
Wod
CthulhuMUD
www.cthulhumud.com
A hugely entertaining MUD based on the horror writings of HP Lovecraft.
CthulhuMUD
www.cthulhumud.com
A hugely entertaining MUD based on the horror writings of HP Lovecraft.
Re: # repeat alias
Anyone got any idea about how to debug this. I'm generally new to Lua/Mudlet.
Thanks!
U
Thanks!
U
Wod
CthulhuMUD
www.cthulhumud.com
A hugely entertaining MUD based on the horror writings of HP Lovecraft.
CthulhuMUD
www.cthulhumud.com
A hugely entertaining MUD based on the horror writings of HP Lovecraft.
Re: # repeat alias
Well, that error suggest that you are passing something other than a string to the expandAlias function, suggesting that your match is a nil value, in which case I wouldn't expect this to do anything anyway, since there is no command for it to be repeating. But, you could always use this: expandAlias(matches[3] or "")
To really see what is going on though, it would be helpful if you posted your exact regex pattern and code, so we could see any changes you had made that might be innocuous looking but problematic.
To really see what is going on though, it would be helpful if you posted your exact regex pattern and code, so we could see any changes you had made that might be innocuous looking but problematic.
Re: # repeat alias
Hi Jor'Mox. Appreciate the response. The regex is untouched and looks like this;Jor'Mox wrote: ↑Sat Feb 24, 2018 12:16 amWell, that error suggest that you are passing something other than a string to the expandAlias function, suggesting that your match is a nil value, in which case I wouldn't expect this to do anything anyway, since there is no command for it to be repeating. But, you could always use this: expandAlias(matches[3] or "")
To really see what is going on though, it would be helpful if you posted your exact regex pattern and code, so we could see any changes you had made that might be innocuous looking but problematic.
Code: Select all
^#(\d+) (.*)$
Code: Select all
for i = 1, tonumber(matches[2]) do
expandAlias(matches[3])
end
Code: Select all
^pp (.*)$
Code: Select all
send("open pouch")
send("put "..matches[2].." in pouch")
send("close pouch")
Code: Select all
#2 pp alabaster
Code: Select all
LUA OK script Put Item In Pouch (Alias3) ran without errors
LUA: ERROR running script # repeat alias (Alias28) ERROR:expandAlias: wrong argument type
Thanks!
U
Wod
CthulhuMUD
www.cthulhumud.com
A hugely entertaining MUD based on the horror writings of HP Lovecraft.
CthulhuMUD
www.cthulhumud.com
A hugely entertaining MUD based on the horror writings of HP Lovecraft.