Post Pacific  

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

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 15.04.2006, 23:11   #1
m4rk
Архивный участник
 
Join Date: Jan 2006
Posts: 607
Default [HELP PLOX] Compiling error

I'm trying to do a teleporter that in exchange of an item gives you something back (it's mainly to make easier giving prices in events...)
However it gives me an error and just wont compile correctly

the nasc code:
Code:
class event_teleporter2 : teleporter
	{		
property:		
	TelPosList Position = {{1010006;15671;142994;-2704;8100}	
		;{1010013;83011;53207;-1470;11000}
		;{1010020;117088;76931;-2670;9400}};
	
	handler:
	EventHandler MENU_SELECTED(ask, reply, talker)
{
if(ask == 501 && reply == 501)
	{
	if(IsInCategory(@fighter_group, talker.occupation) && OwnItemCount(talker, @lottery_ticket) == 1)
		{
	if(talker.level < 20)
				{
				  DeleteItem1(talker, @lottery_ticket, 1);
					IncrementParam(talker, @PARAM_EXP, 55000);
					GiveItem1(talker, @adena, 80000);
					GiveItem1(talker, @soulshot_none, 400);
					GiveItem1(talker, @scroll_of_escape, 5);
					SoundEffect(talker, "ItemSound.quest_itemget");
				}
else if(talker.level >=20 && talker.level < 30)
	{
				 	DeleteItem1(talker, @lottery_ticket, 1));
					IncrementParam(talker, @PARAM_EXP, 200000);
					GiveItem1(talker, @adena, 120000);
					GiveItem1(talker, @soulshot_d, 600);
					GiveItem1(talker, @scroll_of_escape, 5);
					SoundEffect(talker, "ItemSound.quest_itemget");
	}
	}
	}
super;
}
the compiled ai (cutted because of wrong syntax)
"ERROR(120425) : syntax error"
line 120425 = else if(talker.level >=20 && talker.level < 30)
Code:
class event_teleporter2 : teleporter
property_define_begin
	telposlist_begin Position
		{"The Town of Dion"; 15671; 142994; -2704; 8100 }
		{"Oren Castle Town"; 83011; 53207; -1470; 11000 }
		{"Hunter Village"; 117088; 76931; -2670; 9400 }
	telposlist_end
property_define_end
handler 30	//  MENU_SELECTED
	variable_begin
		"ask"
		"reply"
		"talker"
		"myself"
		"_choiceN"
		"_code"
		"_from_choice"
	variable_end

	push_event	//  ask
	push_const 96
	add
	fetch_i
	push_const 501
	equal
	push_reg_sp
	fetch_i
	branch_false L26609
	push_event	//  reply
	push_const 100
	add
	fetch_i
	push_const 501
	equal
	and
L26609
	branch_false L26611
L26610
	shift_sp 1
	push_const 0
	push_event	//  talker
	push_const 32
	add
	fetch_i	//  occupation
	push_const 160
	add
	fetch_i
	func_call 112	//  func[IsInCategory]
	shift_sp -2
	push_reg_sp
	fetch_i
	branch_false L26612
	shift_sp 1
	push_event	//  talker
	push_const 32
	add
	fetch_i
	push_const 4442
	func_call 59	//  func[OwnItemCount]
	shift_sp -2
	push_const 1
	equal
	and
L26612
	branch_false L26614
L26613
	push_event	//  talker
	push_const 32
	add
	fetch_i	//  level
	push_const 776
	add
	fetch_i
	push_const 20
	less
	branch_false L26616
L26615
	shift_sp 1
	push_event	//  talker
	push_const 32
	add
	fetch_i
	push_const 4442
	push_const 1
	func_call 58	//  func[DeleteItem1]
	shift_sp -3
	shift_sp -1
	shift_sp 1
	push_event	//  talker
	push_const 32
	add
	fetch_i
	push_const 0
	push_const 55000
	func_call 137	//  func[IncrementParam]
	shift_sp -3
	shift_sp -1
	shift_sp 1
	push_event	//  talker
	push_const 32
	add
	fetch_i
	push_const 57
	push_const 80000
	func_call 55	//  func[GiveItem1]
	shift_sp -3
	shift_sp -1
	shift_sp 1
	push_event	//  talker
	push_const 32
	add
	fetch_i
	push_const 1835
	push_const 400
	func_call 55	//  func[GiveItem1]
	shift_sp -3
	shift_sp -1
	shift_sp 1
	push_event	//  talker
	push_const 32
	add
	fetch_i
	push_const 736
	push_const 5
	func_call 55	//  func[GiveItem1]
	shift_sp -3
	shift_sp -1
	shift_sp 1
	push_event	//  talker
	push_const 32
	add
	fetch_i
S6995.	"ItemSound.quest_itemget"
	push_string S6995
	func_call 139	//  func[SoundEffect]
	shift_sp -2
	shift_sp -1
	jump L26617
L26616
	push_event	//  talker
	push_const 32
	add
	fetch_i	//  level
	push_const 776
	add
	fetch_i
	push_const 20
	greater_equal
	push_reg_sp
	fetch_i
	branch_false L26618
	push_event	//  talker
	push_const 32
	add
	fetch_i	//  level
	push_const 776
	add
	fetch_i
	push_const 30
	less
	and
L26618
	branch_false L26620
L26619
	shift_sp 1
	push_event	//  talker
	push_const 32
	add
	fetch_i
	push_const 4442
	push_const 1
	func_call 58	//  func[DeleteItem1]
	shift_sp -3
m4rk is offline  
Old 16.04.2006, 02:41   #2
kvoxi
Архивный участник
 
Join Date: Oct 2005
Posts: 102
Default

try this syntax
if (expr) {...}
else {...}
kvoxi is offline  
Old 16.04.2006, 02:47   #3
Megatronpt
Архивный участник
 
Join Date: Jan 2006
Posts: 584
Default

Kvoxi, I'm trying to help him in finding the bug... and now I get this error, using your compiler

Code:
ERROR(2) : undefined super class[teleporter] at class [event_teleporter2] definition
Fail to compile, total error count = 1
Any ideas?

This is my first time experimenting NASC.
Megatronpt is offline  
Old 16.04.2006, 03:20   #4
Eanae
Архивный участник
 
Join Date: Jun 2005
Posts: 262
Default

Quote:
Originally Posted by Megatronpt
Kvoxi, I'm trying to help him in finding the bug... and now I get this error, using your compiler

Code:
ERROR(2) : undefined super class[teleporter] at class [event_teleporter2] definition
Fail to compile, total error count = 1
Any ideas?

This is my first time experimenting NASC.
that error is fine as long as event_teleporter2 will be in your compiled AI.

edit:

Code:
else if(talker.level) >=20 && (talker.level) < 30
Isn't that how it should go?
Eanae is offline  
Old 16.04.2006, 03:22   #5
Megatronpt
Архивный участник
 
Join Date: Jan 2006
Posts: 584
Default

Thx Eanae,

Got it compiled!

Now.. I have to speak with m4rk!
Megatronpt is offline  
Old 16.04.2006, 07:32   #6
hr
Архивный участник
 
Join Date: Jun 2005
Posts: 285
Default

Quote:
DeleteItem1(talker, @lottery_ticket, 1));
-AND-

Quote:
super;
}
} //closing bracket for class
open your eyes
hr is offline  
Old 16.04.2006, 11:16   #7
Megatronpt
Архивный участник
 
Join Date: Jan 2006
Posts: 584
Default

2 late hr, but thanks.

I got it corrected, last night.
Megatronpt 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 20:10.