Okay I realized that you can only use the functions that are listed in rombot wiki between those tags so I created the userfunctions.lua in rom folder and put my function there.. Now I just call that function in that onLeaveCombat event... But again I got error message...
Code: Select all
.../micromacro/scripts/rom/classes/player.lua:1012: Error in your profile: onLeaveCombat error: [string "..."]:3: attempt to call global 'MyFunction' (a nil value)
I think this means my function is out of scope (though I thought bot.lua automatically includes userfunctions.lua if such file exists) or it returns a nil value... Of course I could maybe edit the functions.lua and put the function there but I think it would be patched when I run SVN updates...
So where can I actually put my function and where to call it when I want it to be executed everytime player leaves combat?
EDIT: I had a typo in userfunctions.lua's filename so I fixed it and now my function should be included in the bot.lua and therefore calling it in the onLeaveCombat event should trigger it but again that same
onLeaveCombat error: [string "..."]:3: attempt to call global 'MyFunction' (a nil value) error occurs... All the parse errors from my function have now been fixed since Micromacro told me on which line which symbol was expected... Not actually sure what goes wrong...
Now it looks like this in my profile:
Code: Select all
<onLeaveCombat><![CDATA[
myFunction(); -- call the function I put in userfunctions.lua
]]></onLeaveCombat>
Ps. myFunction is not really the name of the function.. I just use it as an example.
Pps. Lua is not my 1st coding language so my questions might sound noobish.. Thank you for your patience.