summaryrefslogtreecommitdiff
path: root/game/script.rpy
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-12-16 19:41:56 -0300
committerJesusaves <cpntb1@ymail.com>2020-12-16 19:41:56 -0300
commit4492fb781ac9a3f5707a3d83f033d7807cd5b8cd (patch)
treed0bd72a92a4e2bb32462c1a93b23a616e71cd42e /game/script.rpy
parente4a937a0a27e7024e730a778b13e92a9f4dd0d9a (diff)
downloadclient-4492fb781ac9a3f5707a3d83f033d7807cd5b8cd.tar.gz
client-4492fb781ac9a3f5707a3d83f033d7807cd5b8cd.tar.bz2
client-4492fb781ac9a3f5707a3d83f033d7807cd5b8cd.tar.xz
client-4492fb781ac9a3f5707a3d83f033d7807cd5b8cd.zip
Split defs.rpy in five files
Diffstat (limited to 'game/script.rpy')
-rw-r--r--game/script.rpy77
1 files changed, 12 insertions, 65 deletions
diff --git a/game/script.rpy b/game/script.rpy
index 6009b2d..b224474 100644
--- a/game/script.rpy
+++ b/game/script.rpy
@@ -21,59 +21,6 @@ by sending an email to {a=mailto:dmca@tmw2.org}dmca@tmw2.org{/a}.{/color}\n\
No warranties.{/b}{fast}"
return
-init python:
- # FIXME: Drop dead if session_id mismatches (new "token")
- # Same as ondata?
- def onmsg(self, message):
- global tr_load, tr_val, tr_busy
- stdout("Server : " + message)
-
- # Inform whatever is waiting for us that a reply was obtained
- tr_load=True
- tr_val=str(received)
- # We do not clean tr_busy here
- return
-
- def ondata(self, msg, dtype, cont):
- #print("data received")
- """
- on_data: callback object which is called when a message received.
- This is called before on_message or on_cont_message,
- and then on_message or on_cont_message is called.
- on_data has 4 argument.
- The 1st argument is this class object.
- The 2nd argument is utf-8 string which we get from the server.
- The 3rd argument is data type. ABNF.OPCODE_TEXT or ABNF.OPCODE_BINARY will be came.
- The 4th argument is continue flag. if 0, the data continue
- """
- #renpy.notify(msg)
- return
-
- def onopen(self):
- global tr_busy, tr_load, tr_val, HOST
- print("Opening connection to %s" % HOST)
- tr_load=True
- tr_val=""
- tr_busy=False
- self.send("PING")
-
- def onerror(self, err):
- stdout("ERROR RECEIVED")
- stdout("More details: %s" % repr(err))
- stdout("An error happened: %s" % str(err))
- # FIXME: If such error happen, the game never dies
- # This is a huge problem o.o
- while True:
- renpy.call_screen("msgbox",
- "An unrecoverable error happened.\nPress OK to return to main menu screen.")
- #raise KeyboardException(str(err))
- #raise err
- # FIXME: Not working, and the loop also does not work
- # Maybe because it causes an Exception?
- # I wonder if I can/should run this in a non-daemon thread?
- #renpy.quit(relaunch=True, status=1)
- sdelay(1.0)
- return 1
# Inform you are now ingame
label start:
@@ -83,18 +30,11 @@ label start:
show spinner at truecenter
# Initial configuration
- python:
- tr_busy=True
- tr_val=""
- tr_load=False
- tr_uptodate=False
- tr_memcheck=False
- session_id=uuid.uuid4().hex
+ call prestart
#"We shall now begin testing a websocket"
python:
# FIXME: Broken code
- ws=persistent.ws
if (ws is not None):
stdout("Socket exists, trying to reuse connection...")
try:
@@ -128,8 +68,8 @@ label start:
renpy.invoke_in_thread(ws.run_forever)
except:
# Enter in infinite loop, this will never resolve
- tr_load=False
stdout("Unrecoverable error, the program is dead.")
+ tr_load=False
while not tr_load:
sdelay()
@@ -143,8 +83,6 @@ label start:
while not tr_load:
sdelay()
- hide spinner
-
# Open game
scene bg town with Dissolve(0.3)
pause 0.1
@@ -152,6 +90,16 @@ label start:
$ password=persistent.password
$ email=""
+ if config.developer:
+ menu:
+ "tr_load is [tr_load]\ntr_busy is [tr_busy]"
+ "Send ping":
+ $ send_packet_now('PING')
+ "Send formatted packet":
+ $ send_packet_now('TOKEN;PACKET;')
+ "Send invalid packet":
+ $ send_packet_now('INVALID PACKET')
+
# Check if we need to register
if persistent.password is None:
call screen welcome
@@ -219,7 +167,6 @@ label login:
python:
try:
message=int(message)
- import copy
dlcode=copy.copy(message)
except:
print "AN ERROR HAPPENED AT LOGIN TIME"