Scripting Problems


(DaRkFiRe) #1

I am getting an error, something about an error on line 86; “}” expected, end of script found. Here is the script I am using.

//
// Map: Pearl Beach Invasion
// BSP: pearl_beta

game_manager
{
	spawn
	{
		// Game rules
		wm_axis_respawntime	30
		wm_allied_respawntime	20
		wm_number_of_objectives 5
		wm_set_round_timelimit	20

		// Objectives

		// Primary:
		// 1: Destroy/Defend Radar Controls
		// Secondary:
		// 2: Construct Beach Assault Ramp / Prevent Beach Assault Ramp
		// 3: Capture Forward Bunker / Defend Forward Bunker
		// 4: Allied command post 
		// 5: Axis command post
	
		wm_objective_status 1 0 0 // <objective team status>
		wm_objective_status 1 1 0 // status: 0 = default
		wm_objective_status 2 0 0 //		 1 = succeeded
		wm_objective_status 2 1 0 //		 2 = failed
		wm_objective_status 3 0 0
		wm_objective_status 3 1 0
		wm_objective_status 4 0 0
		wm_objective_status 4 1 0
		wm_objective_status 5 0 0
		wm_objective_status 5 1 0
		

		wm_set_main_objective		1	0
		wm_set_main_objective		1	1

		wait 50
		setautospawn	"Beach Landing"	1
		setautospawn	"Hills Bunker"	0

}
construction_aramp
{
   spawn
   {
      wait 200
      constructible_class 2
      trigger self startup
   }

   buildstart final
   {
   }

   built final
   {
      setstate construction_extra default
      setstate construction_aramp default
      setstate construction_materials invisible

      // Some kind of UI pop-up to alert players
      wm_announce   "Allied team has constructed the Assault Ramp!"
   }

   decayed final
   {
      trigger self startup
   }

   death
   {
      trigger self startup
      // Some kind of UI pop-up to alert players
      wm_announce   "Axis team has destroyed the Assault Ramp!"
   }

   trigger startup
   {
      setstate construction_extra invisible
      setstate construction_aramp invisible
      setstate construction_materials default
      }
} 

(chavo_one) #2

You need a ‘}’ for your game_manager spawn function.


(DaRkFiRe) #3

I have one :suspicious:


(chavo_one) #4

No you don’t. Try counting again.


(Ifurita) #5

As an exercise, print out your script and use a pen to draw a bracket connecting each pair of { and }. It will be come very apparent where your missing } is


(DaRkFiRe) #6

OH, I see what chavo is saying now :stuck_out_tongue: I have a bracket, but not the right kind!

Danke sehr chavo!


(Wils) #7

No, you’re missing a curly bracket completely. This is what your script should look like, I’ve highlighted the missing bracket with an arrow:

game_manager 
{ 
   spawn 
   { 
      // Game rules 
      wm_axis_respawntime   30 
      wm_allied_respawntime   20 
      wm_number_of_objectives 5 
      wm_set_round_timelimit   20 

      // Objectives 

      // Primary: 
      // 1: Destroy/Defend Radar Controls 
      // Secondary: 
      // 2: Construct Beach Assault Ramp / Prevent Beach Assault Ramp 
      // 3: Capture Forward Bunker / Defend Forward Bunker 
      // 4: Allied command post 
      // 5: Axis command post 
    
      wm_objective_status 1 0 0 // <objective team status> 
      wm_objective_status 1 1 0 // status: 0 = default 
      wm_objective_status 2 0 0 //       1 = succeeded 
      wm_objective_status 2 1 0 //       2 = failed 
      wm_objective_status 3 0 0 
      wm_objective_status 3 1 0 
      wm_objective_status 4 0 0 
      wm_objective_status 4 1 0 
      wm_objective_status 5 0 0 
      wm_objective_status 5 1 0 
       

      wm_set_main_objective      1   0 
      wm_set_main_objective      1   1 

      wait 50 
      setautospawn   "Beach Landing"   1 
      setautospawn   "Hills Bunker"   0 
   } <------- missing bracket
} 
construction_aramp 
{ 
   spawn 
   { 
      wait 200 
      constructible_class 2 
      trigger self startup 
   } 

   buildstart final 
   { 
   } 

   built final 
   { 
      setstate construction_extra default 
      setstate construction_aramp default 
      setstate construction_materials invisible 

      // Some kind of UI pop-up to alert players 
      wm_announce   "Allied team has constructed the Assault Ramp!" 
   } 

   decayed final 
   { 
      trigger self startup 
   } 

   death 
   { 
      trigger self startup 
      // Some kind of UI pop-up to alert players 
      wm_announce   "Axis team has destroyed the Assault Ramp!" 
   } 

   trigger startup 
   { 
      setstate construction_extra invisible 
      setstate construction_aramp invisible 
      setstate construction_materials default 
      } 
} 

A good way of minimising errors like this is by using a dedicated text editor such as TextPad or UltraEdit - they both have commands which match up brackets, so you can see where you’re missing one.


(DaRkFiRe) #8

Thats wierd… My script works fine now, save for the fact that nothing seems to wanna work… Maybe that may be the answer, but I’ll use Wils script regardless. Danke Wils!