Thread: ≈ AI Help
View Single Post
Old 19.07.2007, 03:57   #8
Thalone
Архивный участник
 
Join Date: Feb 2005
Posts: 134
Default

awesome, thank you! 1 more question and i should be done... How exactly do i do arithmetic in AI? Im trying to follow HF's AI guide in the sticky section but unfortunately he doesnt add something like this.

this is what i need to do:
i0 = (((i1*3)+(i2*5))+(i3*10));

this is what im thinking it would look kind of like:

push_event
push_const 260 // i0
add
push_reg_sp
fetch_i
push_event
push_const 264 // i1
push_const 3
mul

but i dont know what comes next... shift_sp -2 ?

Thanks for the help!

This is what I have so far:

Code:
class 1 ancient_trader : citizen
parameter_define_begin
	string fnHi "aa_guy.htm"
	string fnDontHave "aa_guy_none.htm"
	string fnComplete "aa_guy_done.htm"
parameter_define_end
handler 3 12	//  TALKED
	variable_begin
		"talker"
		"myself"
		"_choiceN"
		"_code"
		"_from_choice"
	variable_end

        push_event      //  myself
        push_const 704
        add
        fetch_i
        push_event      //  talker
        push_const 40
        add
        fetch_i
        push_parameter fnHi
        func_call 184680516     //  func[ShowPage]
        shift_sp -2
        shift_sp -1
handler_end

handler 32 0	//  MENU_SELECTED
	variable_begin
		"talker"
		"myself"
		"i0"
		"i1"
		"i2"
		"i3"
		"i4"
		"i5"
		"reply"
		"_choiceN"
		"_code"
		"_from_choice"
	variable_end

	push_event	//  reply
	push_const 164
	add
	fetch_i4
	push_const 1
	equal
	branch_false L1


	push_event
	push_const 264 // i1
	add
	push_reg_sp
	fetch_i
	push_event
	push_const 704 // myself
	add
	fetch_i
	push_event
	push_const 40 // talker
	add
	fetch_i
	push_const 6360
	func_call 184680579 // OwnItemCount
	shift_sp -2
	assign4
	shift_sp -1

	push_event
	push_const 268 // i2
	add
	push_reg_sp
	fetch_i
	push_event
	push_const 704 // myself
	add
	fetch_i
	push_event
	push_const 40 // talker
	add
	fetch_i
	push_const 6361
	func_call 184680579 // OwnItemCount
	shift_sp -2
	assign4
	shift_sp -1

	push_event
	push_const 272 // i3
	add
	push_reg_sp
	fetch_i
	push_event
	push_const 704 // myself
	add
	fetch_i
	push_event
	push_const 40 // talker
	add
	fetch_i
	push_const 6362
	func_call 184680579 // OwnItemCount
	shift_sp -2
	assign4
	shift_sp -1

	push_const 6360
	push_const i1
	func_call 184746114	//  func[DeleteItem1]
	shift_sp -2

	push_const 6361
	push_const i2
	func_call 184746114	//  func[DeleteItem1]
	shift_sp -2

	push_const 6362
	push_const i3
	func_call 184746114	//  func[DeleteItem1]
	shift_sp -2

	push_const 5575
	push_const i0
	func_call 184746111	//  func[GiveItem1]
	shift_sp -2

L1
handler_end

class_end
Thalone is offline