Top Level Namespace
Instance Method Summary (collapse)
-
- (void) echo(value)
Sends a message to client main window.
-
- (Integer) get_match_rt
Current match round time – can be used in secondary threads while main thread is stuck in round time.
-
- (Void) load(name)
Load a script by name.
-
- (void) move(dir)
Sends a move command to client and waits for navigation message.
-
- (Void) pause(value = 1)
Pauses for given time.
-
- (void) pause_for_roundtime
deprecated
Deprecated.
Please use #pause_rt instead
-
- (void) pause_rt
Pauses during rt and accounts for any interrupted time.
-
- (void) put(value)
Sends a command to server.
-
- (Void) require(name)
Require a script by name.
Instance Method Details
- (void) echo(value)
This method returns an undefined value.
Sends a message to client main window.
172 173 174 |
# File 'main.rb', line 172 def echo(value) puts "#{API::API_ECHO_PREFIX}#{value.to_s}#{API::API_CMD_SUFFIX}" end |
- (Integer) get_match_rt
Current match round time – can be used in secondary threads while main thread is stuck in round time
205 206 207 |
# File 'main.rb', line 205 def get_match_rt $_api_current_rt end |
- (Void) load(name)
Load a script by name.
188 189 190 |
# File 'main.rb', line 188 def load(name) Kernel.load name end |
- (void) move(dir)
This method returns an undefined value.
Sends a move command to client and waits for navigation message.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'main.rb', line 134 def move(dir) puts "#{API::API_PUT_PREFIX}#{dir.to_s}#{API::API_CMD_SUFFIX}" case match_wait({ :room => [/^\{nav\}$/], :stand => [/do that while (sitting|kneeling|lying)|must be standing|cannot manage to stand/], :retreat => [/if you first retreat|You are engaged|do that while engaged/], :wait => [/\.\.\.wait|you may only type ahead/] }) when :wait pause 0.5 move dir when :stand pause 0.5 put "stand" move dir when :retreat put "retreat" put "retreat" move dir end end |
- (Void) pause(value = 1)
Pauses for given time.
180 181 182 |
# File 'main.rb', line 180 def pause(value = 1) sleep value end |
- (void) pause_for_roundtime
Please use #pause_rt instead
This method returns an undefined value.
Pauses during rt and accounts for interrupted time
213 214 215 |
# File 'main.rb', line 213 def pause_for_roundtime pause_rt end |
- (void) pause_rt
This method returns an undefined value.
Pauses during rt and accounts for any interrupted time
220 221 222 223 224 |
# File 'main.rb', line 220 def pause_rt if $_api_current_rt > 0 API::sleep_rt $_api_current_rt + $rt_adjust end end |
- (void) put(value)
This method returns an undefined value.
Sends a command to server.
158 159 160 161 162 163 |
# File 'main.rb', line 158 def put(value) $_api_gets_mutex.synchronize do $_api_queue.clear puts "#{API::API_PUT_PREFIX}#{value.to_s}#{API::API_CMD_SUFFIX}" end end |
- (Void) require(name)
Require a script by name. Only loads file once during the script execution.
197 198 199 |
# File 'main.rb', line 197 def require(name) Kernel.require name end |