I recognized strange behavoirs with my struct.variables.
i use modules and structs.
// RPG.ash
struct Roc_Struct_RPG
{
String name;
int money;
int searching;
.
};
Roc_Struct_RPG thief;
export thief;
//RPG.asc
function game_start()
{
thief.money = 1000;
thief.searching = 5;
}
now i try to use that vars and get strange results,
when i use the vars in the RPG.asc file, all is fine the values are correct,
RPG.asc
player.say("My Money = %d", thief.money); // value ist correct
but when i try to use the vars in another module or the room scripts.
othermodule.asc
player.say("My Money = %d", thief.money); // value is wrong (always 0)
roomxx.asc
player.say("My Money = %d", thief.money); // value is wrong (always 0)
i get vars with value 0.
what is wrong in this case?
When you define a variable in a header file, you define a separate variable in every script.
Put this in RPG.ash:
struct Roc_Struct_RPG
{
String name;
int money;
int searching;
.
};
And put this in RPG.asc:
Roc_Struct_RPG thief;
export thief;
big thx, with the import addition, all works fine. :)
RPG.ash script
struct Roc_Struct_RPG
{
String name;
int money;
int searching;
.
};
import Roc_Struct_RPG thief;