diff options
Diffstat (limited to 'game')
-rw-r--r-- | game/defs.rpy | 18 | ||||
-rw-r--r-- | game/script.rpy | 4 |
2 files changed, 12 insertions, 10 deletions
diff --git a/game/defs.rpy b/game/defs.rpy index ad0e6dd..0fce7c1 100644 --- a/game/defs.rpy +++ b/game/defs.rpy @@ -440,11 +440,6 @@ init -1 python: global tr_load, tr_val, tr_busy global ws - # TODO: if tr_busy already true, wait until it is made false - tr_busy=True - tr_load=False - tr_val="" - stdout("Sending: %s" % packet) try: ws.send(get_token() + ";" + packet + ";" + args) @@ -457,17 +452,23 @@ init -1 python: def send_packet(packet, args=""): global tr_load, tr_val, tr_busy # TODO: if tr_busy already true, wait until it is made false + while tr_busy: + renpy.pause(0.02) + + # Book processing space for ourselves + tr_busy=True + tr_load=False + tr_val=None - # This is a secret variable which disables threading + # This is a secret variable which disables threading and queue # This may cause hangs and other issues. if persistent.nothreading: send_packet_now(packet, args) + tr_busy=False val=tr_val return val timeout=0.0 - tr_load=False - tr_val=None renpy.show("spinner", at_list=[truecenter]) renpy.invoke_in_thread(send_packet_now, packet, args) while not tr_load: @@ -486,6 +487,7 @@ init -1 python: renpy.hide("spinner") val=tr_val + tr_busy=False del tr_val print "value obtained" diff --git a/game/script.rpy b/game/script.rpy index ad0e091..f5fc1af 100644 --- a/game/script.rpy +++ b/game/script.rpy @@ -26,7 +26,7 @@ init python: # Same as ondata? def onmsg(self, message): global tr_load, tr_val, tr_busy - stdout(message) + stdout("Server : " + message) # Inform whatever is waiting for us that a reply was obtained tr_load=True @@ -35,7 +35,7 @@ init python: return def ondata(self, msg, dtype, cont): - print("data received") + #print("data received") """ on_data: callback object which is called when a message received. This is called before on_message or on_cont_message, |