summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-12-17 23:38:49 -0300
committerJesusaves <cpntb1@ymail.com>2020-12-17 23:38:49 -0300
commitacb0188a40818a60128f0bba8ff22480000108c9 (patch)
tree32393454eb661073e5ee1ad2dc331d71d69a52d9
parent8c0b1d8755b41ca7cbd6babe70e1106cb42c3a4e (diff)
downloadclient-acb0188a40818a60128f0bba8ff22480000108c9.tar.gz
client-acb0188a40818a60128f0bba8ff22480000108c9.tar.bz2
client-acb0188a40818a60128f0bba8ff22480000108c9.tar.xz
client-acb0188a40818a60128f0bba8ff22480000108c9.zip
Ah... Cannot call screens from threads I suppose.
-rw-r--r--game/04_init.rpy12
-rw-r--r--game/misc.rpy4
2 files changed, 13 insertions, 3 deletions
diff --git a/game/04_init.rpy b/game/04_init.rpy
index edb5e16..03ca68f 100644
--- a/game/04_init.rpy
+++ b/game/04_init.rpy
@@ -21,15 +21,20 @@
init python:
# FIXME: Drop dead if session_id mismatches (new "token")
# Same as ondata?
+ # FIXME: onmsg() runs within the thread, not the main app
+ # This means
def onmsg(self, message):
global tr_load, tr_val, tr_busy
stdout("Server : " + str(message))
# Wait wait, it might have been a SERVNOTICE!
try:
- if (message.split(':')[0] == "NOTICE"):
+ if (message.split(':')[0] == "NOTICE"):
+ # FIXME
+ raise NotImplemented("You cannot call screens from threads!")
renpy.call_screen("msgbox",
- "{b}SERVER NOTICE{b}\n\n%s" % str(":".join(command.split(':')[1:])))
+ #renpy.call_in_new_context("msgbox_label",
+ "{b}SERVER NOTICE{b}\n\n%s" % str(":".join(message.split(':')[1:])))
return
except:
stdout("Error displaying SERVNOTICE")
@@ -70,6 +75,7 @@ init python:
stdout("An error happened: %s" % str(err))
# FIXME: If such error happen, the game never dies
# This is a huge problem o.o
+ # Now it might die suddenly... In case it is already exiting...
try:
renpy.call_screen("msgbox",
"An unrecoverable error happened.\nPlease close and re-open the app.")
@@ -83,7 +89,7 @@ init python:
# FIXME: renpy.quit() throws an exception - which in a thread is obviously not gonna work...
#renpy.quit(relaunch=True, status=1)
except:
- sdelay(20.0)
+ pass
return 1
class GameClient(WebSocketClient):
diff --git a/game/misc.rpy b/game/misc.rpy
index 8b9fe6f..ec504da 100644
--- a/game/misc.rpy
+++ b/game/misc.rpy
@@ -167,6 +167,10 @@ init python:
# Weekly event switcher (Raids, etc. → events.py)
"""
+label msgbox_label(msgcode):
+ call screen msgbox(msgcode)
+ return
+
label clear_all:
python:
rl=False