Aaaaargh!
Posted: Thu Jan 07, 2010 12:05 am
Right, just discovered Mudlet this week and its awesome. Thank you people/person who did make it.
But I really suck at programming and I can't get me head round something. I'm trying to create an alias thing to allow my character to spit or blowpipe a poison based on typing 1something. The something would be a pre-defined variable. The spit or blowpipe would happen based on whether the character was in or out of the forest - based on another variable called inforest.
So typing 1w would - spit wyg at target or blowpipe wyg target. There is a list of approx 40 poisons that would have to be pre-defined as variables.
So far I have the following but it doesn't work:
Alias name: Target1
Pattern: ^tt(\s(\w+))
Script:
target=(matches[3])
send("tt " .. target)
Alias name: Pipe/Spit
Pattern: ^1(\w+)
Script:
w=wyg
if inforest==1 then
send("blowpipe " .. matches[2] .. " " .. target)
else
send("spit " .. matches[2] .. " at " .. target)
end
A trigger sets whether inforest or not. This part and the target part seems to works ok.
Not sure how to get the pattern match to translate to the variable value. The output seems to just be spit w at target or blowpipe w target
But I really suck at programming and I can't get me head round something. I'm trying to create an alias thing to allow my character to spit or blowpipe a poison based on typing 1something. The something would be a pre-defined variable. The spit or blowpipe would happen based on whether the character was in or out of the forest - based on another variable called inforest.
So typing 1w would - spit wyg at target or blowpipe wyg target. There is a list of approx 40 poisons that would have to be pre-defined as variables.
So far I have the following but it doesn't work:
Alias name: Target1
Pattern: ^tt(\s(\w+))
Script:
target=(matches[3])
send("tt " .. target)
Alias name: Pipe/Spit
Pattern: ^1(\w+)
Script:
w=wyg
if inforest==1 then
send("blowpipe " .. matches[2] .. " " .. target)
else
send("spit " .. matches[2] .. " at " .. target)
end
A trigger sets whether inforest or not. This part and the target part seems to works ok.
Not sure how to get the pattern match to translate to the variable value. The output seems to just be spit w at target or blowpipe w target