Author Topic: Tribes "loose C" question regarding arrays  (Read 3100 times)

0 Members and 2 Guests are viewing this topic.

KoRo

  • Fat, Emo Robot
  • Centurian Lord
  • ********
  • Posts: 3,437
  • Reputation: +14/-6
Tribes "loose C" question regarding arrays
« on: July 25, 2013 02:53 pm CDT »
I want to keep track of the values of variables over time, and to do that I'm trying to use the export function. I would like the variable name to be indexed so I can tell them apart, i.e:

$i = some number that changes

$var[$i] = 30; export("$var[$i]", "index.cs", True);
$var[$i] = 40; export("$var[$i]", "index.cs", True);
etc.

but I need the indexing to occur automatically and continuously. 1) I'm pretty sure that variable names cannot be changed as I've tried to do in the above code...correct? 2) I've found that the export function doesn't seem to like any sort of array, even if it's a string. So for example, if my variable is $var[yourmom], it won't export it, but it WILL export $var_yourmom and $varyourmom, etc.

Is there any way to get around this?

rjm003

  • Gnoll Fighter
  • **
  • Posts: 85
  • Reputation: +1/-2
Re: Tribes "loose C" question regarding arrays
« Reply #1 on: July 26, 2013 12:24 pm CDT »
Open up rpgfunk.cs and go to the function SaveCharacter() to see the correct way to export arrays. It has odd syntax when it comes to exporting.


Example of setting a variable:
Code: [Select]
$funk::var["[\"" @ %name @ "\", 6, " @ %i @ "]"] = $BonusStateCnt[%clientId, %i];

Example of exporting the arrays:
Code: [Select]
File::delete("temp\\" @ %name @ ".cs");
export("funk::var[\"" @ %name @ "\",*", "temp\\" @ %name @ ".cs", false);

« Last Edit: July 26, 2013 02:00 pm CDT by rjm003 »

Arf

  • Arf The Legend
  • Undead Hero
  • ****
  • Posts: 354
  • Reputation: +13/-16
Re: Tribes "loose C" question regarding arrays
« Reply #2 on: July 30, 2013 04:54 pm CDT »
Open up rpgfunk.cs and go to the function SaveCharacter() to see the correct way to export arrays. It has odd syntax when it comes to exporting.


Example of setting a variable:
Code: [Select]
$funk::var["[\"" @ %name @ "\", 6, " @ %i @ "]"] = $BonusStateCnt[%clientId, %i];

Example of exporting the arrays:
Code: [Select]
File::delete("temp\\" @ %name @ ".cs");
export("funk::var[\"" @ %name @ "\",*", "temp\\" @ %name @ ".cs", false);



Rj your turning me on with all that sexy talk ... lol
In Particle We Trust...




The Goal is not so important as the journey that takes you there....