Expand Variable inside of Temp Trigger

Post Reply
ililili
Posts: 10
Joined: Mon Jan 16, 2012 3:06 pm

Expand Variable inside of Temp Trigger

Post by ililili »

testvar1 = "FIRED"
tempTrigger("MyPattern", [[echo(]]..testvar1..[[)]])

Why doesn't this work? Ideally I'd like to expand a local variable, but even a global variable doesn't work.

Iocun
Posts: 174
Joined: Wed Dec 02, 2009 1:45 am

Re: Expand Variable inside of Temp Trigger

Post by Iocun »

your tempTrigger concatenates the echo and testvar1 to the following string: [[echo(FIRED)]], which it then executes as code. Since in that string FIRED has no quotes around it, Mudlet thinks it is a variable name, but since it isn't, it actually does echo(nil).

What you thus want is:
testvar1 = "FIRED"
tempTrigger("MyPattern", [[echo("]]..testvar1..[[")]])

ililili
Posts: 10
Joined: Mon Jan 16, 2012 3:06 pm

Re: Expand Variable inside of Temp Trigger

Post by ililili »

Thanks IO.

Post Reply