Python API: set_training_script bug

I have the training script tradeSouthGateSoloReturn.txt loaded. If the following code is executed, the set_training_script will always return True, so the part within the if clause will never be reached. From my understanding of the API documentation, set_training_script should return True once in this example and the next time None. So the bot would always switch between those two scripts.

Weird thing is, the bot correctly loads the tradeSouthGateSolo.txt script, but the UI in the Training Area tab won´t be updated.


def event_loop():
	log('Plugin: '+pName+': Switch script to tradeSouthGateSolo.txt')
	isScriptLoaded = set_training_script(r'...\phbot\tradeSouthGateSolo.txt')
	if not isScriptLoaded:
		log('Plugin: '+pName+': Switch script to tradeSouthGateSoloReturn.txt')

The UI won’t update because it’s separate from the actual settings. It is changing the script assuming it exists.

Could you add a getter to check which script is actually loaded?
I just built a workaround for me now, by just checking the closest npcs and setting the corresponding script based on that npc. But I guess with a getter on the actual loaded script the code would look much better :slight_smile:

get_training_area is supposed to return the entire training data and not just the position/radius. I’ll fix that.

Great. Thank you

Haha, you are crazy. Thanks a lot for releasing it so quickly :slight_smile:

1 Like