Page 1 of 1

Script

Posted: August 23rd, 2006, 4:24 pm
by YaNo
Well i tried to script for the first time and it didnt worked, i think just a little bug ='(
Here's what i did :) (for my new map jm_smooth_colour)

jm_smooth_colour.gsc:

Code: Select all

main()
{
	ambientPlay("ambient_mp_carentan");

	maps\mp\_load::main();
	maps\mp\blahsc::main();
	maps\mp\zzblah::main();

	game["allies"] = "american";
	game["axis"] = "german";

	game["american_soldiertype"] = "airborne";
	game["american_soldiervariation"] = "normal";
	game["german_soldiertype"] = "fallschirmjagergrey";
	game["german_soldiervariation"] = "normal";

	game["attackers"] = "allies";
	game["defenders"] = "axis";

}



in blahsc.gsc:

Code: Select all

main() 
{ 
  trigger = getent ("finnish","targetname"); 
  while(1) 
{ 
   trigger waittill ("trigger",user); 
   user iprintlnbold("^7Congratz! You Finnished");
   iprintln ("Congratz to " + user.name + " ^7for finnishing the map!"); 
   wait(1);
   user iprintlnbold("^7You can now kill yourself with a panzer...");
   wait(5); 
} 
}
in zzblah.gsc:

Code: Select all

main() 
{ 
  trigger = getent ("blah_trigger","targetname"); 
  while(1) 
{ 
   trigger waittill ("trigger",user); 
   user iprintlnbold("^7CoDJumper!!");
   iprintln ("Map By YaNo");
   wait(1);
   user iprintlnbold("^7For All Your Jumping Needs!");
   wait(1);
   user iprintlnbold("^7Visit ^1www.codjumper.com^7!");
   wait(5); 
} 
}
can some1 help me?

Posted: August 23rd, 2006, 4:34 pm
by Nightmare
what error does it give?

Posted: August 23rd, 2006, 4:36 pm
by Pedsdude
Indeed, we need to know what error it gave, and what you are trying to do (describe).

Btw, it's "finishing" not "finnishing" :)

Posted: August 23rd, 2006, 4:37 pm
by Drofder2004
/developer 1

Type that in console before running your map and then check console for the error.

Posted: August 23rd, 2006, 4:51 pm
by YaNo
it dont gives an error
when i trigger the zzblah it dont do anything, while the other works :s

Posted: August 23rd, 2006, 5:09 pm
by creator
gsv? isnt it gsc? :P

Posted: August 23rd, 2006, 5:12 pm
by YaNo
creator wrote:gsv? isnt it gsc? :P
ye lol =P i will edit ma post ^^
but they are all gsc ^^

Posted: August 23rd, 2006, 5:22 pm
by Pedsdude
I take it it's a trigger_multiple you're using.

Code: Select all

main()
{
thread zzblah();
}

zzblah()
{
  trigger = getent ("blah_trigger","targetname");
  while(1)
{
   trigger waittill ("trigger",user);
   user iprintlnbold("^7CoDJumper!!");
   iprintln ("Map By YaNo");
   wait(1);
   user iprintlnbold("^7For All Your Jumping Needs!");
   wait(1);
   user iprintlnbold("^7Visit ^1www.codjumper.com^7!");
   wait(5);
}
}
Try that, I prefer having it as thread to make life easier if you plan to add more threads to the same .gsc file.

Are you aware that "iprintln ("Map By YaNo");" will make it show "Map By YaNo" to everyone? People might get annoyed if that's spammed to them by people setting off the trigger. I would recommend making it only visible to the user.

Posted: August 23rd, 2006, 5:44 pm
by Drofder2004
Yeah just noticed, you didnt use thread.

If you do not thread it, then the rest of the script will not run.

Example...

maps\mp\blahsc::main();
maps\mp\zzblah::main();

Your script loads up blahsc::main.
Your main script in that gsc has an infinite loop. So zzblah will be waiting an inifinite amount of time to start.

If you use thread, then both of your threads will run at the same time.

Posted: August 23rd, 2006, 5:48 pm
by YaNo
well they are both use =D
going to test now

btw, thnx ^^

Posted: August 23rd, 2006, 5:55 pm
by Moriar
Yup, the threads :)


And sometimes if your triggers don't work, it could be the map ;) not the script ;)
I had that problem once, couldn't fix it :? I made the triggers both trigger_multiple, but they kept being brushes :shock: I deleted the triggers and replaced them by new triggers several times.....
But that didn't work either...
I still haven't fixed it but gladly it was a testmap :lol:

BTW: If it are the triggers they should be normal brushes, so you can stand on it and jump on it(if it's not too high :lol: )




This doesn't happen many times, but does anyone know why this happens?