bool moduleInitialized = false;
String defaultSentence_Pull ;
String defaultSentence_Push ;
String defaultSentence_Give ;
String defaultSentence_Interact ;
String defaultSentence_Look ;
String defaultSentence_PickUp ;
String defaultSentence_Talk ;
String defaultSentence_UseInv ;
String defaultSentence_Open ;
String defaultSentence_Close ;
function InitializeModule() {
//unfortunately AGS script does not allow to initialize a default
//String's value at declaration. We are forced to do it here
//universal sentences for any object in the entire game
defaultSentence_Pull = "I can't pull that.";
defaultSentence_Push = "I can't push that.";
defaultSentence_Give = "That just won't work.";
defaultSentence_Interact = "I don't know what to do.";
defaultSentence_Look = "I see nothing special about it.";
defaultSentence_PickUp = "Why would I want to pick that up?";
defaultSentence_Talk = "I shouldn't start talking to things.";
defaultSentence_UseInv = "That won't work.";
defaultSentence_Open = "I can't open that.";
defaultSentence_Close = "I can't close that.";
moduleInitialized = true; //make sure we don't call it again
}
//makes sure that all the relevant module stuff is initialized
function checkInitialized() {
//at first call
if (!moduleInitialized)
InitializeModule();
}
String FindWontWorkSentence() {
String wontWork[10];
wontWork[0] = "That won't work.";
wontWork[1] = "I don't think that will work.";
wontWork[2] = "Nu-uh.";
wontWork[3] = "No.";
wontWork[4] = "Nope.";
wontWork[5] = "That's silly.";
wontWork[6] = "Why would I try that?";
wontWork[7] = "I'll have to think of something more useful.";
wontWork[8] = "No way.";
wontWork[9] = "I can't figure it out.";
return wontWork[Random(9)];
}
String FindWontGiveSentence() {
String wontGive[4];
wontGive[0] = "I'd rather keep that to myself.";
wontGive[1] = "I won't give that away.";
wontGive[2] = "Bad idea.";
wontGive[3] = "Let's keep that to myself.";
return wontGive[Random(3)];
}
String Sentence(Action_7CoG mode, eObjectType objectType) {
checkInitialized();
String sentence = "ERROR : no sentence returned.";
if (objectType == eGizmo) { //See the definition of "eGizmo" in the Enum declaration
if (mode == eGA_7CoG_Pull) sentence = defaultSentence_Pull; //Pull
else if (mode == eGA_7CoG_Push) sentence = defaultSentence_Push; //Push
else if (mode == eGA_7CoG_GiveTo) sentence = FindWontGiveSentence(); // Give
else if (mode == eGA_7CoG_Use) sentence = FindWontWorkSentence(); // Interact
else if (mode == eGA_7CoG_LookAt) sentence = defaultSentence_Look; // Look
else if (mode == eGA_7CoG_PickUp) sentence = "I don't need that."; // Pickup
else if (mode == eGA_7CoG_TalkTo) sentence = defaultSentence_Talk; // Talk
else if (mode == eGA_7CoG_UseInv) sentence = FindWontWorkSentence(); // Useinv
else if (mode == eGA_7CoG_Open) sentence = defaultSentence_Open; // Useinv
else if (mode == eGA_7CoG_Close) sentence = defaultSentence_Close; // Useinv
else sentence = String.Format("Unknown mode : %d",mode);
} else if (objectType == eHeavy) { //See the definition of "eHeavy" in the Enum declaration
if (mode == eGA_7CoG_Pull) sentence = "It's too heavy to pull it"; //Pull
else if (mode == eGA_7CoG_Push) sentence = "It's too heavy to push it"; //Push
else if (mode == eGA_7CoG_GiveTo) sentence = FindWontGiveSentence(); // Give
else if (mode == eGA_7CoG_Use) sentence = "Let it be."; // Interact
else if (mode == eGA_7CoG_LookAt) sentence = defaultSentence_Look; // Look
else if (mode == eGA_7CoG_PickUp) sentence = "I can't pick up something that big!"; // Pickup
else if (mode == eGA_7CoG_TalkTo) sentence = defaultSentence_Talk; // Talk
else if (mode == eGA_7CoG_UseInv) sentence = defaultSentence_UseInv; // Useinv
else if (mode == eGA_7CoG_Open) sentence = defaultSentence_Open; // Useinv
else if (mode == eGA_7CoG_Close) sentence = defaultSentence_Close; // Useinv
else sentence = String.Format("Unknown mode : %d",mode);
} else if (objectType == eCharacter) { //See the definition of "eHeavy" in the Enum declaration
if (mode == eGA_7CoG_Pull) sentence = "Violence is not a solution here."; //Pull
else if (mode == eGA_7CoG_Push) sentence = "I don't just push people around."; //Push
else if (mode == eGA_7CoG_GiveTo) sentence = FindWontGiveSentence(); // Give
else if (mode == eGA_7CoG_Use) sentence = "I don't randomly touch people."; // Interact
else if (mode == eGA_7CoG_LookAt) sentence = defaultSentence_Look; // Look
else if (mode == eGA_7CoG_PickUp) sentence = "Yes, why don't I just carry everybody around on my back?"; // Pickup
else if (mode == eGA_7CoG_TalkTo) sentence = defaultSentence_Talk; // Talk
else if (mode == eGA_7CoG_UseInv) sentence = defaultSentence_UseInv; // Useinv
else if (mode == eGA_7CoG_Open) sentence = "You mean, open that person with a knife or something?"; // Useinv
else if (mode == eGA_7CoG_Close) sentence = "That doesn't make sense."; // Useinv
else sentence = String.Format("Unknown mode : %d",mode);
} else if (objectType == eDoor) { //See the definition of "eDoor" in the Enum declaration
if (mode == eGA_7CoG_Pull) sentence = "It's too heavy to pull it"; //Pull
else if (mode == eGA_7CoG_Push) sentence = "It's too heavy to push it"; //Push
else if (mode == eGA_7CoG_GiveTo) sentence = FindWontGiveSentence(); // Give
else if (mode == eGA_7CoG_Use) sentence = "Let it be."; // Interact
else if (mode == eGA_7CoG_LookAt) sentence = defaultSentence_Look; // Look
else if (mode == eGA_7CoG_PickUp) sentence = "I can't pick up something that big!"; // Pickup
else if (mode == eGA_7CoG_TalkTo) sentence = defaultSentence_Talk; // Talk
else if (mode == eGA_7CoG_UseInv) sentence = defaultSentence_UseInv; // Useinv
else if (mode == eGA_7CoG_Open) sentence = defaultSentence_Open; // Useinv
else if (mode == eGA_7CoG_Close) sentence = defaultSentence_Close; // Useinv
else sentence = String.Format("Unknown mode : %d",mode);
} else { //the most possible generic sentences
if (mode == eGA_7CoG_Pull) sentence = defaultSentence_Pull; //Pull
else if (mode == eGA_7CoG_Push) sentence = defaultSentence_Push; //Push
else if (mode == eGA_7CoG_GiveTo) sentence = FindWontGiveSentence(); // Give
else if (mode == eGA_7CoG_Use) sentence = defaultSentence_Interact; // Interact
else if (mode == eGA_7CoG_LookAt) sentence = defaultSentence_Look; // Look
else if (mode == eGA_7CoG_PickUp) sentence = FindWontWorkSentence(); // Pickup
else if (mode == eGA_7CoG_TalkTo) sentence = defaultSentence_Talk; // Talk
else if (mode == eGA_7CoG_UseInv) sentence = FindWontWorkSentence(); // Useinv
else if (mode == eGA_7CoG_Open) sentence = defaultSentence_Open; // Useinv
else if (mode == eGA_7CoG_Close) sentence = defaultSentence_Close; // Useinv
else sentence = String.Format("Unknown mode : %d",mode);
}
return sentence;
}