What is the accepted form for doing this?
I have set to working in converting a world file I started on a long time ago, to convert it from using perl scripts to lua.. In doing so, I have a couple of triggers which I used to call functions in my perl script file. I used regular expression triggers to be able to store certain text to pass as function parameters. The trigger would be set to "Send To: Script", and the "Send" box would be set to call the function along with the matching data (ie UpdateHP (%1, %2)). The label would be set to some arbitrary name for the trigger, and the "Script" field could be left blank.
This worked well, and this particular example (my UpdateHP function) seems to continue working as intended after porting UpdateHP to my lua script file. What doesn't make sense however is that I'm having problems porting another similar function (UpdateLevelAndClass). It's an almost identical trigger - in purpose and implementation - and yet for some reason my wildcard parameters aren't being passed.
The only way I've been able to get it to work is by setting "Script:" to my function name. In this case, the method gets called and the paramaters are the name of the function, the line that triggered it, and a table containing the wildcards which were created with the regex. Is this just how I'll have to do it? I sort of like the idea of being able to "Send to: Script", but can't seem to get parameters to consistently pass.
Any thoughts? :)
I have set to working in converting a world file I started on a long time ago, to convert it from using perl scripts to lua.. In doing so, I have a couple of triggers which I used to call functions in my perl script file. I used regular expression triggers to be able to store certain text to pass as function parameters. The trigger would be set to "Send To: Script", and the "Send" box would be set to call the function along with the matching data (ie UpdateHP (%1, %2)). The label would be set to some arbitrary name for the trigger, and the "Script" field could be left blank.
This worked well, and this particular example (my UpdateHP function) seems to continue working as intended after porting UpdateHP to my lua script file. What doesn't make sense however is that I'm having problems porting another similar function (UpdateLevelAndClass). It's an almost identical trigger - in purpose and implementation - and yet for some reason my wildcard parameters aren't being passed.
The only way I've been able to get it to work is by setting "Script:" to my function name. In this case, the method gets called and the paramaters are the name of the function, the line that triggered it, and a table containing the wildcards which were created with the regex. Is this just how I'll have to do it? I sort of like the idea of being able to "Send to: Script", but can't seem to get parameters to consistently pass.
Any thoughts? :)