summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-12-23 18:37:29 -0300
committerJesusaves <cpntb1@ymail.com>2020-12-23 18:37:29 -0300
commit12f8454a324eb1816bfa19ae8522567239719041 (patch)
treef3ef2a841ee792c60535ebf38d4827da13d6fbdc /game
parentca5f5e4953a9b23c9eaf34215380c8e1c3c60c09 (diff)
downloadclient-12f8454a324eb1816bfa19ae8522567239719041.tar.gz
client-12f8454a324eb1816bfa19ae8522567239719041.tar.bz2
client-12f8454a324eb1816bfa19ae8522567239719041.tar.xz
client-12f8454a324eb1816bfa19ae8522567239719041.zip
Optimize the code
Diffstat (limited to 'game')
-rw-r--r--game/03_init.rpy11
-rw-r--r--game/inventory.rpy10
2 files changed, 12 insertions, 9 deletions
diff --git a/game/03_init.rpy b/game/03_init.rpy
index d659afa..cb6969f 100644
--- a/game/03_init.rpy
+++ b/game/03_init.rpy
@@ -368,3 +368,14 @@ init python:
MUSIC_PROLOGUE02=RetString("sfx/prologue.mp3")
MUSIC_PROLOGUE03=RetString("sfx/shining.mp3")
+init 1 python:
+ def unitsquare(uid, atl=czoom_70):
+ show_img("square_%d" % uid, False)
+ try:
+ btn=At("square_%d" % uid, atl)
+ except:
+ btn=At("square_0", atl)
+ traceback.print_exc()
+ stdout("[ERROR] ATCODE FOR square_%d is INVALID" % uid)
+ return btn
+
diff --git a/game/inventory.rpy b/game/inventory.rpy
index c67b031..a1c6e7f 100644
--- a/game/inventory.rpy
+++ b/game/inventory.rpy
@@ -84,15 +84,7 @@ screen inventory(blank=False, filters="True"):
#print str(item)
#print str(alu)
if evl:
- python:
- show_img("square_%d" % item["unit_id"], False)
- try:
- btn=At("square_%d" % item["unit_id"], czoom_70)
- except:
- btn=At("square_0", czoom_70)
- traceback.print_exc()
- stdout("[ERROR] ATCODE FOR square_%d is INVALID" % item["unit_id"])
- #btn=At("square_10000300", czoom_70)
+ $ btn = unitsquare(item["unit_id"], czoom_70)
imagebutton:
idle btn
action Return(i)