Doom3world

The world is yours! Doom 3 - Quake 4 - ET:QW - Prey - Rage
It is currently Sat May 18, 2013 11:49 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: func_movers not responding to script commands
PostPosted: Tue Apr 03, 2012 10:27 am 
Offline
picked up a pistol

Joined: Thu Oct 13, 2011 4:09 pm
Posts: 74
First post, but I have been reading Doom3World for over six months. Have thus far been able to figure everything I needed out via the tutorials / Q&As / Google searches / reverse engineering, etc.

Anyway, so I have three questions:

(1) I have three func_movers that work fine as threads (if I delete the sys.waitFor commands), or work fine on their own. But as soon as I put all three of them in my script, as sequential events, they (seem) to cancel each other out. Map runs, no errors, func_movers do not rotate. The system even prints my messages.

My code is posted at the end of these three questions.

(2) How do I trigger these func_movers? I want them to start when the player passes through a trigger_once brush. If this is answered elsewhere, please post the link.

(3) I need a text editor with syntax highlighting for scripts. Does anyone know if there's an Emacs mod for that? If not, any active links for a syntax-highlighting .script text editor? I can enter the script editor in Doom 3 by entering "editDecls" in the console, but it only lets me modify id scripts, not my own.

MY CODE FOR (1)

//function that binds the light to the cube

void setup_objects ()
{
$light_51551.bind ($func_door_10);
$light_51520.bind ($cube);
$func_mover_1.bind ($func_door_5);
$func_mover_3.bind ($func_door_1);
$func_mover_5.bind ($func_door_1);
$func_mover_4.bind ($func_door_5);
$handle3.bind ($func_door_7);
$handle4.bind ($func_door_8);
}

//functions that rotate the cube and pyramids once 360 degrees

void pyramid1_rotate ()
{
$pyramid1.accelTime(3);
$pyramid1.decelTime(2);
$pyramid1.time (5);

sys.waitFor($pyramid1);

}

void pyramid2_rotate ()
{

$pyramid2.accelTime(3);
$pyramid2.decelTime(2);
$pyramid2.time (5);

sys.waitFor($pyramid2);

}


void cube_rotate ()
{

$cube.accelTime(3);
$cube.decelTime(2);
$cube.time (5);

sys.waitFor ($cube);
}

//function that executes when the script is loaded

void main ()
{
setup_objects();

sys.print ("rotating pyramid 1");

pyramid1_rotate();

sys.print ("rotating pyramid 2");

pyramid2_rotate();

sys.print ("rotating cube");

cube_rotate();

}


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Tue Apr 03, 2012 1:28 pm 
Offline
picked up 200 ammo
User avatar

Joined: Sun Jul 20, 2008 4:49 pm
Posts: 201
Code:
void pyramid1_rotate ()
{
$pyramid1.accelTime(3);
$pyramid1.decelTime(2);
$pyramid1.time (5);

sys.waitFor($pyramid1);

}

But where's the rotateOnce command? This script sets acceleration, deceleration and rotation times, but don't tell the pyramid to actually rotate.

Add this after $pyramid1.time (5); change the numbers to make it rotate as you want it to. Do the same with other objects.
Code:
$pyramid1.rotateOnce('0 0 90');

Beyond Within wrote:
I want them to start when the player passes through a trigger_once brush.

In trigger_once add key "call" with value "main", it will call your script which rotates them.

_________________
Use This To Refresh Yourself Before Working | Read This Before Posting At Doom3World
Accept criticism or you'll never improve and will blame others for your fails.
If there's no proof that you're right, you're wrong.


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Tue Apr 03, 2012 3:04 pm 
Offline
picked up a pistol

Joined: Thu Oct 13, 2011 4:09 pm
Posts: 74
Thanks, that worked.

Quote:
In trigger_once add key "call" with value "main", it will call your script which rotates them.


(1) I'd like the func_movers to rotate sequentially after I hit the trigger. Before I added the trigger, they did run in sequence (the waitFor script events worked). With the trigger, the three func_movers started at the same time.

(2) But ultimately I do not want to call everything in the main (I want setup_objects to run at map load). I made pyramid1_rotate the value to the "call" key, and that successfully isolated pyramid1_rotate (having deleted all three func_movers from the main). However, I don't know how to add the others. Putting pyramid2_rotate and cube_rotate into the main, leaving pyramid1_rotate to be triggered, caused pyramid2_rotate and cube_rotate to ignore their respective waitFor ($pyramid1) and waitFor ($pyramid2) script events.


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Tue Apr 03, 2012 5:22 pm 
Offline
picked up 200 ammo
User avatar

