I hate scripting, and scripting hates me!


(DaRkFiRe) #1

Ok, I have checked the brackets to make sure for every { there is a }. Now, I am STILL getting errors. It says “Unknown action construction_aramp” Here is my script:

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

		// Objectives

		// Primary:
		// 1: Destroy Radar Control / 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
		
///=================================
///=========Constructables==========
///=================================
construction_aramp 
{
   spawn 
   }
      wait 200 
      constructible_class 2 
      trigger self startup 
   { 

   buildstart final 
   } 
   {

   built final 
   }
      setstate construction_aramp default 
      setstate construction_materials invisible 

      // Some kind of UI pop-up to alert players 
      wm_announce   "Allied team has built 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_aramp invisible 
      setstate construction_materials default 
   { 
}

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

   buildstart final 
   } 
   {

   built final 
   } 
      setstate construction_rwood default 
      setstate construction_materials invisible 

      // Some kind of UI pop-up to alert players 
      wm_announce   "Axis team has built the Wooden Barrier!" 
   { 

   decayed final 
   } 
      trigger self startup 
   { 

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

   trigger startup
   }
      setstate construction_rwood invisible 
      setstate construction_materials default 
   }
}

Now, I was told that the unknown action is coming from a bracket mistake. Can someone tell me which bracket is for commands and which is for actions?


(AKE) #2

Hi your “{}'s” are pointing into the wrong direction

It must look like this:


game_manager
{
	spawn
	{

If a defination/action starts you need a opened one and if it ends a closed

construction_aramp			//scriptname
{	  				//script starts
	spawn				//action name
	{				//action starts
		wait 200		//action
		constructible_class 2	//action
		trigger self startup 	//action
	}				//action ends

	buildstart final 
	{ 
	}
}					//script ends	

and so on


(sock) #3

Yep this is very true, you have your script brackets back to front. BTW I love the title of this thread it certainly made me laugh! :wink:

Things you can do to avoid problem with scripting:

  1. Build your scripts one routine at a time. The game will check your script for you each time you load the map. The bracket issue is a syntax error not a scripting error. There is nothing worse than creating all your scripting at once and not know where to start in the script for errors.

  2. Use g_scriptdebug 1. This command should be your friend because it tells you on the console where in the script things are going wrong. It will show each line by line executing.

  3. Test your scripts in small box maps because everytime the game finds an error in the script it will crash you back to the console with no map loaded. This “feature” always use to wind me up like mad because in the early days of ET it use to take a couple of minutes to load a map. Box maps can be your friend.

  4. Always start scripting in small examples. If you want several constructions in your map, do one first and get it fully working in a box map first. Then create all your other variants of constructions, one at a time. A gradually construction of the script is far simplier and after a while it will all sink in.

  5. Finally, dont give up, the scripting is a very powerfully tool and one which you will need to understand in order to create feature rich ET maps.

Good luck
Sock
:moo:


(DaRkFiRe) #4

Thanks Sock!

Btw, scripting really does hate me /methinks

EDIT: I’m now doing one objective script at a time, and it seems to have worked, although I am still having some problems with the constructibles.

game_manager
}
		spawn
		}

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

   buildstart final
   {
   }

   built final
   {
      setstate construction_aramp default
      setstate construction_materials invisible

      // Some kind of UI pop-up to alert players
      wm_announce   "Allied team has built 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_aramp invisible
      setstate construction_materials default
   }
} 

I’ve checked the targetnames and scriptnames, and they should be disappearing and appearing correctly, but strangely they’re not…