DO/CTL/OpCodes

From Dark Omen Wiki

< DO | CTL
Revision as of 22:12, 6 April 2012 by Ghabry (Talk | contribs)
Jump to: navigation, search
Op Mnemonic Parameter Explanation
00
init_unit
unknown At the start of every regiment script.
01
wait_for_deploy
- Pause script until deployment is finished
02
reset_call_stack
- Resets the stack that keeps track of loops and function calls.
03
restoreip
- 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
sleep
-
16
sleep_iftrue
-
17
cond_skip
value Skip value number of opcodes followed by this command
18
set_timer
time set timer to time
19
test_waiting_for_timer
- true if timer is set and is not 0
1A
wait_for_timer"
- Waits for the amount of time set by set_timer
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
22
set_unit_r_random1to10
register loads a value from 1-10 in a register
The value changes every ~2seconds
23
set_global_r_i
register, value Set global register to value
24
add_global_r_i
register, value global_reg_value = global_reg_value + value
25
test_global_r_eq_i
register, value true if global register == value
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.
2A
patrol_to_waypoint
waypoint_id (<11>) Unit patrols between all circles that have the correct waypoint_id
2B
block_movement
- Unit can't move anymore
2C
wait_unit_flag1_clear
bitmask Wait until flag 1 bits of caller are cleared
2D
wait_unit_flag1_set
bitmask Wait until flag 1 bits of caller are set
2E
test_unit_flag1
bitmask true if flag 1 bits of caller are set
2F
set_unit_flag1
bitmask Set flag 1 bits of caller
30
clear_unit_flag1
bitmask Clear flag 1 bits of caller
31
wait_unit_flag2_clear
bitmask Wait until flag 2 bits of caller are cleared
32
wait_unit_flag2_set
bitmask Wait until flag 2 bits of caller are set
33
test_unit_flag2
bitmask true if flag 2 bits of caller are set
34
set_unit_flag2
bitmask Set flag 2 bits of caller
35
clear_unit_flag2
bitmask Clear flag 2 bits of caller
36
wait_unit_flag3_clear
bitmask Wait until flag 3 bits of caller are cleared
37
wait_unit_flag3_set
bitmask Wait until flag 3 bits of caller are set
38
test_unit_flag3
bitmask true if flag 3 bits of caller are set
39
set_ctrl_flag
bitmask Set flag bits of CTL-Engine
3A
clear_ctrl_flag
bitmask Clear flag bits of CTL-Engine
3B
test_ctrl_flag
bitmask true if CTL-Engine-Flag flag bits are set
3D
set_event_handler
func Registers func as an event handler
3F
set_label
label Sets label of a unit to label
41
test_label_exists
label true if unit with thread_id is alive
4E
goto_iftrue
func Continues execution at the specified func is previous statement was true
52
move_rand_in_radius
waypoint_id (<11>) Move to a random position in the radius of the waypoint
Used for Peasants
53
init_teleport
node_id Sets the target of the next teleport call
55
teleport_to
- Moves the unit to the node_it set by init_teleport
5C
retreat
- Caller retreats (yellow arrow) but without white flag
69
send_event_to_this
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
71
teleport_to2
- Moves the unit to the node_it set by init_teleport
72
get_event
- Get the next event from the unit's event queue
73
test_more_events
- True if there are more events in the unit's event queue
74
on_event
event_id If the current event matches event_id then continue, otherwise skip this event handler.
75
end_event
value leave the event-statement. Value is 0x1abc to skip to the next 0xabc label, or 0xdef to fall through to next event handler.
76
iftrue
-
77
iffalse
-
78
else
-
79
endif
-
97
init_teleport_spell
node_id Used by B1_04 Necromancer. Caller teleports to node_id
A2
search_and_attack_enemy
unk, unk, unk Searches for an enemy in a specific radius and attacks it.
True if enemy was found.
AC
search_and_shoot_enemy
unk, unk, unk Searches for an enemy in a specific radius and shoots at him.
True if enemy was found.
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
B3
test_unit_at_node2
node_id true if unit reached node_id
B6
send_event_to_labelled
label_id, event Calls event in unit with label_id
B8
test_event_from_enemy
- true if event was caused by an enemy
BA
test_unit_class
unit_class true if unit has unit type unit_class (ignores first 3 bits)
C1
test_unit_label
label_id true if unit with label_id is on the map (= deployed) and alive
D8
test_other_unit_alive
unit_id true if unit_id is still alive?
D9
test_user_action
action_id Used in the tutorial map to check for player events.
True if the specific action was done.
DA
ui_indicate
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_other_unit_selected
unit_id true if unit with unit_id is selected
E6
test_mapmode
- true if worldmap (spacebar) has been displayed
E7
test_other_unit_status
unit_id true if ?
EA
test_sound_playing
- true if last "play" is still playing
ED
end_mission
- Display "End Mission" message
EE
test_other_unit_dead
unit_id true if unit_id is dead
likely and tested
Highly likely but not tested
Guess and/or untested

Note: node_id can be calculated by counting the subsections (starting from 0)

Personal tools
communication