InStr question

Posted by Solaras on Sat 18 Jun 2005 08:04 PM — 3 posts, 22,460 views.

#0
In VBscript I can do this fairly easy, but I can't figure out the conversion to do it in PerlScript.

Quote:

<triggers>
<trigger
enabled="y"
expand_variables="y"
group="Cure"
match="^(.*?)h\, (.*?)m\, (.*?)e\, (.*?)p\, (.*?)en\, (.*?)w (.*?)\-$"
name="prompt"
regexp="y"
send_to="12"
sequence="100"
>
<send>if instr("%7", "@") then
world.setvariable "dreamweaving", "1"
else
world.setvariable "dreamweaving", "0"
end if
if instr("%7", "p") then
world.setvariable "prone", "1"
else
world.setvariable "prone", "0"
end if
if instr("%7", "b") then
world.setvariable "blind", "1"
else
world.setvariable "blind", "0"
end if
if instr("%7", "d") then
world.setvariable "deaf", "1"
else
world.setvariable "deaf", "0"
end if
if instr("%7", "k") then
world.setvariable "kafe_defense", "1"
else
world.setvariable "kafe_defense", "0"
end if
if instr("%7", "r") then
world.setvariable "right_arm_balance", "1"
else
world.setvariable "right_arm_balance", "0"
end if</send>
</trigger>


I can't figure out how to do the InStr in perl though, so any help would be appreciated.
USA #1
Try the 'index' function.

http://perldoc.perl.org/functions/index.html
USA #2
Or use a regular expression.