Handling Script Commands

Handling Script Commands

By adding a custom command to your script, you can do something when it reaches it, with Python. It's easy to do and adds more functionality to scripts.

Example

  1. Add do_something_here your walk script

  2. Add a do_something_here(arguments) function to your Python script

def do_something_here(arguments):
    log('%s' % arguments)
    return 0
  • When the bot reaches do_something_here in your walk script, it will pass it over to your Python script. All script commands are passed to Python whether you have a function for it or not.

  • The return 0 is for how many milliseconds to sleep. This is necessary because the bot must lock the Python interpreter in order to keep everything thread safe. If you slept manually and another thread attempted to call one of your functions, it would block until you returned from the function and the global interpreter lock was released.

Example Arguments

Arguments that get passed to your function must be comma separated in the walk script. They are then parsed into a list and sent to your Python script.

['walk', '6434', '1099', '-32']

Last updated