Hi!
I wanted to merge your TargetSwitch plugin with the accelerator example but the first one was written in VBScript and the later in Lua
I got so far but now he started complaining:
<script>
<![CDATA[
function OnPluginInstall ()
Accelerator "F1", "backstab @target"
Accelerator "Ctrl+F1", "world.addtrigger "armBackstab", "@target has arrived.|(?<=@target).+ is here.", "backstab @target", eEnabled or eTemporary or eTriggerOneShot, 14, 0, "", ""
-- list them
for _, v in ipairs (AcceleratorList ()) do Note (v) end
end -- function OnPluginInstall
]]>
</script>
He cant find the end of the "Ctrl+F1" line. I tried to surround it with another "" pair but it didnt change anything.
Ok I think I converted it (at least he doesnt complain in the targeting script anymore...) but I still have a problem with the AddTrigger part:
Accelerator ("Ctrl+F1", "AddTrigger ("armBackstab", "(@target has arrived.|(?<=@target).+ is here.)", "backstab @target", eEnabled or eTemporary or eTriggerOneShot, 14, 0, "", "")")
He says:
[string "Plugin"]:24: ')' expected near 'armBackstab'
Error context in script:
20 : Accelerator ("F1", "backstab @target")
21 :
22 :
23 :
24*: Accelerator ("Ctrl+F1", "AddTrigger ("armBackstab", "(@target has arrived.|(?<=@target).+ is here.)", "backstab @target", eEnabled or eTemporary or eTriggerOneShot, 14, 0, "", "")")
25 :
26 :
27 :
28 : -- list them
But I see no reason why a bracket would be missing there
Which language are you using now? You still have a quoted string within a quoted string, you need to use different quotes, or double the quotes, like I said.
If it's Lua now, use single quotes at the start and end, like this:
Accelerator ("Ctrl+F1", 'AddTrigger ("armBackstab", "(@target has arrived.|(?<=@target).+ is here.)", "backstab @target", eEnabled or eTemporary or eTriggerOneShot, 14, 0, "", "")')
The single quotes in the "main" string lets you use double quotes inside the string.
Ah, yes its Lua now and the quotes solved that problem.
Now the part I converted from VBScript to Lua makes problems :/
Guess the bigger problem is that I never did much with script languages and am somewhat confused of all these String concatenation.
There are probably still VBScript parts in there that I missed...
Function/Sub: SetTarget called by alias
Reason: processing alias ""
[string "Plugin"]:2: attempt to call local 'wildcards' (a table value)
stack traceback:
[string "Plugin"]:2: in function <[string "Plugin"]:1>
Error context in script:
1 : function SetTarget (sName, sLine, wildcards)
2*: which = wildcards (1)
3 : to_whom = wildcards (2)
<script>
<![CDATA[
function SetTarget (sName, sLine, wildcards)
which = wildcards (1)
to_whom = wildcards (2)
world.SetVariable ("target" .. which, to_whom)
world.ColourNote ("moccasin", "darkgreen", "Target " .. CStr (which) .. " now '" .. to_whom .. "'")
end
function ChooseTarget (sName, sLine, wildcards)
world.SetVariable ("target", world.GetVariable ("target" .. wildcards (1)))
world.ColourNote ("moccasin", "darkgreen", "Target now '" .. world.GetVariable ("target") .. "'")
end
<script>
<![CDATA[
function SetTarget (sName, sLine, wildcards)
which = wildcards [1]
to_whom = wildcards [2]
SetVariable ("target"..which, to_whom)
ColourNote ("moccasin", "darkgreen", "Target now " .. to_whom )
end
function ChooseTarget (sName, sLine, wildcards)
SetVariable ("target", GetVariable ("target" .. wildcards [1]))
ColourNote ("moccasin", "darkgreen", "Target now " .. GetVariable ("target"))
end
]]>
</script>
But now I have a problem with the variable @target
Accelerator ("F2", "backstab @target")
now sends "backstab @target" to the mud instead of the target i set.
Even replacing it with GetVariable ('target') doesnt work, not even if I use the scripting prefix...
Immediate execution
[string "Accelerator: Ctrl+F2"]:1: attempt to concatenate a nil value
stack traceback:
[string "Accelerator: Ctrl+F2"]:1: in main chunk
even adding a SetVariable ("target", "test") right before it doesn't change that.
F2 started working when I entered the script ID but Ctrl+F2 does nothing even after removing the OR. I tried to use a hardcoded mob name but even using the examples on the trigger page nothing happens.