View Single Post
Old 03.12.2005, 11:53   #1
krapno
Архивный участник
 
Join Date: May 2005
Posts: 368
Default AI, func[rand] usage and conditions

hello,

i am looking to understand how func[rand] works and how to use it with conditions, here the algo i want to do:

Select a random integer between 0 and 3 (i dunno if it is correct)
if result <=1 goto L1
if result =2 goto L2
if result >=3 goto L3


and here the syntax i suppose i have to use with AI:
Code:
L0
	push_parameter 3 // 0 to 3 ? 1 to 3 ?
	func_call 55   // func[Rand]

	push_const 1   // if result <= 1
	less_equal     // goto L1
	jump L1

	push_const 2   // if result = 2
	equal          // goto L2
	jump L2

	or

	push_const 3   // if result >= 3
	equal          // goto L3
	jump L3

	or
//---------------------------------------
L1
	(FUNCTIONS)
	jump L4 // goto end
L2
	(FUNCTIONS)
	jump L4 // end end
L3
	(FUNCTIONS)
	jump L4 // end end
//---------------------------------------
L4
	(EXIT HANDLER)
i dunno if it is correct and i would like to know, if it is possible, how to save the result of func[Rand] in a variable to use it in my FUNCTIONS parts for example.

Tx for your help
krapno is offline