Doom3world

The world is yours! Doom 3 - Quake 4 - ET:QW - Prey - Rage
It is currently Tue May 21, 2013 9:00 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 24 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: func_movers not responding to script commands
PostPosted: Fri Apr 13, 2012 3:03 am 
Offline
picked up 75 health

Joined: Thu Aug 19, 2004 3:50 am
Posts: 81
1. I don't think those variables have an official name, but I've seen them referred to as global variables.

2. You are declaring your 'up' and 'down' variables inside your movement_vars() function. Therefore, those variables only exist within your movement_vars() function.

If you want all of your functions to be able to access your 'up' and 'down' variables, you will need to declare those two variables in the global area, similar to my example in my previous post.

_________________
Blendo Games


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Fri Apr 13, 2012 4:07 am 
Offline
King of the Hill
User avatar

Joined: Thu May 05, 2005 11:38 am
Posts: 1325
Location: Gold Coast, Australia
Also have a look in scripts/doom_defs.script. There are a bunch of keywords with defined values including up, down, left, right, forward and back.

Also another script worth looking through is scripts/doom_utils.script which contains a bunch of functions that do all kinds of nifty things to save you some time.

_________________
-bkt


Top
 Profile E-mail  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Sat Apr 14, 2012 7:33 pm 
Offline
is sad because his cool title went away
User avatar

Joined: Tue Sep 07, 2004 6:23 pm
Posts: 709
Location: Bracknell UK
Its almost like your writing your script like a scriptObject. //move all boxes ? is your end goal to feed in multiple boxes that all do roughly the same thing?

Anyway i digress,
1) The space around the functions is what you could call a global area, hence anything set up in here is globaly available to all your functions. A better name maybe Namespace, if you were to look at the ID maps you will find their script are not actually in the maps folder but in the scripts folder and all their function are rapped in a Namespace( tag. e.g
Code:
namespace mynamespace{
  float myglobalfloatvariable;
    //globaly available to any functions within the enclosing namespace

  void main(){
    //blah
  }
 
  void myotherfunction(){
    //blah
   )
)


When you right your own map script and place it in the map folder (i presumming, needs tessting, that this namespace convention is defaulted to the name of the script, hence your map name.

For general script writing using namespacing allows you to have multiple functions with the same name, inside the same script file. e.g
Code:
namespace mynamespace1{
  void myfunction(){
    //blah
  }
}
namespace mynamespace2{
  void myfunction(){
    //blah
  }
}

To call either of these, say for example from a trigger, i think would be something like "call" "mynamespace::myfunction". I believe thats correct but i have never really had any call to use namespaces.



Quote:
(2) Is it possible to refer to a vector declared / assigned in a function that is called within another function?


Not without it first being decalred in the global area or passed along to a function call.

Another possability is to keep it on the entity as a k/v pair so you can recall it from where ever you like.
e.g
Code:
void main(){
  $myentity.setKey("var1",$myentity.getWorldOrigin());
    //write the kv to myentity
}

void myotherfunction(){
  vector entitypos = $myentity.getVectorKey("var1");
    //retrieve kv value into a variable from a different function
}


___________________________________

Getting back to my initial query about feeding in multiple entitys that do roughly the same thing, THIS may be worth a read for reference (will also elude to why the word 'object' was causing you problems), maybe a little over the top for your needs? but shows a different route of making entitys that roughly do the same thing, all share a common script, yet run their own versions of it.


Top
 Profile  
 
 Post subject: Re: func_movers not responding to script commands
PostPosted: Sat Apr 14, 2012 8:36 pm 
Offline
picked up a pistol

Joined: Thu Oct 13, 2011 4:09 pm
Posts: 74
This forum rules.

Quote:
is your end goal to feed in multiple boxes that all do roughly the same thing?


Not roughly. I want them to do exactly the same thing. That's the point: to standardize these movements. So I have movement1, movement2, movement3, and I can assign them to some func_mover in the map every time I want that func_mover to move like movement1.

. . .

I am looking at all your references. Your explanations were great, too. I do appreciate this a lot.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


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