Page 1 of 3
Scripting help :@
Posted: July 6th, 2012, 3:14 pm
by darkpheonixz4x
Hi, im new to scripting.
When i test my map, i receive the error "Script Compile Error: Bad Syntax {"
To be honest, i'm not sure what i've done wrong,
so if it's not too much trouble, could you please take a look at it? I really appreciate it.
I've attached the error and the script.
Thank you.
Code: Select all
main()
{
thread sound();
thread door_slider ();
}
door_slider()
{
door = getent( "door", "targetname" );
trig = getent( "doortrig", "targetname" );
while(true)
{
trig waittill ( "trigger" );
//wait 4;
door movez ( 94, 5, 0, 0.6 );
door waittill ( "movedone" );
wait 4;
//trig waittill ("trigger");
door movez( -94, 4, 0, 0.6 );
door waittill ( "movedone" ); {
}
}
sound()
{
trig = getent("sound_activate","targetname");
while(true)
{
trig waittill ( "trigger" );
musicplay ( "amb_dub" );
}
}
Re: Scripting help :@
Posted: July 6th, 2012, 3:19 pm
by Opel
Remove the open bracket from this line, it's not needed.
Re: Scripting help :@
Posted: July 6th, 2012, 3:24 pm
by darkpheonixz4x
Thank you so much for your immediate reply. This fixed the Bad Syntax error.
But now i am suddenly stuck with Script Runtime Error.
Again, much help is appreciated.
Sorry for being such a newbie

Re: Scripting help :@
Posted: July 6th, 2012, 3:36 pm
by darkpheonixz4x
I have rechecked that my trigger is a trigger_use, and that the targetname is set to sound_activate.
Im guessing that the line trig waittill ( "trigger" ) should be set to something else. :S
Re: Scripting help :@
Posted: July 6th, 2012, 3:38 pm
by darkpheonixz4x
I mean the targetname of the door trigger is set to doortrig*
Re: Scripting help :@
Posted: July 6th, 2012, 4:38 pm
by darkpheonixz4x
Still not working! arghhhhhhh! Any help?

Re: Scripting help :@
Posted: July 6th, 2012, 4:52 pm
by Rezil
Try remaking the trigger as a 'trigger_use_touch' and setting the targetname to something a bit more specific. The error says that the entity you are trying to get by using getEnt does not exist so you cannot call waittill("trigger") on it.
How did you create your trigger?
Re: Scripting help :@
Posted: July 6th, 2012, 5:04 pm
by darkpheonixz4x
I made a brush using the trigger texture, right clicked on the 2D grid trigger>trigger_use. Then added the entities. I will redo the whole trigger and get back to you. Thank you very much for your help <3.
Re: Scripting help :@
Posted: July 6th, 2012, 5:21 pm
by Vartazian
out of curiosity, is this a cj map?

Re: Scripting help :@
Posted: July 6th, 2012, 6:11 pm
by F |Madness| U
darkpheonixz4x wrote:I mean the targetname of the door trigger is set to doortrig*
You need to define the trigger in your script, doing so by:
Code: Select all
door_trigger = getent("doortrig", "targetname");
door_trigger can be named whatever you want, just so you recognise it in your script, however where doortrig is, you replace this by the targetname of the trigger in radiant.
After that..
should work fine
Re: Scripting help :@
Posted: July 6th, 2012, 7:56 pm
by Drofder2004
Code is fine (without { ). the problem is the mapped entity.
Open radiant. Select the trigger.
Press 'n'. Type "targetname" in the Key box, and type "doortrig" in the value box.
Re: Scripting help :@
Posted: July 6th, 2012, 9:17 pm
by F |Madness| U
KillerSam wrote:He already has that, no?
Didn't read it all or see that he already had that, was more explaining it to him in words since he said he's new to it.
Re: Scripting help :@
Posted: July 7th, 2012, 6:29 am
by darkpheonixz4x
Arghhhhhhh! Its still not working!
I followed what Rezil said and changed the trigger to an use_touch trigger. I also made the targetname = door_activator.
Here is my updated script.
Code: Select all
main()
{
thread sound();
thread door_slider ();
}
door_slider()
{
door = getent( "door", "targetname" );
door_trigger = getent( "door_activator", "targetname" );
while(true)
{
door_trigger waittill ( "trigger" );
//wait 4;
door movez ( 94, 5, 0, 0.6 );
door waittill ( "movedone" );
wait 4;
//trig waittill ("trigger");
door movez( -94, 4, 0, 0.6 );
door waittill ( "movedone" );
}
}
sound()
{
trig = getent("sound_activate","targetname");
while(true)
{
trig waittill ( "trigger" );
musicplay ( "amb_dub" );
}
}
And my entities for the trigger.
Sorry for troubling y'all so much!

Thanks for the help.

Re: Scripting help :@
Posted: July 7th, 2012, 6:43 am
by darkpheonixz4x
LOL the problem was i forgot to compile the BSP.
It works now. I cant thank you guys enough. Seriously, thank you sooo much <3.
Re: Scripting help :@
Posted: July 7th, 2012, 3:39 pm
by darkpheonixz4x
Man i can't catch a break

. *new error time*
I get the following error when i activate my trigger to play my ambient track: "alias amb_dub sound mp_mymapname/myfile.wav played as an ambient/music track is not streamed; type must be streamed"
PS - the folder and file isnt actually called mp_mymapname.. i said that for reference.
Any solutions? Anything you would like to see?