Hi, Soap.
Here is some code to illustrate what I'm doing, more or less... Hope you got it.. I'll try the tool you sent me, thanks!
Class Game Extends App Implements IOnHttpRequestComplete
Field get_req:HttpRequest,update_php:Int[2],update:Bool
Method OnHttpRequestComplete:Void(req:HttpRequest)
Local responsetext:String=req.ResponseText()
Local status:Int=req.Status()
If responsetext.Contains("alt_conexao") Then
update_php[0]=2
update_php[1]=Millisecs()
'calls one httprequest
get_req=New HttpRequest("GET",pagina+"?opcao=checa_mensagem,Self)
get_req.Send
Endif
If responsetext.Contains("checa_mensagem") Then
'do some stuff and calls another httprequest
get_req=New HttpRequest("GET",pagina+"?opcao=atualiza_mensagem",Self)
get_req.Send
update=false
endif
end method
method OnCreate()
update_php[0]=2
update_php[1]=Millisecs()
update=False
end method
Method OnUpdate()
If Not update Then
If update_php[0]>0 Then
If Millisecs()>update_php[1]+150 Then
update_php[1]=Millisecs()
update_php[0]-=1
If update_php[0]=0 Then
update=True
get_req=New HttpRequest("GET",pagina+"?opcao=alt_conexao",Self )
get_req.Send
Endif
Endif
Endif
Endif
end method
end class
|