parameters: (toggle=1)
return_statement: return
docstring: Toggles the party AI or refreshes the button state if toggle = 0
docstring_summary: Toggles the party AI or refreshes the button state if toggle = 0
docstring_tokens: Toggles the party AI or refreshes the button state if toggle = 0
function: def AIPress (toggle=1):
  	"""Toggles the party AI or refreshes the button state if toggle = 0"""
  
  	if GameCheck.IsPST() or GameCheck.IsIWD2():
  		OptionsWindow = GemRB.GetView("OPTWIN")
  		Button = OptionsWindow.GetControl (OptionControl['Toggle_AI'])
  	else:
  		PortraitWindow = GemRB.GetView("PORTWIN")
  		Button = PortraitWindow.GetControl (OptionControl['Toggle_AI'])
  
  	if toggle:
  		GemRB.GameSetScreenFlags (GS_PARTYAI, OP_XOR)
  
  	AI = GemRB.GetGUIFlags () & GS_PARTYAI
  	if AI:
  		GemRB.SetVar ("AI", 0)
  		Button.SetTooltip (AITip['Deactivate'])
  		Button.SetState(IE_GUI_BUTTON_SELECTED)
  	else:
  		GemRB.SetVar ("AI", GS_PARTYAI)
  		Button.SetTooltip (AITip['Enable'])
  		Button.SetState (IE_GUI_BUTTON_ENABLED)
  
  	if GameCheck.IsPST ():
  		GemRB.SetGlobal ("partyScriptsActive", "GLOBALS", AI)
  
  	#force redrawing, in case a hotkey triggered this function
  	Button.SetVarAssoc ("AI", GS_PARTYAI)
  	return
function_tokens: def AIPress ( toggle = 1 ) : if GameCheck . IsPST ( ) or GameCheck . IsIWD2 ( ) : OptionsWindow = GemRB . GetView ( "OPTWIN" ) Button = OptionsWindow . GetControl ( OptionControl [ 'Toggle_AI' ] ) else : PortraitWindow = GemRB . GetView ( "PORTWIN" ) Button = PortraitWindow . GetControl ( OptionControl [ 'Toggle_AI' ] ) if toggle : GemRB . GameSetScreenFlags ( GS_PARTYAI , OP_XOR ) AI = GemRB . GetGUIFlags ( ) & GS_PARTYAI if AI : GemRB . SetVar ( "AI" , 0 ) Button . SetTooltip ( AITip [ 'Deactivate' ] ) Button . SetState ( IE_GUI_BUTTON_SELECTED ) else : GemRB . SetVar ( "AI" , GS_PARTYAI ) Button . SetTooltip ( AITip [ 'Enable' ] ) Button . SetState ( IE_GUI_BUTTON_ENABLED ) if GameCheck . IsPST ( ) : GemRB . SetGlobal ( "partyScriptsActive" , "GLOBALS" , AI ) #force redrawing, in case a hotkey triggered this function Button . SetVarAssoc ( "AI" , GS_PARTYAI ) return