Joined: Sun Jul 20, 2008 4:49 pm
Posts: 201
I would just put all rotations in one script, like this:
Code:
void rotate_all ()
{
$pyramid1.accelTime(3);
$pyramid1.decelTime(2);
$pyramid1.time (5);
$pyramid1.rotateOnce('0 0 90');
sys.waitFor($pyramid1);
$pyramid2.accelTime(3);
$pyramid2.decelTime(2);
$pyramid2.time (5);
$pyramid2.rotateOnce('0 0 90');
sys.waitFor($pyramid2);
$cube.accelTime(3);
$cube.decelTime(2);
$cube.time (5);
$cube.rotateOnce('0 0 90');
sys.waitFor ($cube);
}


Alternatively, you may try to move waitFors to main, but I don't know if that would work:
Code:
void main ()
{
setup_objects();
sys.print ("rotating pyramid 1");
pyramid1_rotate();
sys.waitFor($pyramid1);
sys.print ("rotating pyramid 2");
pyramid2_rotate();
sys.waitFor($pyramid2);
sys.print ("rotating cube");
cube_rotate();
sys.waitFor ($cube);
}

_________________
Use This To Refresh Yourself Before Working | Read This Before Posting At Doom3World
Accept criticism or you'll never improve and will blame others for your fails.
If there's no proof that you're right, you're wrong.


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Tue Apr 03, 2012 6:14 pm 
Offline
King of the Hill
User avatar

Joined: Thu May 05, 2005 11:38 am
Posts: 1325
Location: Gold Coast, Australia
NX-317 wrote:
I would just put all rotations in one script, like this:
Code:
void rotate_all ()
{
$pyramid1.accelTime(3);
$pyramid1.decelTime(2);
$pyramid1.time (5);
$pyramid1.rotateOnce('0 0 90');
sys.waitFor($pyramid1);
$pyramid2.accelTime(3);
$pyramid2.decelTime(2);
$pyramid2.time (5);
$pyramid2.rotateOnce('0 0 90');
sys.waitFor($pyramid2);
$cube.accelTime(3);
$cube.decelTime(2);
$cube.time (5);
$cube.rotateOnce('0 0 90');
sys.waitFor ($cube);
}
I was going to suggest the same thing :)

However another option would be to use another function to call each mover

Code:
void triggerMovers()
{
sys.print ("rotating pyramid 1");
pyramid1_rotate();
sys.waitFor( $pyramid1 );

sys.print ("rotating pyramid 2");
pyramid2_rotate();
sys.waitFor( $pyramid2 );

sys.print ("rotating cube");
cube_rotate();   
sys.waitFor( $cube );

}
Doing it that way will allow you to trigger each mover independently if you want to, or modify the script however you may want without affecting the movers themselves.

On another note, to help you find more available functions try having a look through the events.script file (found in the /scripts/ directory of whichever .pk4 file contains it :) ). It has a detailed list of all the available functions for entities all grouped up with handy descriptions.

_________________
-bkt


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Wed Apr 04, 2012 12:06 pm 
Offline
picked up a pistol

Joined: Thu Oct 13, 2011 4:09 pm
Posts: 74
Thanks for all the help.

Quote:
However another option would be to use another function to call each mover


This best fit the aims of my map, though the other suggestions will be useful later. The pyramids are closely connected, while the cube is in a different room. So dedicating a function to the pyramids is the right way to organize my script events.

Quote:
On another note, to help you find more available functions try having a look through the events.script file (found in the /scripts/ directory of whichever .pk4 file contains it :) ). It has a detailed list of all the available functions for entities all grouped up with handy descriptions.


Very useful. I knew there had to be something like this somewhere. Modwiki is great, but crude, unrefined ore.

MORE QUESTIONS

(1) What would be the most efficient way to trigger a bunch of lights to turn on in sequence? Via scripts, of course. I did this successfully with a trigger_once + relay, but it clutters the geometry in my map, and makes brush / entity management difficult. I want to clean this mess up.

(2) I'd like a sound to be triggered every time I pass over a particular surface (a small tile on the ground), but I do not want the sound to repeat if I stay standing on it. So I want a multiple trigger that only triggers once while I am inside. Was able to get everything but that bolded bit to work. A script solution, again, is best.

