Manipulating a specific object via Usecode
Posted: Wed Mar 12, 2003 9:09 am
I've created a town with walls and a front gate, but now I want the gate to be lifted when certain conditions are met, as triggered by conversation options with the guard. Here's how I tried to do it. It compiles and runs fine, but nothing happens:
var gate = UI_find_object( 1017, 681, 272, 0 );
UI_move_object( gate, 1017, 681, 4 );
for UI_find_object, the first two numbers are the x and y coordinates of the gate, the third number is the object number of the gate, and the last number is the frame number of the gate. I also tried x, y, and z coordinates with no success.
For UI_move_object, the first parameter should be the returned object, and the last 3 are the x, y and z coordinates. Am I using these API calls correctly? The Usecode debugging crud is included below, in case it helps. Looking through it, it seems like the problem might be with UI_find_object not finding my gate.
-Karl
---
[0x06]: remove_answer("Raise the gate") = 0000
01D8: addsi L063D ; Okay
01DB: say
01DC: pushi 0000H ; 0
01DF: pushi 0110H ; 272
01E2: pushi 02A9H ; 681
01E5: pushi 03F9H ; 1017
01E8: callis _find_object@4 ; 0029
[0x29]: find_object(03f9, 02a9, 0110, 0000) = 00000000
01EC: pop [0001] = 0000
01EF: pushi 0004H ; 4
01F2: pushi 02A9H ; 681
01F5: pushi 03F9H ; 1017
01F8: push [0001] = 00000000
01FB: calli _move_object@4 ; 003E
[0x3e]: move_object(00000000, 03f9, 02a9, 0004) = Probable attempt at getting int value of pointer!!
0000
01FF: jmp 009F
009F: startconv 0205
00A2: pushs L01E7 ; Bye
00A5: cmps 0001H, 00B0
00AA: jmp 0205
0205: endconv
0206: jmp 020C
020C: endconv
020D: push itemref
020E: calli _remove_npc_face@1 ; 0004
[0x04]: remove_npc_face(082d4f40) = 0000
0212: ret
var gate = UI_find_object( 1017, 681, 272, 0 );
UI_move_object( gate, 1017, 681, 4 );
for UI_find_object, the first two numbers are the x and y coordinates of the gate, the third number is the object number of the gate, and the last number is the frame number of the gate. I also tried x, y, and z coordinates with no success.
For UI_move_object, the first parameter should be the returned object, and the last 3 are the x, y and z coordinates. Am I using these API calls correctly? The Usecode debugging crud is included below, in case it helps. Looking through it, it seems like the problem might be with UI_find_object not finding my gate.
-Karl
---
[0x06]: remove_answer("Raise the gate") = 0000
01D8: addsi L063D ; Okay
01DB: say
01DC: pushi 0000H ; 0
01DF: pushi 0110H ; 272
01E2: pushi 02A9H ; 681
01E5: pushi 03F9H ; 1017
01E8: callis _find_object@4 ; 0029
[0x29]: find_object(03f9, 02a9, 0110, 0000) = 00000000
01EC: pop [0001] = 0000
01EF: pushi 0004H ; 4
01F2: pushi 02A9H ; 681
01F5: pushi 03F9H ; 1017
01F8: push [0001] = 00000000
01FB: calli _move_object@4 ; 003E
[0x3e]: move_object(00000000, 03f9, 02a9, 0004) = Probable attempt at getting int value of pointer!!
0000
01FF: jmp 009F
009F: startconv 0205
00A2: pushs L01E7 ; Bye
00A5: cmps 0001H, 00B0
00AA: jmp 0205
0205: endconv
0206: jmp 020C
020C: endconv
020D: push itemref
020E: calli _remove_npc_face@1 ; 0004
[0x04]: remove_npc_face(082d4f40) = 0000
0212: ret