Aller au contenu

Events and Variables The Question ?


  • Veuillez vous connecter pour répondre
5 réponses à ce sujet

#1
Guest_Leopard73_*

Guest_Leopard73_*
  • Guests
I am sure I am not alone (maybe I am) when I ask this question. How do I pass variables around a script or from script to script ? If  I have a variable being passed to another event how can I add/subtract to it if another event effects it its ? I'm really struggling with this one I have a integer value that passes to another event in the same script it does it ok but when another event fires I want to either add or subtract from the end value. I can set a value but cant add to it when it is being handled. Can any one post or point to some examples so I can work this one out please !:(

#2
BioSpirit

BioSpirit
  • Members
  • 261 messages
You can read and assign values in local variables, displayed in a variables list, by using GetLocal... and SetLocal... functions. (social.bioware.com/wiki/datoolset/index.php/Local_variable)  There variables are located in object/area properties. For an example "AREA_CONTER_1" is a one such variable. Some of them are free to use by the user and some of them are used/reserved by the core engine.
It is possible to add user defined variables in these lists by editing the *.xls files and rebuilding them. But there should be no need to do that.

 

Modifié par BioSpirit, 19 décembre 2009 - 07:53 .


#3
Guest_Leopard73_*

Guest_Leopard73_*
  • Guests
thanks for the link but read that and its clear as mud as the wiki is lol. thanks anyway!

#4
BioSpirit

BioSpirit
  • Members
  • 261 messages
This is how you can add a value into a variable.

object oArea = GetObjectByTag("your_area_tag"); // Get object that holds the variables
int a = 10;
int b = GetLocalInt(oArea, AREA_COUNTER_1);
SetLocalInt(oArea, AREA_COUNTER_1, a + B);


Modifié par BioSpirit, 19 décembre 2009 - 08:14 .


#5
Guest_Leopard73_*

Guest_Leopard73_*
  • Guests
Thats making a little more sense I think, looking over it again then maybe not! I'm still confused How do I populate AREA_COUNTER_1 with my variable being passed ?
I'm ever so sorry for being thick but this whole variable thing is going way over my head and its pretty fundamental that I should know this. To me its tough!

I keep looking at it and cant figure it out and dont see how it helps me pass a variable around events or scripts. Is int b populating the AREA_COUNTER_1 and being set as that?

Modifié par Leopard73, 19 décembre 2009 - 09:40 .


#6
Guest_Leopard73_*

Guest_Leopard73_*
  • Guests
Sorry forget that I figured it out, I have spent to much time in code I couldnt see the wood for the trees thatnk you ever so much mte you solved a 3 day problem Merry Christmas to you!