. . .

I love Doom 3 and want to chainsaw anyone who says otherwise. The most underrated game of all time. Mars City Underground should be in an art museum.


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Fri Apr 06, 2012 8:27 am 
Offline
is sad because his cool title went away
User avatar

Joined: Tue Sep 07, 2004 6:23 pm
Posts: 709
Location: Bracknell UK
Quote:
(1) What would be the most efficient way to trigger a bunch of lights to turn on in sequence? Via scripts, of course. I did this successfully with a trigger_once + relay, but it clutters the geometry in my map, and makes brush / entity management difficult. I want to clean this mess up.


Call a function from your trigger that loops through all your lights turning them on. Most efficient would most likely be to name them all in sequence e.g $myLightSequence#, where # is a number 1 to how ever many and loop through with a for loop. e.g
Code:
void lightSequence(){
  for(int n=1;n<10;n++){
    entity light = sys.getEntity("myLightSequence"+n);
    light.On;
    sys.wait(1);
  }
}



Quote:
(2) I'd like a sound to be triggered every time I pass over a particular surface (a small tile on the ground), but I do not want the sound to repeat if I stay standing on it. So I want a multiple trigger that only triggers once while I am inside. Was able to get everything but that bolded bit to work. A script solution, again, is best.


You can disable a trigger by using $myTrigger.disable and .enable to reenable it. Make your trigger call a function that disables your trigger and plays your sound. Then you would need another set of triggers around your original to reenable it once youve stepped of the tile, these would need to start off disabled.
Quick test map
Script
Code:
/* will need 4 outter triggers if your tile is in the middle of open ground
this function is used to both enable and disable these 4 triggers */
void enableoutters(boolean enab){
  float n;
  for(n=1;n<5;n++){
    entity outter = sys.getEntity(("myouttertrigger"+n));
    if (enab){
      outter.enable();
    }else{
      outter.disable();
    }
  }
}

void triggerSound(){        //called from your trigger on the tile
  $mysoundtrigger.disable();    //disable tile trigger
  sys.trigger(sys.getEntity("mySpeaker"));    //trigger speaker or link to trigger or play sound here
  enableoutters(1);   //enable outter triggers
}

void myouttertrigger(){   //called from outter triggers
  enableoutters(0);   //disable outter triggers
  $mysoundtrigger.enable();   //reenable tile trigger
}

void main(){
  sys.setcvar("g_showtriggers","1");    //just for testing so you can see the triggers
 
  enableoutters(0);  //disable outter triggers from start of map
}

