phBot Plugins
Search…
Events
If you do not need one of these functions, you should not add it to your Python script.

finished

This function gets called when Python is being unloaded and the bot is exiting. You should close any open files here.

connected

This function gets called when the bot connects to the game server.

disconnected

This function is called when the bot disconnects from the server. It can be called several times on a disconnect.

handle_joymax(opcode, data)

All packets received from the server are passed to this function.

handle_silkroad(opcode, data)

All packets received from the game client are passed to this function.

joined_game()

Called when the user successfully selects a character. No character data has been loaded yet.

teleported()

Called when the character teleports and right after joined_game()

event_loop()

Called every 500ms.

character_listing(args)

Called when the character listing is received. args is a string list of character names. Character name will include * at the beginning of its name if it is being deleted.

handle_chat(t, player, msg)

Called when a chat message is received. t is the type sent by the server.
All chat messages received are sent to this function. player can be None if it's not a private message.

handle_event(t, data)

Called for specific events. data field will always be a string. Cast it to an int if needed.
Current event list (t):
1
EVENT_UNIQUE_SPAWN = 0 # data = monster name
2
EVENT_HUNTER_SPAWN = 1 # data = player name (includes traders)
3
EVENT_THIEF_SPAWN = 2 # data = player name
4
EVENT_TRANSPORT_DIED = 3 # data = transport id (includes horses)
5
EVENT_PLAYER_ATTACKING = 4 # data = player name
6
EVENT_RARE_DROP = 5 # data = item model (equippable only)
7
EVENT_ITEM_DROP = 6 # data = item model (equippable only)
8
EVENT_DIED = 7 # data = empty string
9
EVENT_ALCHEMY_FINISHED = 8 # data = empty string
10
EVENT_GM_SPAWNED = 9 # data = player name
11
EVENT_LEVEL_UP = 10 # data = new level
Copied!
Last modified 1yr ago