| 
			
				|  | Castle Paradox 
 
 |  
 
	
		| View previous topic :: View next topic |  
		| Author | Message |  
		| binoal 
 
 
  
 Joined: 20 Jun 2009
 Posts: 123
 Location: My Own Little World
 
 | 
			
				|  Posted: Mon Aug 24, 2009 12:55 pm    Post subject: Debugging help pwease! 0.0 |   |  
				| 
 |  
				| this is on a sort of related note to my last topic on help. im working on my zelda game, and i am removing the OHR battle system, and actually restarting the entire thing. I am trying to make the sword scipt. It keeps saying it expected top level declaration but found end. i do often mess up the number of paranthesis, but i have looked over it multiple times and cant find the problem. Here's the script: 
  	  | Code: |  	  | include, plotscr.hsd include, Zelda.hsi
 
 global variable, begin
 1, AB
 2, CD
 3, EF
 4, GH
 end
 
 Plotscript, items, begin
 
 #sword
 if (key is pressed (44))
 
 then (
 
 suspend player
 
 set hero picture (0,1)
 
 AB:=NPC at spot (herofrontx,herofronty)
 
 create NPC (99,herofrontx,herofronty)
 
 wait(5)
 
 destroy NPC (99)
 
 if (get NPC ID (AB)==1)
 
 then (destroy NPC (AB))
 
 set hero picture (0,0)
 
 resume player
 
 )
 
 
 
 
 
 #bomb
 if ( Key is pressed(48) ) then ,begin
 
 Create Npc (98,hero X (0),hero y (0))
 
 Wait (30)
 
 change NPC ID (98,97)
 
 Wait (5)
 
 change NPC ID (97,96)
 
 AB:=NPC at spot (NPC X (96)+1, NPC y (96))
 
 CD:=NPC at spot (NPC X (96)--1, NPC y (96))
 
 EF:=NPC at spot (NPC X (96), NPC y (96)+1)
 
 GH:=NPC at spot (NPC X (96), NPC y (96)--1)
 
 
 
 If (  get NPC ID (AB) == 1 ) then ( destroy npc (AB) )
 If (  get NPC ID (CD) == 1 ) then ( destroy npc (CD) )
 If (  get NPC ID (EF) == 1 ) then ( destroy npc (EF) )
 If (  get NPC ID (GH) == 1 ) then ( destroy npc (GH) )
 
 If
 ((
 (hero x (0) <= NPC X (96)+1
 and
 hero x (0) >= (NPC X (96))--1)
 )
 and
 (
 (hero y (0) <= NPC Y (96)+1
 and
 hero Y (0) >= (NPC Y (96))--1)
 ))
 then
 
 (set hero stat (0,0,get hero stat (hero:link,0)--1)
 fade screen out (63,0,0)
 fade screen in )
 
 wait (3)
 destroy npc (96) )
 
 end, end
 
 
 script, herofrontx, begin
 if (hero direction(0)==up)
 then (exit returning (hero x))
 if (hero direction(0)==down)
 then (exit returning (hero x))
 if (hero direction(0)==left)
 then (exit returning (hero x--1)
 if (hero direction(0)==right)
 then (exit returning (hero x+1)
 end
 
 script, herofronty, begin
 if (hero direction(0)==up)
 then (exit returning (hero y--1))
 if (hero direction(0)==down)
 then (exit returning (hero y+1))
 if (hero direction(0)==left)
 then (exit returning (hero y)
 if (hero direction(0)==right)
 then (exit returning (hero y)
 end
 
 | 
 _________________
 Resident Evil RPG Demo
 
 http://www.castleparadox.com/gamelist-display.php?game=963
 
 Legend Of Zelda: Reptilian Warlord Demo
 
 http://www.castleparadox.com/gamelist-display.php?game=961
 |  |  
		| Back to top |  |  
		|  |  
		| Spoon Weaver 
 
 
  
 Joined: 18 Nov 2008
 Posts: 421
 Location: @home
 
 | 
			
				|  Posted: Mon Aug 24, 2009 2:05 pm    Post subject: |   |  
				| 
 |  
				| Simple. 
 You have 2 end's
 
 
  	  | Code: |  	  | end, end
 
 
 script, herofrontx, begin
 
 
 | 
 
 Remove one of them and that error message should go away.
 |  |  
		| Back to top |  |  
		|  |  
		| binoal 
 
 
  
 Joined: 20 Jun 2009
 Posts: 123
 Location: My Own Little World
 
 |  |  
		| Back to top |  |  
		|  |  
		| msw188 
 
 
 
 Joined: 02 Jul 2003
 Posts: 1041
 
 
 | 
			
				|  Posted: Mon Aug 24, 2009 6:40 pm    Post subject: |   |  
				| 
 |  
				| I think Spoonweaver's in the right area, but the problem is why do you have the second end parenthesis in the line right before: 
 
 
 The 'then' block from right before has concluded, and you have the two end's right after to take care of that script.  I'm pretty sure that that's the problem.
 _________________
 My first completed OHR game, Tales of the New World:
 http://castleparadox.com/gamelist-display.php?game=161
 
 This website link is for my funk/rock band, Euphonic Brew:
 www.euphonicbrew.com
 |  |  
		| Back to top |  |  
		|  |  
		| Spoon Weaver 
 
 
  
 Joined: 18 Nov 2008
 Posts: 421
 Location: @home
 
 | 
			
				|  Posted: Mon Aug 24, 2009 7:18 pm    Post subject: |   |  
				| 
 |  
				| The problem went deeper still.  I picked through it, edited it some, and got this version to compile.    you're welcome 
 
  	  | Code: |  	  | include, plotscr.hsd
 
 
 global variable, begin
 1, AB
 2, CD
 3, EF
 4, GH
 end
 
 Plotscript, items, begin
 
 #sword
 if (key is pressed (44)) then (
 
 suspend player
 
 set hero picture (0,1)
 
 AB:=NPC at spot (herofrontx,herofronty)
 
 create NPC (99,herofrontx,herofronty)
 
 wait(5)
 
 destroy NPC (99)
 
 if (get NPC ID (AB)==1) then (destroy NPC (AB))
 
 set hero picture (0,0)
 
 resume player
 
 )
 
 
 
 
 
 #bomb
 if ( Key is pressed(48) ) then ,begin
 
 Create Npc ( 98,hero X (0),hero y (0) )
 
 Wait (30)
 
 change NPC ID (98,97)
 
 Wait (5)
 
 change NPC ID (97,96)
 
 AB:=NPC at spot (NPC X (96)+1, NPC y (96)  )
 
 CD:=NPC at spot (NPC X (96)--1, NPC y (96) )
 
 EF:=NPC at spot (NPC X (96), NPC y (96)+1  )
 
 GH:=NPC at spot (NPC X (96), NPC y (96)--1 )
 
 
 
 If (  get NPC ID (AB) == 1 ) then ( destroy npc (AB) )
 If (  get NPC ID (CD) == 1 ) then ( destroy npc (CD) )
 If (  get NPC ID (EF) == 1 ) then ( destroy npc (EF) )
 If (  get NPC ID (GH) == 1 ) then ( destroy npc (GH) )
 
 If (
 ( (hero x (0) <= NPC X (96)+1) and ( hero x (0) >= (NPC X (96))--1 ) ) and ( (hero y (0) <= NPC Y (96)+1) and ( hero Y (0) >= (NPC Y (96)--1 ) ) )
 ) then (
 set hero stat ( 0,0,get hero stat (hero:link,0)--1 )
 fade screen out (63,0,0)
 fade screen in
 )
 
 wait (3)
 destroy npc (96)
 
 end,end
 
 
 script, herofrontx, begin
 if (hero direction(0)==up)
 then (exit returning (hero x))
 if (hero direction(0)==down)
 then (exit returning (hero x))
 if (hero direction(0)==left)
 then (exit returning (hero x--1))
 if (hero direction(0)==right)
 then (exit returning (hero x+1))
 end
 
 script, herofronty, begin
 if (hero direction(0)==up)
 then (exit returning (hero y--1))
 if (hero direction(0)==down)
 then (exit returning (hero y+1))
 if (hero direction(0)==left)
 then (exit returning (hero y))
 if (hero direction(0)==right)
 then (exit returning (hero y))
 end
 
 
 script, debug, begin
 end
 | 
 
 
 There was a problem with the part :
 
 
  	  | Code: |  	  | If (
 ( (hero x (0) <= NPC X (96)+1) and ( hero x (0) >= (NPC X (96))--1 ) ) and ( (hero y (0) <= NPC Y (96)+1) and ( hero Y (0) >= (NPC Y (96)--1 ) ) )
 
 | 
 
 which I fixed, also I added a debug script to make sure the last script had it's  ( 's  closed. Guess it wasn't that simple after all. Hope it's in working order now.
 |  |  
		| Back to top |  |  
		|  |  
		| binoal 
 
 
  
 Joined: 20 Jun 2009
 Posts: 123
 Location: My Own Little World
 
 |  |  
		| Back to top |  |  
		|  |  
		|  |  
  
	| 
 
 | You can post new topics in this forum You can reply to topics in this forum
 You cannot edit your posts in this forum
 You cannot delete your posts in this forum
 You cannot vote in polls in this forum
 
 |  
 Powered by phpBB © 2001, 2005 phpBB Group
 
 
 |