Map
Code:
Version 2
// entity 0
{
"classname" "worldspawn"
// primitive 0
{
brushDef3
{
  ( -1 0 0 -440 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 1 -8 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 -1 0 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 1 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 1 0 0 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 1
{
brushDef3
{
  ( -1 0 0 -440 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 1 0 -336 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 1 -8 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 1 0 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 -1 0 64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 2
{
brushDef3
{
  ( 0 1 0 -336 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 1 0 0 -488 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 1 -8 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 -1 0 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( -1 0 0 64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 3
{
brushDef3
{
  ( -1 0 0 -440 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 1 0 0 -488 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 -1 0 -264 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 1 -8 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 1 0 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 4
{
brushDef3
{
  ( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_diafloor_1b_fin" 0 0 0
  ( 0 0 1 -8 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_diafloor_1b_fin" 0 0 0
  ( 0 -1 0 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_diafloor_1b_fin" 0 0 0
  ( 1 0 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_diafloor_1b_fin" 0 0 0
  ( 0 1 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_diafloor_1b_fin" 0 0 0
  ( -1 0 0 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_diafloor_1b_fin" 0 0 0
}
}
// primitive 5
{
brushDef3
{
  ( -1 0 0 -440 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 1 0 -336 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 1 0 0 -488 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 -1 0 -264 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 1 -256 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 -1 248 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 6
{
brushDef3
{
  ( -1 0 0 -440 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 1 0 0 -488 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 -1 0 -264 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 1 -256 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 1 0 256 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 7
{
brushDef3
{
  ( 0 1 0 -336 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 1 0 0 -488 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 -1 0 -264 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 1 -256 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( -1 0 0 480 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 8
{
brushDef3
{
  ( -1 0 0 -440 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 1 0 -336 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 1 0 0 -488 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 1 -256 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 -1 0 328 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 9
{
brushDef3
{
  ( -1 0 0 -440 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 1 0 -336 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 -1 0 -264 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 1 -256 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
  ( 1 0 0 432 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
}
// entity 1
{
"classname" "trigger_multiple"
"name" "myouttertrigger1"
"model" "myouttertrigger1"
"origin" "32 64 24"
"call" "myouttertrigger"
// primitive 0
{
brushDef3
{
  ( 0 -1 0 32 ) ( ( 0.0625 0 56 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( 1 0 0 -64 ) ( ( 0.0625 0 -2 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( -1 0 0 -64 ) ( ( 0.0625 0 2 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( 0 1 0 -40 ) ( ( 0.0625 0 -56 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( 0 0 1 -24 ) ( ( 0.0625 0 -2 ) ( 0 0.0625 56 ) ) "textures/common/trigmulti" 0 0 0
  ( 0 0 -1 -16 ) ( ( 0.0625 0 -2 ) ( 0 0.0625 -56 ) ) "textures/common/trigmulti" 0 0 0
}
}
}
// entity 2
{
"classname" "speaker"
"name" "mySpeaker"
"origin" "32 32 40"
"s_waitfortrigger" "1"
"s_shader" "char_sentry_active"
}
// entity 3
{
"classname" "light"
"name" "light_1"
"origin" "40 8 120"
"light_radius" "796 492 264"
}
// entity 4
{
"classname" "info_player_start"
"name" "info_player_start_1"
"origin" "-376 -216 8"
"angle" "45"
}
// entity 5
{
"classname" "trigger_multiple"
"name" "mysoundtrigger"
"model" "mysoundtrigger"
"origin" "32 32 8"
"call" "triggerSound"
// primitive 0
{
brushDef3
{
  ( 0 0 -1 0 ) ( ( 0.0625 0 0 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( 0 0 1 -8 ) ( ( 0.0625 0 0 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( 0 -1 0 -32 ) ( ( 0.0625 0 0 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( 1 0 0 -32 ) ( ( 0.0625 0 0 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( 0 1 0 -32 ) ( ( 0.0625 0 0 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( -1 0 0 -32 ) ( ( 0.0625 0 0 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
}
}
}
// entity 6
{
"classname" "trigger_multiple"
"name" "myouttertrigger3"
"model" "myouttertrigger3"
"origin" "32 -72 24"
"call" "myouttertrigger"
// primitive 0
{
brushDef3
{
  ( 0 0 -1 -16 ) ( ( 0.0625 0 6.5 ) ( 0 0.0625 -56 ) ) "textures/common/trigmulti" 0 0 0
  ( 0 0 1 -24 ) ( ( 0.0625 0 6.5 ) ( 0 0.0625 56 ) ) "textures/common/trigmulti" 0 0 0
  ( 0 1 0 -40 ) ( ( 0.0625 0 -56 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( -1 0 0 -64 ) ( ( 0.0625 0 -6.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( 1 0 0 -64 ) ( ( 0.0625 0 6.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( 0 -1 0 32 ) ( ( 0.0625 0 56 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
}
}
}
// entity 7
{
"classname" "trigger_multiple"
"name" "myouttertrigger2"
"model" "myouttertrigger2"
"origin" "112 -8 24"
"call" "myouttertrigger"
// primitive 0
{
brushDef3
{
  ( 0 0 -1 -16 ) ( ( 0.0625 0 2.5 ) ( 0 0.0625 -51 ) ) "textures/common/trigmulti" 0 0 0
  ( 0 0 1 -24 ) ( ( 0.0625 0 2.5 ) ( 0 0.0625 51 ) ) "textures/common/trigmulti" 0 0 0
  ( 0 1 0 -104 ) ( ( 0.0625 0 -51 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( -1 0 0 -16 ) ( ( 0.0625 0 -2.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( 1 0 0 8 ) ( ( 0.0625 0 2.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( 0 -1 0 -24 ) ( ( 0.0625 0 51 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
}
}
}
// entity 8
{
"classname" "trigger_multiple"
"name" "myouttertrigger4"
"model" "myouttertrigger4"
"origin" "-24 -8 24"
"call" "myouttertrigger"
// primitive 0
{
brushDef3
{
  ( 0 0 -1 -16 ) ( ( 0.0625 0 2.5 ) ( 0 0.0625 -59.5 ) ) "textures/common/trigmulti" 0 0 0
  ( 0 0 1 -24 ) ( ( 0.0625 0 2.5 ) ( 0 0.0625 59.5 ) ) "textures/common/trigmulti" 0 0 0
  ( 0 1 0 -104 ) ( ( 0.0625 0 -59.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( -1 0 0 -16 ) ( ( 0.0625 0 -2.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( 1 0 0 8 ) ( ( 0.0625 0 2.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
  ( 0 -1 0 -24 ) ( ( 0.0625 0 59.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
}
}
}



Hope that helps, easiest way i could think of doing it.


Top
 Profile  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Fri Apr 06, 2012 5:12 pm 
Offline
picked up a pistol

Joined: Thu Oct 13, 2011 4:09 pm
Posts: 74
During the interim before your reply, I did figure out how to script the light sequence, but my solution is nowhere near as compact and elegant as yours.

Appreciate the detailed response. You guys don't mess around here. That map will come in handy, though I need to address the lights first. Some questions about programming.

I need some of your code broken down; I am completely new to scripting -- and, indeed, programming at large. To get a sense of how new I am, here's what I did. Maybe it will help with the explanation, too.

Code:
void lights_on ()

{
   sys.trigger ($light_5351);
   sys.waitFor ($light_5351);
   sys.wait (2);

   sys.trigger ($light_5382);
   sys.waitFor ($light_5382);
   sys.wait (2);

   sys.trigger ($light_5384);
   sys.waitFor ($light_5384);
   sys.wait (2);

   sys.trigger ($light_5386);
   sys.waitFor ($light_5386);
   sys.wait (2);

}


Can you explain how for loops work? What do these three expressions do / mean:

Code:
int n=1; n<10;n++


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Fri Apr 06, 2012 5:42 pm 
Offline
picked up 75 health

Joined: Mon Nov 28, 2011 4:30 pm
Posts: 85
Beyond Within wrote:
Can you explain how for loops work? What do these three expressions do / mean:

Code:
int n=1; n<10;n++


http://en.wikipedia.org/wiki/For_loop

Simple, and other kinds of loops:
http://www.cprogramming.com/tutorial/lesson3.html


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Fri Apr 06, 2012 6:19 pm 
Offline
picked up a pistol

Joined: Thu Oct 13, 2011 4:09 pm
Posts: 74
I had looked at the Wikipedia, but it was too broad / cursory / esoteric.

The second reference you cited is perfect though. Thanks.

Just right for beginners.


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Tue Apr 10, 2012 2:19 am 
Offline
picked up a pistol

Joined: Thu Oct 13, 2011 4:09 pm
Posts: 74
Is there a more elegant way of moving lights than binding them to func_movers?


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Tue Apr 10, 2012 3:08 am 
Offline
a gun & a nice word
User avatar

Joined: Sat Jan 11, 2003 9:30 pm
Posts: 8712
Location: Orlando, FL
I'm pretty sure you can use move, moveTo, moveToPos events and the like with lights. But I could be mistaken about that.

_________________
Image Staff
Learn something today? Why not write an article about it on modwiki.net?


Top
 Profile  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Tue Apr 10, 2012 8:16 pm 
Offline
picked up a pistol

Joined: Thu Oct 13, 2011 4:09 pm
Posts: 74
Is there a way to declare a vector with variables? I keep getting "expected float value" errors with code like this:

Code:
void movement_vars()

{
   entity object = $box;

   vector origin = object.getOrigin();

   float ox, oy, oz;
   float oup, odown;

   ox = origin_x;
   oy = origin_y;
   oz = origin_z;
   
   oup = ox+10;
   odown = ox-10;

   vector up = 'ox oy oup';
   vector down = 'ox oy odown';

}


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Tue Apr 10, 2012 8:45 pm 
Offline
Last man standing
User avatar

Joined: Thu Aug 19, 2004 7:22 pm
Posts: 1123
I don't think so but you could do it like this:
Code:
void movement_vars() {
   entity object = $box;

   vector origin = object.getOrigin();

   vector up = origin + '10 0 0';
   vector down = origin - '10 0 0';
}


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Wed Apr 11, 2012 4:09 pm 
Offline
King of the Hill
User avatar

Joined: Thu May 05, 2005 11:38 am
Posts: 1325
Location: Gold Coast, Australia
Beyond Within wrote:
Is there a way to declare a vector with variables? I keep getting "expected float value" errors with code like this:

Code:
void movement_vars()

{
   entity object = $box;

   vector origin = object.getOrigin();

   float ox, oy, oz;
   float oup, odown;

   ox = origin_x;
   oy = origin_y;
   oz = origin_z;
   
   oup = ox+10;
   odown = ox-10;

   vector up = 'ox oy oup';
   vector down = 'ox oy odown';

}
Another way I've done similar things is to use a non-solid target_null entity (with a nodraw texture applied) to represent move positions. You then simply set the desired move position to the target_nulls origin using the following line.
Code:
vector up = $target_null_up.getWorldOrigin();


I'm not sure if that's suitable for what you're after, but it is very handy if you have a move position that you may want to change easily at some point.

_________________
-bkt


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Thu Apr 12, 2012 4:08 pm 
Offline
picked up a pistol

Joined: Thu Oct 13, 2011 4:09 pm
Posts: 74
(1) I'm getting this error

Quote:
line 27 '.' is not a name


Line 27 is

Code:
   object.time(2);


(2) It also won't let me declare a universal vector, as I did with the entity object. Is there another way?

. . .

This is the the code:

Code:
entity object = $box;

void boxorigin()   //print box origin

{

   vector origin = object.getOrigin();
   sys.print(origin);

}

void movement_vars()  //declare vectors

{
   vector origin = object.getOrigin();
   vector up = origin + '0 0 10';
   vector down = origin - '0 0 10';

}

void box_mover1()  //move box 1

{

   movement_vars();

   object.time(2);

   object.moveToPos(up);
   sys.waitFor(object);

   object.moveToPos(down);
   sys.waitFor(object);

}

void move_boxes():  //move all boxes

{

   box_mover1();

}

void main ()

{

   sys.setcvar("g_showtriggers","1");    //to see the triggers

}


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Thu Apr 12, 2012 9:21 pm 
Offline
picked up 75 health

Joined: Thu Aug 19, 2004 3:50 am
Posts: 81
I made a test map, and noticed two things-

1. "object" seems to be a special keyword - when I renamed it to something else (i.e. object1), it worked fine.

2. Assigning variables seems to only work within functions (?). Here's what worked for me:
Code:
entity object1;

void main()
{
    object1 = $box;
}


I'm not sure what you mean by "universal vector" - what is that?

_________________
Blendo Games


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Thu Apr 12, 2012 9:42 pm 
Offline
picked up a pistol

Joined: Thu Oct 13, 2011 4:09 pm
Posts: 74
Quote:
I'm not sure what you mean by "universal vector" - what is that?


I am still not familiar with programming parlance. I just meant declaring a vector that every subsequent function can use, e.g.,

Code:
entity object1 = $box;

vector origin = object1.getOrigin();

void boxorigin()   //print box origin

{

   sys.print(origin);

}


So I'd want to use vector like entity object1.


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Thu Apr 12, 2012 11:43 pm 
Offline
picked up 75 health

Joined: Thu Aug 19, 2004 3:50 am
Posts: 81
I see. For that kind of functionality, I'd suggest assigning your universal vector inside your script's initializing function.
Code:
entity object1;
vector origin;

void boxorigin()   //print box origin
{
   sys.print(origin);
}

void main()
{
    object1 = $box;
    origin = object1.getOrigin();
}


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Fri Apr 13, 2012 12:23 am 
Offline
picked up a pistol

Joined: Thu Oct 13, 2011 4:09 pm
Posts: 74
That worked. Two more questions:

(1) What is the name of that space before all the functions are declared? i.e.,

Code:
entity object1;
vector origin;


before

Code:
void boxorigin()   //print box origin
{
   sys.print(origin);
}

void main()
{
    object1 = $box;
    origin = object1.getOrigin();
}


Assuming it has a name.

(2) Is it possible to refer to a vector declared / assigned in a function that is called within another function? I am getting this error

Quote:
unknown value 'up'


in response to this code:

Code:
void movement_vars()  //declare vectors

{

   vector up = origin + '0 0 10';
   vector down = origin - '0 0 10';

}

void box_mover1()  //move box 1

{

   movement_vars();

   object1.time(2);

   object1.moveToPos(up);
   sys.waitFor(object1);

   object1.moveToPos(down);
   sys.waitFor(object1);

}


Endless n00b questions, I know. I want to rule out that this is possible, before I try and discover if I am simply executing the idea improperly.

If not possible, I will declare the vector and assign its value inside the script's initializing function.


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group