@xorbaxian : There are three scripts that I’m using.
First one (module_inc_debug):
// Functions for sending the player debug/error messages with a fancier look.
// Sends Message To PC, starting with "DEBUG: ",
// only if "Module_DEBUG" int variable is set.
void Module_DebugMessage(string sMessage);
// Sends Message To PC, starting with "DEBUG: ",
// only if "Module_DEBUG" int variable is set AND bDebugLocal != 0.
// (Set this var at the top of a script file and forward it to the function,
// to be able to receive only selected debug messages without having to delete the unwanted ones that might still be needed later)
void Module_DebugMessageLocal(string sMessage, int bDebugLocal);
// Sends Message To PC, starting with "ERROR: ",
// regardless of Module_DEBUG (warning about something that isn't supposed to happen!)
void Module_ErrorMessage(string sMessage);
/////////////////////////////////////////
/////////////////////////////////////////
void Module_DebugMessage(string sMessage)
{
object oPC = GetFirstPC();
if (GetLocalInt(oPC, "Module_DEBUG"))
{
string sDebugMessage = "DEBUG: " + sMessage;
SendMessageToPC(oPC, sDebugMessage);
}
}
void Module_DebugMessageLocal(string sMessage, int bDebugLocal)
{
object oPC = GetFirstPC();
if (bDebugLocal && GetLocalInt(oPC, "Module_DEBUG"))
{
string sDebugMessage = "DEBUG: " + sMessage;
SendMessageToPC(oPC, sDebugMessage);
}
}
void Module_ErrorMessage(string sMessage)
{
object oPC = GetFirstPC();
string sErrorMessage = "ERROR: " + sMessage;
SendMessageToPC(oPC, sErrorMessage);
}
//void main() {}
Second one (local_variables):
/*
Important Variables, for determining game progress, PC personal traits, etc.
Includes functions for creating module token inside container and setting variables on it.
*/
#include "module_inc_debug"
void GiveTok(object oPI) // give to container
{
object oI = CreateItemOnObject("module_token", oPI);
DelayCommand(2.0, SetLocalInt(oI, "MyTestVariable", 3));
}
void CreatemoduleTokenOnPC(object oPC)
{
object oPI = CreateItemOnObject("module_plotitem", oPC);
DelayCommand(2.0, GiveTok(oPI));
}
void module_SetSingleVar(string sVar, object oO, object oPC)
{
SetLocalInt(oO, sVar, GetLocalInt(oPC, sVar));
}
void module_SetSingleStringVar(string sVar, object oO, object oPC)
{
SetLocalString(oO, sVar, GetLocalString(oPC, sVar));
}
/* -------------------------------------- */
/* THE VARIABLES THAT WILL BE TRANSFERRED */
/* -------------------------------------- */
void SetVariables(object oO)
{
object oPC = GetFirstPC();
/* PC Traits */
module_SetSingleVar("PCLovesHim", oO, oPC);
module_SetSingleVar("PCLovesHer", oO, oPC);
module_SetSingleVar("PCIsMean", oO, oPC);
module_SetSingleVar("PCIsKind", oO, oPC);
}
Third one (Export_to_Chap1):
// give token inside container, transfer all variables to it
// then export and exit
#include "local_variables"
void main()
{
// I'm giving the module token upon area entry just in case someone is
// impatient and exports manually, so here is a check if the item is already there
object oPC = GetFirstPC();
object oCont = GetItemPossessedBy(oPC, "module_plotitem");
object oTok;
if (!GetIsObjectValid(oCont))
CreateModuleTokenOnPC(oPC); // gives container + token, with 2.0 delay!!!
else {
oTok = GetItemPossessedBy(oCont, "module_token");
if (!GetIsObjectValid(oTok))
GiveTok(oCont);
}
// assume that PC now has the token after at most 3.0 seconds
// set variables (just in case, it attempts to do this on area enter, too)
DelayCommand(3.0, SetVariables(oTok));
// export character
DelayCommand(6.0, ExportSingleCharacter(GetFirstPC()));
DelayCommand(9.0, StartNewModule ("The Next Module"));
DelayCommand(0.5, FloatingTextStringOnCreature("Please wait 3...", oPC));
DelayCommand(2.33, FloatingTextStringOnCreature("2...", oPC));
DelayCommand(4.16, FloatingTextStringOnCreature("1...", oPC));
}
I was wondering, if there’s an easier script (without having to use three different scripts) where I can just store all those local variables in one single item?
And will I need another script ‘to read’ all the local variables stored on that one particular item in the next module?