@@ -4,11 +4,11 @@ const jump_error = "Executer::do_execute_jump, can not jump to unknow label : "
44
55var stop_thread := false
66
7- var current_thread :Thread
7+ var current_thread : Thread
88
9- var current_semaphore :Semaphore
9+ var current_semaphore : Semaphore
1010
11- var threads :Dictionary
11+ var threads : Dictionary
1212
1313var regex := {
1414 NAME = "[a-zA-Z][a-zA-Z_0-9]*" ,
@@ -18,7 +18,7 @@ var regex := {
1818
1919var regex_cache := {}
2020
21- var menu_jump_index :int
21+ var menu_jump_index : int
2222
2323func _init ():
2424 for key in regex :
@@ -34,7 +34,7 @@ func get_current_thread_datas() -> Dictionary:
3434 if current_thread :
3535 var dico = threads [current_thread .get_id ()]
3636
37- return {"file_base_name" :dico ["file_base_name" ], "last_index" :dico ["last_index" ]}
37+ return {"file_base_name" : dico ["file_base_name" ], "last_index" : dico ["last_index" ]}
3838
3939 return {}
4040
@@ -46,27 +46,27 @@ func stop_current_thread() -> int:
4646 dico ["semaphore" ].post ()
4747 return OK
4848
49- func execute_script (parsed_script :Dictionary , label_name :String = "" , index :int = 0 ) -> int :
49+ func execute_script (parsed_script : Dictionary , label_name : String = "" , index : int = 0 ) -> int :
5050 stop_current_thread ()
5151
5252 current_thread = Thread .new ()
5353
5454 current_semaphore = Semaphore .new ()
5555
5656 var thread_parameters = {
57- "thread" :current_thread ,
58- "semaphore" :current_semaphore ,
59- "parsed_script" :parsed_script ,
60- "file_base_name" :parsed_script ["path" ].get_file ().get_basename (),
61- "stop" :false
57+ "thread" : current_thread ,
58+ "semaphore" : current_semaphore ,
59+ "parsed_script" : parsed_script ,
60+ "file_base_name" : parsed_script ["path" ].get_file ().get_basename (),
61+ "stop" : false
6262 }
6363
6464 if index > 0 :
6565 thread_parameters ["last_index" ] = index
6666 elif ! label_name .is_empty ():
6767 thread_parameters ["label_name" ] = label_name
6868
69- if current_thread .start (Callable (self ,"do_execute_script" ).bind (thread_parameters )) != OK :
69+ if current_thread .start (Callable (self , "do_execute_script" ).bind (thread_parameters )) != OK :
7070 threads .erase (current_thread .get_id ())
7171
7272 current_thread = null
@@ -76,7 +76,7 @@ func execute_script(parsed_script:Dictionary, label_name:String = "", index:int
7676 return FAILED
7777 return OK
7878
79- func do_execute_script_end (parameters :Dictionary ):
79+ func do_execute_script_end (parameters : Dictionary ):
8080 parameters ["thread" ].wait_to_finish ()
8181
8282 if parameters .has ("error" ):
@@ -91,13 +91,13 @@ func do_execute_script_end(parameters:Dictionary):
9191
9292 current_semaphore = null
9393
94- func do_execute_jump (jump_label :String , labels :Dictionary ) -> int :
94+ func do_execute_jump (jump_label : String , labels : Dictionary ) -> int :
9595 if labels .has (jump_label ):
9696 return labels [jump_label ]
9797
9898 return - 1
9999
100- func do_execute_script (parameters :Dictionary ):
100+ func do_execute_script (parameters : Dictionary ):
101101 var thread = parameters ["thread" ]
102102
103103 threads [thread .get_id ()] = parameters
@@ -108,7 +108,7 @@ func do_execute_script(parameters:Dictionary):
108108
109109 Rakugo .call_thread_safe ("send_execute_script_start" , parameters ["file_base_name" ])
110110
111- var parse_array :Array = parsed_script ["parse_array" ]
111+ var parse_array : Array = parsed_script ["parse_array" ]
112112
113113 var labels = parsed_script ["labels" ]
114114
@@ -133,11 +133,11 @@ func do_execute_script(parameters:Dictionary):
133133 while ! parameters ["stop" ] and index < parse_array .size ():
134134 parameters ["last_index" ] = index
135135
136- var line :Array = parse_array [index ]
136+ var line : Array = parse_array [index ]
137137
138138 var result = line [1 ]
139139
140- match (line [0 ]):
140+ match (line [0 ]):
141141 "EXIT" :
142142 parameters ["stop" ] = true
143143 break
@@ -200,9 +200,9 @@ func do_execute_script(parameters:Dictionary):
200200 semephore .wait ()
201201
202202 "MENU" :
203- var menu_choices :PackedStringArray
203+ var menu_choices : PackedStringArray
204204
205- var menu_jumps :Dictionary
205+ var menu_jumps : Dictionary
206206
207207 for i in line [2 ].size ():
208208 var menu_choice_result = line [2 ][i ]
@@ -241,16 +241,18 @@ func do_execute_script(parameters:Dictionary):
241241 var rvar_name = result ["rvar_name" ]
242242 var text = result ["text" ]
243243
244- var value
244+ var value = null
245245
246246 if ! rvar_name .is_empty ():
247247 value = Rakugo .get_variable (rvar_name )
248-
249- if ! value :
248+
249+ if value == null :
250250 parameters ["error" ] = "Executer::do_execute_script::SET_VARIABLE, can not get variable :" + rvar_name
251251 parameters ["stop" ] = true
252252 break
253-
253+
254+ elif ! result ["bool" ].is_empty ():
255+ value = result ["bool" ] == "true"
254256 elif ! text .is_empty ():
255257 value = text
256258 else :
@@ -283,7 +285,7 @@ func do_execute_script(parameters:Dictionary):
283285 parameters ["stop" ] = true
284286 break
285287
286- match (assignment ):
288+ match (assignment ):
287289 "+=" :
288290 value = lvalue + value
289291
0 commit comments