Managing Local Variables (On PCS)
#1
Posté 04 février 2012 - 04:37
Just a few quick questions regarding variables stored on PCs....
1) If a place a variable on a PC, is there anything that "removes" it other than me using script to do so?
2) Is there a maximum umber of variables that can be stored on a PC?
3) Is there any way to see (or list) the variables currently on a PC?
EXAMPLE:
I attach a string variable "TESTSTRING" to a PC in a variable holder called, "TEST".
Does this string variable stay with a PC forever, even between module changeovers? (It appears to do so in my own module to module changeovers in my campaign.) Does it "Export" or travel with a PC between modules of different builders?
Would I eventually run out of "space" or make the PC data too big to be manageable after a certain amount of variables being added? If so, is there any way to remove all variable data from a PC?
I have a PC that has had a number of variables attached to it throughout a game, how can I see or list those variables currently attached to the PC in question?
Many thanks for your answers.
Lance.
#2
Posté 04 février 2012 - 06:02
This is actually a script from when I was trying to mess with in game camera angles. So ignore those parts.
__________________________________________
/*This script changes the camera angle. It doesn't work.
*/
// E.C.'s super include!
//03-12-07: added MotB ginc_'s
//23-01-08: made some corrections based on Baragg's list
//11-10-08: added ginc_symbol_spells from 1.13
//Added SoZ libraries. I forgot when.
//note oArea is the target!!!!
void main()
{
object oPlayer = GetFirstPC();
object oPC = GetPlayerCurrentTarget(oPlayer);
object oArea =oPC;
int nVariables = GetVariableCount(oArea);
string sVariables = IntToString(nVariables);
int nPos = 1;
string sVar1 = GetVariableName(oArea,nPos);
int nType1 = GetVariableType(oArea,nPos);
nPos++;
string sVar2 = GetVariableName(oArea,nPos);
int nType2 = GetVariableType(oArea,nPos);
nPos++;
string sVar3 = GetVariableName(oArea,nPos);
int nType3 = GetVariableType(oArea,nPos);
nPos++;
string sVar4 = GetVariableName(oArea,nPos);
int nType4 = GetVariableType(oArea,nPos);
nPos++;
string sVar5 = GetVariableName(oArea,nPos);
int nType5 = GetVariableType(oArea,nPos);
string sType1 = IntToString(nType1);
string sType2 = IntToString(nType2);
string sType3 = IntToString(nType3);
string sType4 = IntToString(nType4);
string sType5 = IntToString(nType5);
FloatingTextStringOnCreature(sVariables,oPC);
FloatingTextStringOnCreature(sVar1,oPC);
FloatingTextStringOnCreature(sVar2,oPC);
FloatingTextStringOnCreature(sVar3,oPC);
FloatingTextStringOnCreature(sVar4,oPC);
FloatingTextStringOnCreature(sVar5,oPC);
FloatingTextStringOnCreature(sType1,oPC);
FloatingTextStringOnCreature(sType2,oPC);
FloatingTextStringOnCreature(sType3,oPC);
FloatingTextStringOnCreature(sType4,oPC);
FloatingTextStringOnCreature(sType5,oPC);
//SetCameraMode(oPC,CAMERA_MODE_TOP_DOWN);
//SetCameraHeight(oPC,25.0);
//int nCycle = 1;
//SetCameraHeight(oPC,1000.0);
//while (nCycle == 1)
//{
//DisplayGuiScreen(oPC, "SCREEN_CAMERA", FALSE,"cameraui.xml");
//AssignCommand(oPC,SetCameraFacing(0.0,10001550.0,5.0));
//}
}
#3
Posté 04 février 2012 - 06:33
doesn't it assume you know the variable name?
*outside the Game* TlkEdit2 will open .bic and .ros files. I notice the .Ros files have an entry: VarTable, that lists all variables on a companion. unfortunately i don't see VarTable in .Bic files ... talking about SavedGame files here,
(and, at present, i don't see this having a direct use *ingame* )
ahh, the playerlist.ifo file has the VarTable for PC it looks like. I see one here with over 600 entries .....
#4
Posté 04 février 2012 - 06:50
EDIT: I stand corrected. I will check this out some more. Thanks.
Hi KevL,
It sounds like you are getting close to answering this, but I am not quite understanding your "thinking aloud". Which files do you think are the specific ones, and how are you viewing them?
At the moment, it sounds like you may be opening a few files in a txt editor?
Can you clarify this please.
Lance.
EDIT: I tried opening up the playerlist.ifo with a text editor and (apart from teh garbage bit), I could not see anything clearly. I will try opening a bic now.
EDIT 2: HEY! I found out where they store the global variables info.
Modifié par Lance Botelle, 04 février 2012 - 07:15 .
#6
Posté 04 février 2012 - 06:56
#7
Posté 04 février 2012 - 07:09
Lance Botelle wrote...
Hi Matt,
Unfortunately, it is as KevL says, your script assumes you know the variables on a PC in the first place. I am looking at viewing variables that may have even been "forgotten" about, if you see what I mean.
Lance.
You know, I don't think you do need to know the name. Here's the prototype for GetVariableName:
string GetVariableName (object oTarget, int nPosition)
//Returns a Local Variable's name from an object at position nPosition.
//Empty string is returned if points to an invalid variable
The function returns the name of the variable. Presumably, you could loop over the variables attached to an object by incrementing nPosition. You would repeat until GetVariableName returns "".
Once you have the name of the variable and its type (returned by GetVariableType), you can do whatever you like with it!
Pain also has a function in the CSL to reverse this and get a variable's index on the object given its name. This function, called CSLGetVariableIndex, just loops over the variables at incremental positions on the object until the names match.
#8
Posté 04 février 2012 - 07:14
I just noticed the *.Ros files were updating myself.
I will try opening these with the TlkEdit2 program now then. Many thanks for the explanation.
If you discover anything else, or any better way to get this info (and any other answers to my other questions) then please keep me appraised.
Many Thanks,
Lance.
#9
Posté 04 février 2012 - 07:16
MasterChanger wrote...
Lance Botelle wrote...
Hi Matt,
Unfortunately, it is as KevL says, your script assumes you know the variables on a PC in the first place. I am looking at viewing variables that may have even been "forgotten" about, if you see what I mean.
Lance.
You know, I don't think you do need to know the name. Here's the prototype for GetVariableName:string GetVariableName (object oTarget, int nPosition)
//Returns a Local Variable's name from an object at position nPosition.
//Empty string is returned if points to an invalid variable
The function returns the name of the variable. Presumably, you could loop over the variables attached to an object by incrementing nPosition. You would repeat until GetVariableName returns "".
Once you have the name of the variable and its type (returned by GetVariableType), you can do whatever you like with it!
Pain also has a function in the CSL to reverse this and get a variable's index on the object given its name. This function, called CSLGetVariableIndex, just loops over the variables at incremental positions on the object until the names match.
Hi MC,
Thanks for pointing out this some more. I stand corrected on my understanding of this function.
I will take a closer look now.
Many Thanks for the heads up.
Lance.
EDIT: That's rather a clever addition by Pain. I will try to locate that too.
Modifié par Lance Botelle, 04 février 2012 - 07:18 .
#10
Posté 04 février 2012 - 07:18
#11
Posté 04 février 2012 - 07:28
That TalkEDT program worked fine.
EDIT: Actually, they do make sense ... It just has some others included that I was not aware were made at the same time, like Journal times and dates, which obviously use their own format.
This is very useful.
Many Thanks.
Lance.
Modifié par Lance Botelle, 04 février 2012 - 07:32 .
#12
Posté 05 février 2012 - 04:42





Retour en haut







