Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 18.07.2007, 21:58   #1
Thalone
Архивный участник
 
Join Date: Feb 2005
Posts: 134
Default AI Help

ok so im making a seal stone converter. My question is now:

How do i get the output of this

push_const 6360
func_call 184680579 // func[OwnItemCount]

into a separate variable. such as "blue1"

Thanks for the help
Thalone is offline  
Old 18.07.2007, 22:10   #2
Forcer
Архивный участник
 
Join Date: Apr 2006
Posts: 554
Default

i don't understand.
You mean push_const 6360 as blue1?
Forcer is offline  
Old 18.07.2007, 22:15   #3
Thalone
Архивный участник
 
Join Date: Feb 2005
Posts: 134
Default

Im trying to convert this:

class ancient_trader : citizen {
handler:
EventHandler MENU_SELECTED(ask, i0, i1, i2, i3, reply, talker) {
if ((ask == 1) && (reply == 1)) {
i1 = OwnItemCount(talker, 6360);
i2 = OwnItemCount(talker, 6361);
i3 = OwnItemCount(talker, 6362);
i0 = (((i1*3)+(i2*5))+(i3*10));
if (i0 == 0) ShowPage(talker, "seal_stone_none.htm");
else {
GiveItem1(talker, @adena_of_ancient, i0);
DeleteItem1(talker, 6360, i1);
DeleteItem1(talker, 6361, i2);
DeleteItem1(talker, 6362, i3);
ShowPage(talker, "seal_stone_thx.htm");
}
}
}
}
Thalone is offline  
Old 19.07.2007, 00:15   #4
Sauron
Архивный участник
 
Join Date: Feb 2005
Posts: 357
Default

into what?
Sauron is offline  
Old 19.07.2007, 02:07   #5
FidoW
Архивный участник
 
Join Date: Sep 2005
Posts: 1,014
Default

ha... i know i saw that before...

https://postpacific.loc-online.com/f...eal_stone_none
FidoW is offline  
Old 19.07.2007, 02:40   #6
Thalone
Архивный участник
 
Join Date: Feb 2005
Posts: 134
Default

into C4 AI...
i cant figure out how to do this:
"i1 = OwnItemCount(talker, 6360);"
basicly use the function OwnItemCount and return the results into i1
Im horrible at AI so im using HF's guide but im stuck at that point
Thalone is offline  
Old 19.07.2007, 03:19   #7
Sauron
Архивный участник
 
Join Date: Feb 2005
Posts: 357
Default

ahh you want the compiled code.

"i1 = OwnItemCount(talker, 6360);" is something like this...

~~~~ this is C1 ~~~~

push_event
push_const 196 // i1
add
push_reg_sp
fetch_i
shift_sp 1
push_event
push_const 32 // talker
add
fetch_i
push_const 6360
func_call 81 // OwnItemCount
shift_sp -2
assign
shift_sp -1

~~~~ and this is C4 ~~~~

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
Sauron is offline  
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  
Old 19.07.2007, 04:49   #9
Sauron
Архивный участник
 
Join Date: Feb 2005
Posts: 357
Default

you need 2 variables or const and an operator

(((i1*3)+(i2*5))+(i3*10)) would be

i1 3 * i2 5 * + i3 10 * +

push_event // i0
push_const 260
add
push_reg_sp
fetch_i
push_event // i1
push_const 264
add
fetch_i4
push_const 3
mul
push_event // i2
push_const 268
add
fetch_i4
push_const 5
mul
add
push_event // i3
push_const 272
add
fetch_i4
push_const 10
mul
add
assign4
shift_sp -1

Code:
class 1 ancient_trader : citizen
handler 32 202	//  MENU_SELECTED
	variable_begin
		"ask"
		"i0"
		"i1"
		"i2"
		"i3"
		"reply"
		"talker"
		"myself"
		"_choiceN"
		"_code"
		"_from_choice"
	variable_end

	push_event	//  ask
	push_const 160
	add
	fetch_i4
	push_const 1
	equal
	push_reg_sp
	fetch_i
	branch_false L3
	push_event	//  reply
	push_const 164
	add
	fetch_i4
	push_const 1
	equal
	and
