Global info
Plugins are created and started before user login, and (in future there will be able to use them as "auto login".
You can use menu options or command .pluginReload to reload some plugin for testing proposes for example.
All errors from plugin will show up in Loader Right Button -> Running Games -> Pid -> ... -> Logs.
Because some data isn't available all time, make use of functions: bool IsLogedIn(); and bool IsPaused();
If plugin name is in yellow color in menu = some error occurs.
First number in menu is number of found events in plugin.
Delete are events from file what you not using, it will make game faster.
Plugins work in main game thread, so if you will do there something what need lot of processor time, your game will hang, and thats why Sleep is not allowed.
Plugins have to be located in "plugins" subdirectory.
Functions what are NOT allowed to be used in plugin :
Sleep
MoveTo
MoveToF
UseSkill
TargetMe
TargetPet
Target
TargetNpc
Talk
WaitForTeleport
WaitForNewDialog
ClickLink
ClickText
ClickAndWait
Click
There will be added some replacement functions...
You still can create new thread in Lua and call that function from this thread like this:
function OnCreate()--Event called after plugin is loaded, you should setup here any default vars,--and register to any commands or [/b]other things.end;function OnDestroy()--Event called before plugin gets destroy, make sure you kill any threads what you created.end;function OnTick()--Event called very 100ms, you can use it to check anything, don't put lot of code here.--Event is called always, some data maybe unavaible when no user is logged in.--Also calling some functions can make game crash (or force you to diconnect).end;function OnLTick()--Event called very 100ms, you can use it to check anything, don't put lot of code here.--This event is called only if user is loged in.end;function OnTick500ms()--Event called very 500ms, you can use it to check anything, don't put lot of code here.--Event is called always, some data maybe unavaible when no user is logged in.--Also calling some functions can make game crash (or force you to diconnect).end;function OnLTick500ms()--Event called very 500ms, you can use it to check anything, don't put lot of code here.--This event is called only if user is loged in.end;function OnTick1s()--Event called very 1s, you can use it to check anything, don't put lot of code here.--Event is called always, some data maybe unavaible when no user is logged in.--Also calling some functions can make game crash (or force you to diconnect).end;function OnLTick1s()--Event called very 1s, you can use it to check anything, don't put lot of code here.--This event is called only if user is loged in.end;function OnLogin(username)--Event called after user login end;function OnLogout()--Event called before user logoutend;function OnAttackCanceled(user)--Event called when some player/npc cancel his attack.end;function OnAttack(user, target)--Event called when some player/npc attack other.end;function OnAttacked(user, target)--Event called when some player/npc attacked other.end;function OnAutoAttackStart(user, target)--Event called when some player/npc activate auto attack.end;function OnUserInfo(user)--Event called when we get some info about ourselfend;function OnCharInfo(player)--Event called when we get some info about someother players (he spawn)end;function OnNpcInfo(npc)--Event called when we get some info about some npc/monster (he spawn)end;function OnDeleteUser(user)--Event called when some npc/player/user dissaper from map.end;function OnDie(user, spoiled)--Event called when some npc/player/user die.end;function OnRevive(user)--Event called when some npc/player/user revive.end;function OnMagicSkillCanceled(user)--Event called when some npc/player/user cancel magic skill.end;function OnMagicSkillLaunched(user, target, skillId)--Event called when some npc/player/user casted magic skill on someone other. --For AOE skills this event will be called for every target.end;function OnMagicSkillUse(user, target, skillId)--Event called when some npc/player/user start cast magic skill on someone other. end;function OnTargetSelected(user, target)--Event called when some npc/player/user select target.end;function OnMyTargetSelected(target)--Event called when our target got change.end;function OnTargetUnselected(user)--Event called when some npc/player/we cancel target.end;function OnChangeMoveType(user)--Event called when some npc/player/we change move type from walk to run for example.end;function OnChangeWaitType(user)--Event called when some npc/player/we change wait type from sit to stand for example.end;function OnChatUserMessage(chatType, nick, msg)--Event called someone say something on chat. chatType is a EChatType enum.end;function OnChatSystemMessage(id, msg)--Event called some system message show up on chat (id - integer, msg - string).end;
(This post was last modified: 05-01-2011 16:49 PM by ClockMan.)