Integrating Python functions inbetween walk script lines

Hello, Just recently found out that phBot actually supports Python plug-ins which is crazy! :heart:

Anyway, i’ll explain what i’m trying to do in an ordered list:

  1. Make a walk script to move to bunch of coordinates (Working)

  2. Execute a function from the plug-in (works)

  3. Continue the walk script to move to more coordinates (not working)

Step 3 actually works but not as I want it, the bot will try to continue the walk script before the function finishes executing (as far as i know).

I also tried to stop_bot() when the function is triggered, then start_bot() again when the function finishes executing. however, the bot will start the walk script from the beginning without an attemp to continue from where it last reached.

I’m not asking for a fully working solution or a code block. Just hoping to find some tips which might help me solve this :slight_smile: Something like pause_script, and continue_script would do it i guess? what are your thoughts?

example of the code would be:

since I am making a topic, i’d also like to ask, can I pass arguments to the function from the walk script file? like do_something([1,2,3]) ? if yes, how?

Thank you.

You can add do_somethig,1,2,3 as parameters.
An idea: give next coords to function as params.
At the end of function add move_to(x,y,z)
Thrn start bot. Then Bot will continue from the next coord.


I realized i can call a function and use wait command, it’s working smoothly. thank you very much!


Have you tried adding a wait command in-between your functions/scripts?

Sorry for my noob question, I am new at phbot, I have a question: how can I use the Python function in Phbot where do I should store this function. For example: I create a file, namely, containing do_something function. So how can I add do_something function in my script or condition? Can someone please tell me?

You can make new topics instead of opening up 4 year old ones.

Documentation here

Or look at my ScriptCommands plugin for many examples.

1 Like