L3
	branch_false L2
L1
	push_event	//  i1
	push_const 264
	add
	push_reg_sp
	fetch_i
	push_event	//  myself
	push_const 704
	add
	fetch_i
	push_event	//  talker
	push_const 40
	add
	fetch_i
	push_const 6360
	func_call 184680579	//  func[OwnItemCount]
	shift_sp -2
	assign4
	shift_sp -1
	push_event	//  i2
	push_const 268
	add
	push_reg_sp
	fetch_i
	push_event	//  myself
	push_const 704
	add
	fetch_i
	push_event	//  talker
	push_const 40
	add
	fetch_i
	push_const 6361
	func_call 184680579	//  func[OwnItemCount]
	shift_sp -2
	assign4
	shift_sp -1
	push_event	//  i3
	push_const 272
	add
	push_reg_sp
	fetch_i
	push_event	//  myself
	push_const 704
	add
	fetch_i
	push_event	//  talker
	push_const 40
	add
	fetch_i
	push_const 6362
	func_call 184680579	//  func[OwnItemCount]
	shift_sp -2
	assign4
	shift_sp -1
	push_event	//  i0
	push_const 260
	add
	push_reg_sp
	fetch_i
	push_event	//  i1
	push_const 264
	add
	fetch_i4
	push_const 3
	mul
	push_event	//  i2
	push_const 268
	add
	fetch_i4
	push_const 5
	mul
	add
	push_event	//  i3
	push_const 272
	add
	fetch_i4
	push_const 10
	mul
	add
	assign4
	shift_sp -1
	push_event	//  i0
	push_const 260
	add
	fetch_i4
	push_const 0
	equal
	branch_false L5
L4
	push_event	//  myself
	push_const 704
	add
	fetch_i
	push_event	//  talker
	push_const 40
	add
	fetch_i
S1.	"seal_stone_none.htm"
	push_string S1
	func_call 184680516	//  func[ShowPage]
	shift_sp -2
	shift_sp -1
	jump L6
L5
	push_event	//  myself
	push_const 704
	add
	fetch_i
	push_event	//  talker
	push_const 40
	add
	fetch_i
	push_const 5575
	push_event	//  i0
	push_const 260
	add
	fetch_i4
	func_call 184746111	//  func[GiveItem1]
	shift_sp -3
	shift_sp -1
	push_event	//  myself
	push_const 704
	add
	fetch_i
	push_event	//  talker
	push_const 40
	add
	fetch_i
	push_const 6360
	push_event	//  i1
	push_const 264
	add
	fetch_i4
	func_call 184746114	//  func[DeleteItem1]
	shift_sp -3
	shift_sp -1
	push_event	//  myself
	push_const 704
	add
	fetch_i
	push_event	//  talker
	push_const 40
	add
	fetch_i
	push_const 6361
	push_event	//  i2
	push_const 268
	add
	fetch_i4
	func_call 184746114	//  func[DeleteItem1]
	shift_sp -3
	shift_sp -1
	push_event	//  myself
	push_const 704
	add
	fetch_i
	push_event	//  talker
	push_const 40
	add
	fetch_i
	push_const 6362
	push_event	//  i3
	push_const 272
	add
	fetch_i4
	func_call 184746114	//  func[DeleteItem1]
	shift_sp -3
	shift_sp -1
	push_event	//  myself
	push_const 704
	add
	fetch_i
	push_event	//  talker
	push_const 40
	add
	fetch_i
S2.	"seal_stone_thx.htm"
	push_string S2
	func_call 184680516	//  func[ShowPage]
	shift_sp -2
	shift_sp -1
L6
L2
handler_end

class_end
Sauron is offline  
Old 19.07.2007, 05:29   #10
Thalone
Архивный участник
 
Join Date: Feb 2005
Posts: 134
Default

You are awesome! Thank you very much!
Thalone is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 17:14.