Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | toshbar |
Hi all,
I’m not sure how to go about pulling high scores from dreamlo. I’m able to store high scores via the below code but I can’t seem to find any documentation anywhere on how to pull the scores back into godot to display them. Can somebody either point me to some documentation or help me out with the code? This is what I have now but the downloadScores function prints 0 instead of the scores
Thank you
extends Node
func _ready():
getRequest()
downloadScores()
pass
func getRequest():
var http = HTTPClient.new() # Create the Client
var err=http.connect_to_host("http://dreamlo.com",80)
assert(err==OK) # Make sure connection was OK
# Wait until resolved and connected
while( http.get_status()==HTTPClient.STATUS_CONNECTING or http.get_status()==HTTPClient.STATUS_RESOLVING):
http.poll()
print("Connecting..")
OS.delay_msec(500)
assert( http.get_status() == HTTPClient.STATUS_CONNECTED ) # Could not connect
# Some headers
var headers=["User-Agent: BTSudak/1.0 (Godot)","Accept: */*"]
var url="/lb/5c2cf181b6397e0c24d23b81/add/Test/50"
err = http.request(HTTPClient.METHOD_GET, url, headers)
assert( err == OK ) # Make sure all is OK
func downloadScores():
var http = HTTPClient.new() # Create the Client
var err=http.connect_to_host("http://dreamlo.com",80)
assert(err==OK) # Make sure connection was OK
# Wait until resolved and connected
while( http.get_status()==HTTPClient.STATUS_CONNECTING or http.get_status()==HTTPClient.STATUS_RESOLVING):
http.poll()
print("Connecting..")
OS.delay_msec(500)
assert( http.get_status() == HTTPClient.STATUS_CONNECTED ) # Could not connect
# Some headers
var headers=["User-Agent: BTSudak/1.0 (Godot)","Accept: */*"]
var url="/lb/5c2cf181b6397e0c24d23b81/pipe"
err = http.request(HTTPClient.METHOD_GET, url, headers)
print(err)
#assert( err == OK ) # Make sure all is OK