View Single Post
Old 03.05.2007, 07:28   #12
forsage
Архивный участник
 
Join Date: Oct 2006
Posts: 17
Default

Thanks !
This is very good information
So , I little changed my task.
If attacker's level > 10 , there will be "text 1" message, and else, "text 2" message.

ai code:
Code:
class 1 test : (null)

handler 1 12
	variable_begin
		"attacker"
		"damage"
		"myself"
		"_choiceN"
		"_code"
		"_from_choice"
	variable_end

	push_event	
	push_const 48
	add
	fetch_i
	push_const 1092
	add
	fetch_i4
	push_const 10
	greater
	branch_false L101
L100

	push_event
	push_const 704
	add
	fetch_i
S100.	"Text 1"
	push_string S100
	func_call 184614973
	shift_sp -1
	jump L102
L101
	push_event
	push_const 704
	add
	fetch_i
S101.	"Text 2"
	push_string S101
	func_call 184614973
	shift_sp -1
L102
handler_end
class_end
Is it right ?

One another question, what difference between fetch_i4 and fetch_i ?
If I change fetch_i4 at fetch_i , the result of decompiler as the same:

Code:
class test : (null)
{
handler:
	EventHandler ATTACKED(attacker,damage)
	{
		if( ( attacker + 1092 ) > 10 )
		{
			myself->Say("Text 1");
		}
		else
		{
			myself->Say("Text 2");
		}
	}

}
forsage is offline