DO/CTL/OpCodes

From Dark Omen Wiki

(Difference between revisions)
Jump to: navigation, search
m
(Updated opcode table to match up with ctldis)
Line 103: Line 103:
|-
|-
| 15
| 15
-
| {{a-guess|call_event_handler}}
+
| {{a-guess|sleep1}}
| -
| -
-
| Executes all associated event handlers
+
|  
|-
|-
| 16
| 16
-
| {{a-likely|if_true_do_events}}
+
| {{a-guess|sleep2}}
| -
| -
| Call event handler if last statement was true
| Call event handler if last statement was true
|-
|-
| 17
| 17
-
| {{a-guess|if_true_skip}}
+
| {{a-likely|cond_skip}}
| value
| value
| Skip value number of opcodes followed by this command
| Skip value number of opcodes followed by this command
|-
|-
| 18
| 18
-
| {{a-likely|set_wait_time}}
+
| {{a-likely|set_timer}}
| time
| time
-
| set wait-time of wait to time
+
| set timer to time
|-
|-
| 19
| 19
-
| {{a-likely|test_waiting}}
+
| {{a-likely|test_waiting_for_timer}}
| -
| -
-
| true if still waiting for timer
+
| true if timer is set and is not 0
|-
|-
| 1A
| 1A
-
| {{a-likely|wait}}
+
| {{a-likely|wait_for_timer"}}
| -
| -
-
| Same as sleep but time can be set
+
| Waits for the amount of time set by set_timer
|-
|-
| 1B
| 1B
Line 171: Line 171:
| register
| register
| loads a value from 1-10 in a register<br />The value changes every ~2seconds
| loads a value from 1-10 in a register<br />The value changes every ~2seconds
 +
|-
 +
| 23
 +
| {{a-guess|set_global_r_i}}
 +
| register, value
 +
| Set global register to value
 +
|-
 +
| 24
 +
| {{a-guess|add_global_r_i}}
 +
| register, value
 +
| global_reg_value = global_reg_value + value
 +
|-
 +
| 25
 +
| {{a-guess|test_global_r_eq_i}}
 +
| register, value
 +
| true if global register == value
|-
|-
| 28
| 28
Line 181: Line 196:
| node_id
| node_id
| Caller tries to reach node_id when retreating.<br /> If it's near the boundaries the unit will escape.
| Caller tries to reach node_id when retreating.<br /> If it's near the boundaries the unit will escape.
 +
|-
 +
| 2A
 +
| {{a-certain|patrol_to_waypoint}}
 +
| waypoint_id (<11>)
 +
| Unit patrols between all circles that have the correct waypoint_id
 +
|-
 +
| 2B
 +
| {{a-guess|block_movement}}
 +
| -
 +
| Unit can't move anymore
 +
|-
 +
| 2C
 +
| {{a-likely|wait_unit_flag1_clear}}
 +
| bitmask
 +
| Wait until flag 1 bits of caller are cleared
 +
|-
 +
| 2D
 +
| {{a-likely|wait_unit_flag1_set}}
 +
| bitmask
 +
| Wait until flag 1 bits of caller are set
 +
|-
 +
| 2E
 +
| {{a-likely|test_unit_flag1}}
 +
| bitmask
 +
| true if flag 1 bits of caller are set
 +
|-
 +
| 2F
 +
| {{a-likely|set_unit_flag1}}
 +
| bitmask
 +
| Set flag 1 bits of caller
 +
|-
 +
| 30
 +
| {{a-likely|clear_unit_flag1}}
 +
| bitmask
 +
| Clear flag 1 bits of caller
 +
|-
 +
| 31
 +
| {{a-likely|wait_unit_flag2_clear}}
 +
| bitmask
 +
| Wait until flag 2 bits of caller are cleared
 +
|-
 +
| 32
 +
| {{a-likely|wait_unit_flag2_set}}
 +
| bitmask
 +
| Wait until flag 2 bits of caller are set
 +
|-
 +
| 33
 +
| {{a-likely|test_unit_flag2}}
 +
| bitmask
 +
| true if flag 2 bits of caller are set
|-
|-
| 34
| 34
-
| {{a-likely|clear_unit_flag}}
+
| {{a-likely|set_unit_flag2}}
-
| flag
+
| bitmask
-
| Remove Flag of caller
+
| Set flag 2 bits of caller
|-
|-
| 35
| 35
-
| {{a-likely|set_unit_flag}}
+
| {{a-likely|clear_unit_flag2}}
-
| flag
+
| bitmask
-
| Set flag of caller
+
| Clear flag 2 bits of caller
|-
|-
| 36
| 36
-
| {{a-likely|wait_for_unit_flag}}
+
| {{a-likely|wait_unit_flag3_clear}}
-
| flag
+
| bitmask
-
| Wait until flag of caller is set
+
| Wait until flag 3 bits of caller are cleared
 +
|-
 +
| 37
 +
| {{a-likely|wait_unit_flag3_set}}
 +
| bitmask
 +
| Wait until flag 3 bits of caller are set
|-
|-
| 38
| 38
-
| {{a-likely|test_unit_flag}}
+
| {{a-likely|test_unit_flag3}}
-
| flag
+
| bitmask
-
| true if flag of caller is set
+
| true if flag 3 bits of caller are set
|-
|-
| 39
| 39
-
| {{a-likely|set_ctrl_flag}}
+
| {{a-guess|set_ctrl_flag}}
-
| flag
+
| bitmask
-
| Set flag of CTL-Engine
+
| Set flag bits of CTL-Engine
|-
|-
| 3A
| 3A
-
| {{a-likely|clear_ctrl_flag}}
+
| {{a-guess|clear_ctrl_flag}}
-
| flag
+
| bitmask
-
| Clear flag of CTL-Engine
+
| Clear flag bits of CTL-Engine
|-
|-
| 3B
| 3B
-
| {{a-likely|test_ctrl_flag}}
+
| {{a-guess|test_ctrl_flag}}
-
| flag
+
| bitmask
-
| true if CTL-Engine-Flag flag is set
+
| true if CTL-Engine-Flag flag bits are set
|-
|-
| 3D
| 3D
Line 223: Line 293:
|-
|-
| 3F
| 3F
-
| {{a-certain|set_threadid}}
+
| {{a-certain|set_label}}
-
| thread_id
+
| label
-
| Sets thread_id of a unit to thread_id
+
| Sets label of a unit to label
|-
|-
| 41
| 41
-
| {{a-guess|test_threadid_alive}}
+
| {{a-guess|test_label_exists}}
-
| thread_id
+
| label
| true if unit with thread_id is alive
| true if unit with thread_id is alive
|-
|-
Line 236: Line 306:
| waypoint_id (<11>)
| waypoint_id (<11>)
| Move to a random position in the radius of the waypoint<br />Used for Peasants
| Move to a random position in the radius of the waypoint<br />Used for Peasants
 +
|-
 +
| 53
 +
| {{a-likely|init_teleport}}
 +
| node_id
 +
| Sets the target of the next teleport call
 +
|-
 +
| 55
 +
| {{a-likely|teleport_to}}
 +
| -
 +
| Moves the unit to the node_it set by init_teleport
|-
|-
| 5C
| 5C
| {{a-certain|retreat}}
| {{a-certain|retreat}}
| -
| -
-
| Caller retreats (yellow arrow) but without(!) white flag
+
| Caller retreats (yellow arrow) but without white flag
|-
|-
| 69
| 69
-
| {{a-guess|raise_event1}}
+
| {{a-guess|send_event_to_this}}
| event_id
| event_id
| executes event of caller
| executes event of caller
Line 266: Line 346:
| event_id
| event_id
| executes event of caller
| executes event of caller
 +
|-
 +
| 71
 +
| {{a-likely|teleport_to2}}
 +
| -
 +
| Moves the unit to the node_it set by init_teleport
|-
|-
| 72
| 72
Line 288: Line 373:
|-
|-
| 76
| 76
-
| {{a-likely|iftrue}}
+
| {{a-certain|iftrue}}
| -
| -
|  
|  
|-
|-
| 77
| 77
-
| {{a-likely|iffalse}}
+
| {{a-certain|iffalse}}
| -
| -
|  
|  
|-
|-
| 78
| 78
-
| {{a-likely|else}}
+
| {{a-certain|else}}
| -
| -
|  
|  
|-
|-
| 79
| 79
-
| {{a-likely|endif}}
+
| {{a-certain|endif}}
| -
| -
|  
|  
|-
|-
| 97
| 97
-
| {{a-likely|teleport_to}}
+
| {{a-guess|init_teleport_spell}}
| node_id
| node_id
-
| Caller teleports to node_id
+
| Used by B1_04 Necromancer. Caller teleports to node_id
 +
|-
 +
| A2
 +
| {{a-guess|search_and_attack_enemy}}
 +
| unk, unk, unk
 +
| Searches for an enemy in a specific radius and attacks it.<br/>True if enemy was found.
|-
|-
| AC
| AC
-
| {{a-guess|check_unit_info}}
+
| {{a-guess|search_and_shoot_enemy}}
| unk, unk, unk
| unk, unk, unk
-
| ???
+
| Searches for an enemy in a specific radius and shoots at him.<br/>True if enemy was found.
|-
|-
| AE
| AE
Line 334: Line 424:
| B3
| B3
| {{a-certain|test_unit_at_node}}
| {{a-certain|test_unit_at_node}}
 +
| node_id
 +
| true if unit reached node_id
 +
|-
 +
| B3
 +
| {{a-likely|test_unit_at_node2}}
| node_id
| node_id
| true if unit reached node_id
| true if unit reached node_id
|-
|-
| B6
| B6
-
| {{a-guess|raise_event_in_thread}}
+
| {{a-guess|send_event_to_labelled}}
-
| thread_id, event
+
| label_id, event
-
| Calls event in unit with thread_id
+
| Calls event in unit with label_id
|-
|-
| B8
| B8
-
| {{a-guess|test_event_caused_by_enemy}}
+
| {{a-likely|test_event_from_enemy}}
| -
| -
| true if event was caused by an enemy
| true if event was caused by an enemy
Line 353: Line 448:
|-
|-
| C1
| C1
-
| {{a-certain|test_threadid}}
+
| {{a-certain|test_unit_label}}
-
| thread_id
+
| label_id
-
| true if unit with thread_id is on the map (= deployed) and alive
+
| true if unit with label_id is on the map (= deployed) and alive
|-
|-
| D8
| D8
-
| {{a-guess|test_unit_alive}}
+
| {{a-guess|test_other_unit_alive}}
| unit_id
| unit_id
| true if unit_id is still alive?
| true if unit_id is still alive?
|-
|-
| D9
| D9
-
| {{a-guess|test_user_action}}
+
| {{a-likely|test_user_action}}
-
|  
+
| action_id
-
| ?
+
| Used in the tutorial map to check for player events.<br />True if the specific action was done.
|-   
|-   
| DA
| DA
-
| {{a-certain|ui_effect}}
+
| {{a-certain|ui_indicate}}
| 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
Line 388: Line 483:
|-
|-
| E2
| E2
-
| {{a-likely|test_unit_selected}}
+
| {{a-likely|test_other_unit_selected}}
| unit_id
| unit_id
| true if unit with unit_id is selected
| true if unit with unit_id is selected
Line 395: Line 490:
| {{a-certain|test_mapmode}}
| {{a-certain|test_mapmode}}
| -
| -
-
| true if worldmap (spacebar) is displayed
+
| true if worldmap (spacebar) has been displayed
|-
|-
-
| E6
+
| E7
| {{a-guess|test_other_unit_status}}
| {{a-guess|test_other_unit_status}}
| unit_id
| unit_id
Line 406: Line 501:
| -
| -
| true if last "play" is still playing
| true if last "play" is still playing
 +
|-
 +
| ED
 +
| {{a-likely|end_mission}}
 +
| -
 +
| Display "End Mission" message
|-
|-
| EE
| EE
Line 411: Line 511:
| unit_id
| unit_id
| true if unit_id is dead
| true if unit_id is dead
-
|-
 
-
| ED
 
-
| {{a-likely|fail_mission}}
 
-
| -
 
-
| Display "End Mission" message
 
|-
|-
|colspan="4"|<div style="color:green;">likely and tested</div>
|colspan="4"|<div style="color:green;">likely and tested</div>

Revision as of 23:12, 10 August 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
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
sleep1
-
16
sleep2
- Call event handler if last statement was true
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
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