izuemon commited on
Commit
c2bd07c
·
verified ·
1 Parent(s): cf86b30

Update turbowarp-server/gpt.py

Browse files
Files changed (1) hide show
  1. turbowarp-server/gpt.py +17 -4
turbowarp-server/gpt.py CHANGED
@@ -17,6 +17,17 @@ tw = scratchcommunication.TwCloudConnection(
17
 
18
  slots = [f"n{i}" for i in range(1,10)]
19
 
 
 
 
 
 
 
 
 
 
 
 
20
  # ---------------------
21
  # 文字テーブル
22
  # ---------------------
@@ -61,7 +72,7 @@ def decode(data):
61
 
62
  def get_used():
63
 
64
- v = tw.get_variable("n0")
65
 
66
  if not v:
67
  return []
@@ -132,9 +143,9 @@ def send(slot,text):
132
 
133
  while True:
134
 
135
- v=tw.get_variable(slot)
136
 
137
- if v[2]=="1":
138
  break
139
 
140
  if time.time()-start>10:
@@ -151,9 +162,11 @@ buffers={}
151
 
152
  while True:
153
 
 
 
154
  for i,slot in enumerate(slots,1):
155
 
156
- v=tw.get_variable(slot)
157
 
158
  if not v:
159
  continue
 
17
 
18
  slots = [f"n{i}" for i in range(1,10)]
19
 
20
+ # ---------------------
21
+ # クラウド変数取得
22
+ # ---------------------
23
+
24
+ def get_vars():
25
+ return tw.get_cloud_variables()
26
+
27
+ def get_var(name):
28
+ return get_vars().get(name)
29
+
30
+
31
  # ---------------------
32
  # 文字テーブル
33
  # ---------------------
 
72
 
73
  def get_used():
74
 
75
+ v = get_var("n0")
76
 
77
  if not v:
78
  return []
 
143
 
144
  while True:
145
 
146
+ v=get_var(slot)
147
 
148
+ if v and len(v) > 2 and v[2]=="1":
149
  break
150
 
151
  if time.time()-start>10:
 
162
 
163
  while True:
164
 
165
+ vars=get_vars()
166
+
167
  for i,slot in enumerate(slots,1):
168
 
169
+ v=vars.get(slot)
170
 
171
  if not v:
172
  continue