DO/CTL/OpCodes
From Dark Omen Wiki
(Difference between revisions)
m (leave_map_at -> retreat_to) |
(updated opcode list) |
||
Line 1: | Line 1: | ||
{|class="wikitable" style="border-collapse: separate; " | {|class="wikitable" style="border-collapse: separate; " | ||
! Op !! Mnemonic !! Parameter !! Explanation | ! Op !! Mnemonic !! Parameter !! Explanation | ||
+ | |- | ||
+ | | 00 | ||
+ | | {{a-likely|init_unit}} | ||
+ | | - | ||
+ | | At the start of every regiment script. | ||
|- | |- | ||
| 01 | | 01 | ||
Line 11: | Line 16: | ||
| - | | - | ||
| ? | | ? | ||
+ | |- | ||
+ | | 03 | ||
+ | | {{a-guess|reset_call_stack}} | ||
+ | | - | ||
+ | | Jumps to last saveip-call | ||
|- | |- | ||
| 04 | | 04 | ||
Line 51: | Line 61: | ||
| func_id | | func_id | ||
| Jump to func_id | | Jump to func_id | ||
+ | |- | ||
+ | | 0C | ||
+ | | {{a-certain|branch1}} | ||
+ | | func_id | ||
+ | | Used in eventhandler, Jump to func_id | ||
+ | |- | ||
+ | | 0D | ||
+ | | {{a-certain|branch2}} | ||
+ | | func_id | ||
+ | | Used in eventhandler, Jump to func_id | ||
|- | |- | ||
| 0E | | 0E | ||
- | | {{a-certain| | + | | {{a-certain|branch3}} |
| func_id | | func_id | ||
- | | Jump to func_id, | + | | Used in eventhandler, Jump to func_id |
+ | |- | ||
+ | | 0F | ||
+ | | {{a-certain|branch4}} | ||
+ | | func_id | ||
+ | | Used in eventhandler, Jump to func_id | ||
+ | |- | ||
+ | | 10 | ||
+ | | {{a-certain|branch5}} | ||
+ | | func_id | ||
+ | | Used in eventhandler, Jump to func_id | ||
|- | |- | ||
| 11 | | 11 | ||
- | | {{a-certain| | + | | {{a-certain|call}} |
| func_id | | func_id | ||
- | | Jump to func_id ( | + | | Jump to func_id (return pos saved) |
|- | |- | ||
| 12 | | 12 | ||
Line 66: | Line 96: | ||
| - | | - | ||
| Continue from last call statement | | Continue from last call statement | ||
+ | |- | ||
+ | | 13 | ||
+ | | {{a-guess|return_from_event_handler}} | ||
+ | | - | ||
+ | | Continue from last event call? | ||
|- | |- | ||
| 15 | | 15 | ||
- | | {{a- | + | | {{a-guess|call_event_handler}} |
| - | | - | ||
- | | | + | | Executes all associated event handlers |
|- | |- | ||
| 16 | | 16 | ||
- | | {{a-likely| | + | | {{a-likely|if_true_do_events}} |
| - | | - | ||
- | | | + | | Call event handler if last statement was true |
|- | |- | ||
| 17 | | 17 | ||
Line 109: | Line 144: | ||
| 1D | | 1D | ||
| {{a-guess|test_x_eq_0}} | | {{a-guess|test_x_eq_0}} | ||
- | | | + | | - |
| true if value == 0 | | true if value == 0 | ||
|- | |- | ||
| 1E | | 1E | ||
- | | {{a-certain| | + | | {{a-certain|set_unit_r_i}} |
| register, value | | register, value | ||
| Set register to value | | Set register to value | ||
|- | |- | ||
| 1F | | 1F | ||
- | | {{a-certain| | + | | {{a-certain|add_unit_r_i}} |
| register, value | | register, value | ||
| reg_value = reg_value + value | | reg_value = reg_value + value | ||
|- | |- | ||
| 20 | | 20 | ||
- | | {{a-certain| | + | | {{a-certain|test_unit_r_eq_i}} |
| register, value | | register, value | ||
| true if register == value | | true if register == value | ||
|- | |- | ||
| 21 | | 21 | ||
- | | {{a-certain| | + | | {{a-certain|test_unit_r_eq_r}} |
| register1, register2 | | register1, register2 | ||
| true if register1 == register2 | | true if register1 == register2 | ||
|- | |- | ||
| 28 | | 28 | ||
- | | {{a-certain| | + | | {{a-certain|move_to_node}} |
- | | | + | | node_id |
- | | Unit moves to | + | | Unit moves to node with id node_id |
|- | |- | ||
| 29 | | 29 | ||
- | | {{a-certain| | + | | {{a-certain|retreat_to_node}} |
- | | | + | | node_id |
- | | Caller tries to reach | + | | Caller tries to reach node_id when retreating.<br /> If it's near the boundaries the unit will escape. |
|- | |- | ||
| 34 | | 34 | ||
Line 176: | Line 211: | ||
| flag | | flag | ||
| true if CTL-Engine-Flag flag is set | | true if CTL-Engine-Flag flag is set | ||
+ | |- | ||
+ | | 3D | ||
+ | | {{a-certain|set_event_handler}} | ||
+ | | func | ||
+ | | Registers func as an event handler | ||
+ | |- | ||
+ | | 3F | ||
+ | | {{a-certain|set_threadid}} | ||
+ | | thread_id | ||
+ | | Sets thread_id of a unit to thread_id | ||
+ | |- | ||
+ | | 41 | ||
+ | | {{a-guess|test_threadid_alive}} | ||
+ | | thread_id | ||
+ | | true if unit with thread_id is alive | ||
|- | |- | ||
| 52 | | 52 | ||
Line 186: | Line 236: | ||
| - | | - | ||
| Caller retreats (yellow arrow) but without(!) white flag | | Caller retreats (yellow arrow) but without(!) white flag | ||
+ | |- | ||
+ | | 69 | ||
+ | | {{a-guess|raise_event1}} | ||
+ | | event_id | ||
+ | | executes event of caller | ||
+ | |- | ||
+ | | 6b | ||
+ | | {{a-guess|raise_event2}} | ||
+ | | event_id | ||
+ | | executes event of caller | ||
+ | |- | ||
+ | | 6d | ||
+ | | {{a-guess|raise_event3}} | ||
+ | | event_id | ||
+ | | executes event of caller | ||
+ | |- | ||
+ | | 6e | ||
+ | | {{a-guess|raise_event4}} | ||
+ | | event_id | ||
+ | | executes event of caller | ||
+ | |- | ||
+ | | 70 | ||
+ | | {{a-guess|raise_event5}} | ||
+ | | event_id | ||
+ | | executes event of caller | ||
|- | |- | ||
| 72 | | 72 | ||
- | | {{a- | + | | {{a-likely|get_event}} |
| - | | - | ||
| Continue execution at an event Id | | Continue execution at an event Id | ||
|- | |- | ||
| 73 | | 73 | ||
- | | {{a-guess| | + | | {{a-guess|test_more_events}} |
| - | | - | ||
| | | | ||
|- | |- | ||
| 74 | | 74 | ||
- | | {{a- | + | | {{a-likely|on_event}} |
| event_id | | event_id | ||
- | | | + | | Number of the event |
|- | |- | ||
| 75 | | 75 | ||
- | | {{a-likely| | + | | {{a-likely|end_event}} |
| value | | value | ||
- | | leave the | + | | leave the event-statement. Value is unknown |
|- | |- | ||
| 76 | | 76 | ||
Line 229: | Line 304: | ||
| 97 | | 97 | ||
| {{a-likely|teleport_to}} | | {{a-likely|teleport_to}} | ||
- | | | + | | node_id |
- | | Caller teleports to | + | | Caller teleports to node_id |
|- | |- | ||
| AC | | AC | ||
- | | {{a-guess| | + | | {{a-guess|check_unit_info}} |
- | | unk, | + | | unk, unk, unk |
- | | | + | | ??? |
|- | |- | ||
| AE | | AE | ||
Line 241: | Line 316: | ||
| voice_id | | voice_id | ||
| display portrait of caller and say text voice_id | | display portrait of caller and say text voice_id | ||
+ | |- | ||
+ | | AF | ||
+ | | {{a-certain|play_other_unit}} | ||
+ | | unit_id, voice_id | ||
+ | | display portrait of unit_id and say text voice_id | ||
+ | |- | ||
+ | | B2 | ||
+ | | {{a-likely|test_unit_afraid}} | ||
+ | | - | ||
+ | | true if unit has fear | ||
|- | |- | ||
| B3 | | B3 | ||
- | | {{a- | + | | {{a-certain|test_unit_at_node}} |
- | | | + | | node_id |
- | | true if unit reached | + | | true if unit reached node_id |
+ | |- | ||
+ | | B6 | ||
+ | | {{a-guess|raise_event_in_thread}} | ||
+ | | thread_id, event | ||
+ | | Calls event in unit with thread_id | ||
+ | |- | ||
+ | | BA | ||
+ | | {{a-certain|test_unit_class}} | ||
+ | | unit_class | ||
+ | | true if unit has unit type unit_class (ignores first 3 bits) | ||
+ | |- | ||
+ | | C1 | ||
+ | | {{a-certain|test_threadid}} | ||
+ | | thread_id | ||
+ | | true if unit with thread_id is on the map (= deployed) and alive | ||
|- | |- | ||
| D8 | | D8 | ||
Line 260: | Line 360: | ||
| {{a-certain|ui_effect}} | | {{a-certain|ui_effect}} | ||
| x, y, size | | x, y, size | ||
- | | display 4 arrows that are placed around a rectangle<br />If x and y are -1 size is the unit_id | + | | display 4 arrows that are placed around a rectangle<br />If x and y are -1, size is the unit_id |
+ | |- | ||
+ | | DE | ||
+ | | {{a-likely|test_other_unit_at_node}} | ||
+ | | node_id | ||
+ | | True if unit_id reached node | ||
+ | |- | ||
+ | | DF | ||
+ | | {{a-likely|test_other_unit_attacking}} | ||
+ | | unit_id | ||
+ | | True if unit_id is fighting | ||
|- | |- | ||
| E0 | | E0 | ||
Line 276: | Line 386: | ||
| - | | - | ||
| true if worldmap (spacebar) is displayed | | true if worldmap (spacebar) is displayed | ||
+ | |- | ||
+ | | E6 | ||
+ | | {{a-guess|test_other_unit_status}} | ||
+ | | unit_id | ||
+ | | true if ? | ||
|- | |- | ||
| EA | | EA | ||
- | | {{a-likely| | + | | {{a-likely|test_sound_playing}} |
| - | | - | ||
- | | true if last "play" if | + | | true if last "play" is still playing |
+ | |- | ||
+ | | EE | ||
+ | | {{a-guess|test_other_unit_dead}} | ||
+ | | unit_id | ||
+ | | true if unit_id is dead | ||
|- | |- | ||
| ED | | ED |
Revision as of 23:50, 1 January 2010
Op | Mnemonic | Parameter | Explanation |
---|---|---|---|
00 | init_unit
| - | At the start of every regiment script. |
01 | wait_for_deploy
| - | Pause script until deployment is finished |
02 | reset_call_stack
| - | ? |
03 | reset_call_stack
| - | Jumps to last saveip-call |
04 | saveip
| - | Saves Instruction Pointer |
05 | do
| - | |
06 | always
| - | Jump to last do statement |
07 | while
| - | Jump to do if previous statement is true |
08 | whilenot
| - | Jump to do if previous statement is false |
09 | for
| - | |
0A | next
| - | |
0B | goto
| func_id | Jump to func_id |
0C | branch1
| func_id | Used in eventhandler, Jump to func_id |
0D | branch2
| func_id | Used in eventhandler, Jump to func_id |
0E | branch3
| func_id | Used in eventhandler, Jump to func_id |
0F | branch4
| func_id | Used in eventhandler, Jump to func_id |
10 | branch5
| func_id | Used in eventhandler, Jump to func_id |
11 | call
| func_id | Jump to func_id (return pos saved) |
12 | return
| - | Continue from last call statement |
13 | return_from_event_handler
| - | Continue from last event call? |
15 | call_event_handler
| - | Executes all associated event handlers |
16 | if_true_do_events
| - | Call event handler if last statement was true |
17 | if_true_skip
| value | Skip value number of opcodes followed by this command |
18 | set_wait_time
| time | set wait-time of wait to time |
19 | test_wait_over
| - | true if wait-time is reached |
1A | wait
| - | Same as sleep but time can be set |
1B | set_x_i
| value | ? |
1C | add_x_i
| value | ? |
1D | test_x_eq_0
| - | true if value == 0 |
1E | set_unit_r_i
| register, value | Set register to value |
1F | add_unit_r_i
| register, value | reg_value = reg_value + value |
20 | test_unit_r_eq_i
| register, value | true if register == value |
21 | test_unit_r_eq_r
| register1, register2 | true if register1 == register2 |
28 | move_to_node
| node_id | Unit moves to node with id node_id |
29 | retreat_to_node
| node_id | Caller tries to reach node_id when retreating. If it's near the boundaries the unit will escape. |
34 | clear_unit_flag
| flag | Remove Flag of caller |
35 | set_unit_flag
| flag | Set flag of caller |
36 | wait_for_unit_flag
| flag | Wait until flag of caller is set |
38 | test_unit_flag
| flag | true if flag of caller is set |
39 | set_ctrl_flag
| flag | Set flag of CTL-Engine |
3A | clear_ctrl_flag
| flag | Clear flag of CTL-Engine |
3B | test_ctrl_flag
| flag | true if CTL-Engine-Flag flag is set |
3D | set_event_handler
| func | Registers func as an event handler |
3F | set_threadid
| thread_id | Sets thread_id of a unit to thread_id |
41 | test_threadid_alive
| thread_id | true if unit with thread_id is alive |
52 | move_rand_in_radius
| waypoint_id (<11>) | Move to a random position in the radius of the waypoint Used for Peasants |
5C | retreat
| - | Caller retreats (yellow arrow) but without(!) white flag |
69 | raise_event1
| event_id | executes event of caller |
6b | raise_event2
| event_id | executes event of caller |
6d | raise_event3
| event_id | executes event of caller |
6e | raise_event4
| event_id | executes event of caller |
70 | raise_event5
| event_id | executes event of caller |
72 | get_event
| - | Continue execution at an event Id |
73 | test_more_events
| - | |
74 | on_event
| event_id | Number of the event |
75 | end_event
| value | leave the event-statement. Value is unknown |
76 | iftrue
| - | |
77 | iffalse
| - | |
78 | else
| - | |
79 | endif
| - | |
97 | teleport_to
| node_id | Caller teleports to node_id |
AC | check_unit_info
| unk, unk, unk | ??? |
AE | play
| voice_id | display portrait of caller and say text voice_id |
AF | play_other_unit
| unit_id, voice_id | display portrait of unit_id and say text voice_id |
B2 | test_unit_afraid
| - | true if unit has fear |
B3 | test_unit_at_node
| node_id | true if unit reached node_id |
B6 | raise_event_in_thread
| thread_id, event | Calls event in unit with thread_id |
BA | test_unit_class
| unit_class | true if unit has unit type unit_class (ignores first 3 bits) |
C1 | test_threadid
| thread_id | true if unit with thread_id is on the map (= deployed) and alive |
D8 | test_unit_alive
| unit_id | true if unit_id is still alive? |
D9 | test_user_action
| ? | |
DA | ui_effect
| x, y, size | display 4 arrows that are placed around a rectangle If x and y are -1, size is the unit_id |
DE | test_other_unit_at_node
| node_id | True if unit_id reached node |
DF | test_other_unit_attacking
| unit_id | True if unit_id is fighting |
E0 | test_other_unit_flags
| unit_id, flag | true if flag of unit_id is set |
E2 | test_unit_selected
| unit_id | true if unit with unit_id is selected |
E6 | test_mapmode
| - | true if worldmap (spacebar) is displayed |
E6 | test_other_unit_status
| unit_id | true if ? |
EA | test_sound_playing
| - | true if last "play" is still playing |
EE | test_other_unit_dead
| unit_id | true if unit_id is dead |
ED | fail_mission
| - | Display "End Mission" message |
likely and tested
Highly likely but not tested
Guess and/or untested
|
Note: subchunk_id can be calculated by counting the subsections (starting from 0)