include library.badge; include library.colors; include library.combat; include library.create; include library.groundquests; include library.hue; include library.money; include library.pet_lib; include library.prose; include library.quests; include library.sui; include library.utils; const string PROP_TEXT = "Text"; const string SUI_TRANSFER = "Script.transfer"; const string TRANSFER_PAGE_PROMPT = "Prompt"; const string TRANSFER_PAGE_CAPTION = "bg.caption"; const string TRANSFER_PAGE_TRANSACTION = "transaction"; const string TRANSFER_BTN_OK = "btnOk"; const string TRANSFER_BTN_CANCEL = "btnCancel"; const string TRANSFER_BTN_REVERT = "btnRevert"; const string TRANSFER_TITLE = TRANSFER_PAGE_CAPTION + ".lblTitle"; const string TRANSFER_PROMPT = TRANSFER_PAGE_PROMPT + ".lblPrompt"; const string TRANSFER_INPUT_FROM = TRANSFER_PAGE_TRANSACTION + ".txtInputFrom"; const string TRANSFER_INPUT_TO = TRANSFER_PAGE_TRANSACTION + ".txtInputTo"; const string TRANSFER_FROM = TRANSFER_PAGE_TRANSACTION + ".lblStartingFrom"; const string TRANSFER_TO = TRANSFER_PAGE_TRANSACTION + ".lblStartingTo"; const string TRANSFER_FROM_TEXT = TRANSFER_PAGE_TRANSACTION + ".lblFrom"; const string TRANSFER_TO_TEXT = TRANSFER_PAGE_TRANSACTION + ".lblTo"; const string TRANSFER_SLIDER = TRANSFER_PAGE_TRANSACTION + ".slider"; const string TRANSFER_INPUT_FROM_TEXT = TRANSFER_INPUT_FROM + "." + PROP_TEXT; const string TRANSFER_INPUT_TO_TEXT = TRANSFER_INPUT_TO + "." + PROP_TEXT; //---------------------------------------------------------------------- void colorize(obj_id player, obj_id target, String customizationVar) { int pId = createSUIPage ("Script.ColorPicker", player, player, "ColorizeCallback"); setSUIProperty (pId, "ColorPicker", "TargetNetworkId", target.toString ()); setSUIProperty (pId, "ColorPicker", "TargetVariable", customizationVar); setSUIProperty (pId, "ColorPicker", "TargetRangeMin", "0"); setSUIProperty (pId, "ColorPicker", "TargetRangeMax", "500"); subscribeToSUIProperty (pId, "ColorPicker", "SelectedIndex"); setSUIAssociatedObject (pId, target); showSUIPage (pId); } void transfer(obj_id player, int from, int to, float conversionRatio) { int pid = createSUIPage ("Script.Transfer", player, player, "TransferCallback"); setSUIProperty (pid, "Transaction", "ConversionRatio", Float.toString(conversionRatio)); setSUIProperty(pid, TRANSFER_FROM, PROP_TEXT, Integer.toString(from)); setSUIProperty(pid, TRANSFER_TO, PROP_TEXT, Integer.toString(to)); setSUIProperty(pid, TRANSFER_INPUT_FROM, PROP_TEXT, Integer.toString(from)); setSUIProperty(pid, TRANSFER_INPUT_TO, PROP_TEXT, Integer.toString(to)); subscribeToSUIProperty(pid, TRANSFER_INPUT_FROM, PROP_TEXT); subscribeToSUIProperty(pid, TRANSFER_INPUT_TO, PROP_TEXT); showSUIPage (pid); } void keypad(obj_id player) { int pid = createSUIPage ("Script.Keypad", player, player, "KeypadCallback"); subscribeToSUIProperty(pid, "result.numberBox", "localtext"); subscribeToSUIProperty(pid, "buttonEnter", "ButtonPressed"); setSUIProperty(pid, "buttonSlice", "enabled", "false"); showSUIPage (pid); } int progressBar(obj_id player) { int pid = createSUIPage ("Script.ProgressBar", player, player, "ProgressBarCallback"); setSUIProperty(pid, "comp.pText.text", PROP_TEXT, "Doing something..."); showSUIPage (pid); return pid; } trigger OnHearSpeech(obj_id speaker, string text) { if(speaker == self) return SCRIPT_CONTINUE; if(text == "tauntme") { prose_package pp = new prose_package (); pp.stringId = new string_id ("ui", "test_pp"); pp.actor.set (self); pp.target.set (self); pp.other.set ("other_here"); pp.digitInteger = 666; pp.digitFloat = 0.333f; commPlayer(self, speaker, pp, "object/mobile/dressed_imperial_trainer_space_01.iff"); } return SCRIPT_CONTINUE; } trigger OnSpeaking(String text) { if(isGod(self)) { debugConsoleMsg( self, "esebesta_test OnSpeaking: " + text ); java.util.StringTokenizer tok = new java.util.StringTokenizer (text); if (tok.hasMoreTokens ()) { String command = tok.nextToken (); debugConsoleMsg( self, "command is: " + command); //---------------------------------------------------------------------- if (command.equals ("eas_harvest") ) { if (tok.hasMoreTokens ()) { String harvesterIdString = tok.nextToken (); obj_id harvester = obj_id.getObjId (java.lang.Long.parseLong (harvesterIdString)); activateHarvesterExtractionPage(self, harvester); } else { debugSpeakMsg (self, "Not enough arguments: eas_harvest "); } } /* else if (command.equals ("eas_clienteffect") ) { location here = getLocation (self); playClientEffectLoc(self, "clienteffect/lair_hvy_damage_fire.cef" , here, 5); } else if (command.equals ("eas_clientevent") ) { location here = getLocation (self); playClientEffectLoc(self, "clienteffect/lair_hvy_damage_fire.cef" , here, 0); } else if(command.equals ("eas_createwp")) { location here = getLocation (self); obj_id objTargetWaypoint = createWaypointInDatapad(self, here); if (isIdValid(objTargetWaypoint)) { setObjVar(self, "eas_wpcolortest", objTargetWaypoint); setWaypointActive(objTargetWaypoint, true); setWaypointVisible(objTargetWaypoint, true); } } else if(command.equals ("eas_orangewp")) { location here = getLocation (self); obj_id objTargetWaypoint = createWaypointInDatapad(self, here); if (isIdValid(objTargetWaypoint)) { setObjVar(self, "eas_wpcolortest", objTargetWaypoint); setWaypointActive(objTargetWaypoint, true); setWaypointVisible(objTargetWaypoint, true); setWaypointColor(objTargetWaypoint, "orange"); } } else if(command.equals ("eas_yellowwp")) { location here = getLocation (self); obj_id objTargetWaypoint = createWaypointInDatapad(self, here); if (isIdValid(objTargetWaypoint)) { setObjVar(self, "eas_wpcolortest", objTargetWaypoint); setWaypointActive(objTargetWaypoint, true); setWaypointVisible(objTargetWaypoint, true); setWaypointColor(objTargetWaypoint, "yellow"); } } else if (command.equals ("eas_gimme")) { money.bankTo(money.ACCT_TEST, self, 1000); } else if (command.equals ("eas_gimmegimme")) { money.bankTo(money.ACCT_TEST, self, 1000000); } else if (command.equals ("cash")) { money.withdraw(self, 1000); } else if (command.equals ("eas_givebadge")) { if (tok.hasMoreTokens ()) { string badgeName = tok.nextToken (); badge.grantBadge(self, badgeName); } } else if (command.equals ("eas_takebadge")) { if (tok.hasMoreTokens ()) { string badgeName = tok.nextToken (); debugSpeakMsg(self, "badge is " + badgeName); badge.revokeBadge(self, badgeName, true); } } else if (command.equals ("eas_giveallbadges")) { string[] badges = getAllCollectionSlotsInBook("legacy_badge"); if ((badges != null) && (badges.length > 0)) { for (int i = 0; i < badges.length; ++i) { badge.grantBadge(self, badges[i]); } } } else if (command.equals ("eas_takeallbadges")) { string[] badges = getAllCollectionSlotsInBook("legacy_badge"); if ((badges != null) && (badges.length > 0)) { for (int i = 0; i < badges.length; ++i) { badge.revokeBadge(self, badges[i], true); } } } else if (command.equals ("eas_stopimagedesign")) { debugConsoleMsg(self, "wiping imagedesigner script var"); debugSpeakMsg(self, "wiping imagedesigner script var"); utils.removeScriptVar(self, "image_designer.confirm"); } else if (command.equals ("eas_openfirststeps")) { openHolocronToPage(self, "WhereDoIBegin.FirstSteps"); } else if (command.equals ("eas_openlookandmove")) { openHolocronToPage(self, "WhereDoIBegin.TutorialRecap.LookAndMove"); } else if (command.equals ("eas_opencloning")) { openHolocronToPage(self, "WhereDoIBegin.TutorialRecap.Cloning"); } else if (command.equals ("eas_closeholocron2")) { closeHolocron(self); } else if (command.equals ("eas_eject")) { debugServerConsoleMsg(self, "inside eas_eject handler"); obj_id guildHall = obj_id.getObjId(4109867); location loc = getBuildingEjectLocation(guildHall); obj_id objTargetWaypoint = createWaypointInDatapad(self, loc); if (isIdValid(objTargetWaypoint)) { setWaypointActive(objTargetWaypoint, true); setWaypointVisible(objTargetWaypoint, true); } } else if (command.equals ("eas_isbelowwater")) { debugSpeakMsg (self, "inside eas_isbelowwater handler"); location here = getLocation (self); boolean result = isBelowWater(here); if(result) debugSpeakMsg (self, "below water"); else debugSpeakMsg (self, "above water"); } else if (command.equals ("eas_getwatertableheight")) { debugSpeakMsg (self, "inside eas_getwatertableheight handler"); location here = getLocation (self); float result = getWaterTableHeight(here); debugSpeakMsg (self, "water table height = " + result); } else if (command.equals ("ihavethepower")) { debugSpeakMsg (self, "inside ihavethepower handler"); setInvulnerable(self, true); } else if (command.equals ("eas_colorize")) { if (tok.countTokens () < 2) { debugSpeakMsg (self, "Not enough arguments: eas_colorize "); } else { // tok.nextToken (); String idString = tok.nextToken (); String customizationVar = tok.nextToken (); obj_id id = obj_id.getObjId (java.lang.Long.parseLong (idString)); colorize (self, id, customizationVar); } } else if (command.equals ("eas_healwounds")) { } else if (command.equals ("eas_isharvempty")) { if (tok.countTokens () < 1) { debugSpeakMsg (self, "Not enough arguments: eas_isharvempty "); } else { String idString = tok.nextToken (); obj_id id = obj_id.getObjId (java.lang.Long.parseLong (idString)); boolean result = isHarvesterEmpty(id); if(result) debugSpeakMsg (self, "harv empty"); else debugSpeakMsg (self, "harv not empty"); } } else if (command.equals ("eas_messupstats")) { setMaxAttrib(self, 0, 5000 ); setMaxAttrib(self, 1, 5000 ); setMaxAttrib(self, 2, 5000 ); setMaxAttrib(self, 3, 5000 ); setMaxAttrib(self, 4, 5000 ); setMaxAttrib(self, 5, 5000 ); setMaxAttrib(self, 6, 5000 ); setMaxAttrib(self, 7, 5000 ); setMaxAttrib(self, 8, 5000 ); } else if (command.equals ("eas_transfer")) { transfer(self, 23, 0, 5.0f); } else if (command.equals ("eas_keypad")) { keypad(self); } else if (command.equals ("eas_progressbar")) { int result = progressBar(self); debugConsoleMsg(self, "SUI page " + result + " shown"); } else if (command.equals ("eas_setprogressbartext") ) { boolean showUsage = false; int pageId = 0; String newText = ""; if (tok.hasMoreTokens ()) { String pageIdString = tok.nextToken (); pageId = utils.stringToInt(pageIdString); if (tok.hasMoreTokens ()) { newText = tok.nextToken (); } else showUsage = true; } else showUsage = true; if(showUsage) { debugConsoleMsg( self, "eas_setprogressbartext usage: \"eas_setprogressbartext \""); } else { setSUIProperty(pageId, "comp.pText.text", PROP_TEXT, newText); flushSUIPage(pageId); } } else if (command.equals ("eas_setstimpackduration") ) { String duration = "10.0"; if (tok.hasMoreTokens ()) { String idString = tok.nextToken (); obj_id id = obj_id.getObjId (java.lang.Long.parseLong (idString)); String[] array = getStringArrayObjVar(id, "consumable.mods"); debugConsoleMsg( self, "gettings mods"); if (tok.hasMoreTokens ()) { duration = tok.nextToken (); } debugConsoleMsg( self, "2"); if (array == null) { debugConsoleMsg( self, "array == null"); return SCRIPT_CONTINUE; } int b = array.length; debugConsoleMsg( self, "array.length=" + b); for ( int i = 0; i < array.length; ++i ) // go through all attributes { String a = array[i]; debugConsoleMsg( self, "array[" + i + "] is " + a); } float[] array = new float[5]; array[0] = :1; array[1] = 26; array[2] = duration; array[3] = 10; array[4] = 10; array[0] = "1 26 " + duration + " 10.0 10.0"; debugConsoleMsg( self, "3"); setObjVar(id, "consumable.mods", array); // Suppress linting - This is a developer test script debugConsoleMsg( self, "new mods set"); } else { debugConsoleMsg( self, "eas_setstimpackduration usage: \"eas_setstimpackduration [duration]\""); } } else if(command.equals ("eas_clearid") ) { utils.removeScriptVar(self, "image_designer.confirm"); utils.removeScriptVar(self, "image_designer.start_time"); if (hasScript(self, "systems.image_designer.image_designer_response")) detachScript(self, "systems.image_designer.image_designer_response"); } else if(command.equals ("eas_hueit")) { debugConsoleMsg(self, "hit hueit"); String idString = tok.nextToken(); obj_id id = obj_id.getObjId (java.lang.Long.parseLong (idString)); hue.hueObject(id); } else if (command.equals ("eas_pilotship")) { debugConsoleMsg( self, "hit eas_pilotship"); obj_id ship = getLookAtTarget(self); if(ship != null) pilotShip(self, ship); else debugConsoleMsg( self, "eas_pilotship: no lookat target"); } else if (command.equals ("eas_unpilotship")) { debugConsoleMsg( self, "hit eas_unpilotship"); unpilotShip(self); } else if (command.equals ("eas_setallslotstargetable")) { debugConsoleMsg( self, "hit eas_setallslotstargetable"); obj_id ship = getLookAtTarget(self); if(ship != null) { for(int i = 0; i < 15; ++i) { setShipSlotTargetable(ship, i, true); } } } else if (command.equals ("eas_setnoslotstargetable")) { debugConsoleMsg( self, "hit eas_setnoslotstargetable"); obj_id ship = getLookAtTarget(self); if(ship != null) { for(int i = 0; i < 15; ++i) { setShipSlotTargetable(ship, i, false); } } } */ else if (command.equals ("eas_wphere")) { debugConsoleMsg( self, "hit eas_wphere"); obj_id wp = createWaypointInDatapad(self, getLocation(self)); _setWaypointColorNative(wp, "space"); } /* else if (command.equals ("eas_spawnxwingfrom")) { debugConsoleMsg( self, "hit eas_spawnxwingfrom"); obj_id ship = getLookAtTarget(self); if(ship != null) { vector position_w = new vector(0.f, -10.f, 0.f); transform transform_w = new transform(); transform_w = transform_w.setPosition_p(position_w); launchShipFromHangar(ship, "object/ship/xwing.iff", transform_w); } } else if (command.equals ("eas_targetmyship")) { debugConsoleMsg(self, "hit eas_targetmyship"); obj_id ship = getLookAtTarget(self); obj_id myship = getPilotedShip(self); debugConsoleMsg(self, "my ship is " + myship); debugConsoleMsg(self, "ship to change is " + ship); debugConsoleMsg(self, "setting " + ship + " to target " + myship); setLookAtTarget(ship, myship); obj_id target = getLookAtTarget(ship); debugConsoleMsg(self, ship + " set to target " + target); } else if (command.equals ("eas_createAtHyperspace")) { debugConsoleMsg(self, "hit eas_createAtHyperspace"); obj_id myship = getPilotedShip(self); createObjectHyperspace("object/ship/ywing.iff", getTransform_o2w(myship), null); } else if (command.equals ("eas_destroyHyperspace")) { debugConsoleMsg(self, "hit eas_destroyHyperspace"); obj_id ship = getLookAtTarget(self); destroyObjectHyperspace(ship); } /* else if (command.equals ("eas_addMissionCriticalShip")) { debugConsoleMsg(self, "hit eas_addMissionCriticalShip"); obj_id ship = getLookAtTarget(self); obj_id myship = getPilotedShip(self); addMissionCriticalShip(myship, ship); } else if (command.equals ("eas_removeMissionCriticalShip")) { debugConsoleMsg(self, "hit eas_removeMissionCriticalShip"); obj_id ship = getLookAtTarget(self); obj_id myship = getPilotedShip(self); removeMissionCriticalShip(myship, ship); } else if (command.equals ("eas_clearMissionCriticalShips")) { debugConsoleMsg(self, "hit eas_clearMissionCriticalShips"); obj_id myship = getPilotedShip(self); clearMissionCriticalShips(myship); } */ else if (command.equals ("eas_setShipWingName")) { debugConsoleMsg(self, "hit eas_setShipWingName"); obj_id ship = getLookAtTarget(self); setShipWingName(ship, "test_wing"); } else if (command.equals ("eas_giveTestQuest")) { debugConsoleMsg(self, "hit eas_giveTestQuest"); int questId = questGetQuestId("quest/kill_3_womprats"); questActivateQuest(questId, self, self); } else if (command.equals ("eas_clearTestQuest")) { debugConsoleMsg(self, "hit eas_clearTestQuest"); int questId = questGetQuestId("quest/kill_3_womprats"); questClearQuest(questId, self); } else if (command.equals ("eas_giveTestQuest2")) { debugConsoleMsg(self, "hit eas_giveTestQuest2"); int questId = questGetQuestId("quest/kill_3_valarian_assassins"); questActivateQuest(questId, self, self); } else if (command.equals ("eas_clearTestQuest2")) { debugConsoleMsg(self, "hit eas_clearTestQuest2"); int questId = questGetQuestId("quest/kill_3_valarian_assassins"); questClearQuest(questId, self); } else if (command.equals ("eas_giveQuest")) { debugConsoleMsg(self, "hit eas_giveQuest"); if (tok.hasMoreTokens ()) { String questName = tok.nextToken (); int questId = questGetQuestId(questName); int result = questActivateQuest(questId, self, self); if(result == 1) { String s = "Error: Quest already active."; debugSpeakMsg(self, s); } else if(result == 2) { String s = "Error: No such quest."; debugSpeakMsg(self, s); } else if(result == 3) { String s = "Error: No such task."; debugSpeakMsg(self, s); } else if(result == 4) { String s = "Error: Quest already completed, and not repeatable."; debugSpeakMsg(self, s); } else if(result == 5) { String s = "Error: Failed prerequisites."; debugSpeakMsg(self, s); } else if(result == 6) { String s = "Error: Failed exclusions."; debugSpeakMsg(self, s); } else if(result == 7) { String s = "Error: Quest Not active."; debugSpeakMsg(self, s); } else if(result == 8) { String s = "Error: Task not active."; debugSpeakMsg(self, s); } else if(result == 9) { String s = "Error: No such player."; debugSpeakMsg(self, s); } } else { debugConsoleMsg(self, "Usage: eas_giveQuest . i.e. \"eas_giveQuest quest/loot_5_widgets\""); debugSpeakMsg(self, "Usage: eas_giveQuest . i.e. \"eas_giveQuest quest/loot_5_widgets\""); } } else if (command.equals ("eas_clearQuest")) { debugConsoleMsg(self, "hit eas_clearQuest"); if (tok.hasMoreTokens ()) { String questName = tok.nextToken (); int questId = questGetQuestId(questName); questClearQuest(questId, self); } else { debugConsoleMsg(self, "Usage: eas_clearQuest . i.e. \"eas_giveQuest quest/loot_5_widgets\""); debugSpeakMsg(self, "Usage: eas_clearQuest . i.e. \"eas_giveQuest quest/loot_5_widgets\""); } } else if (command.equals ("eas_completeTask")) { debugConsoleMsg(self, "hit eas_completeTask"); if (tok.hasMoreTokens ()) { String questName = tok.nextToken (); int questId = questGetQuestId(questName); int taskId = utils.stringToInt(tok.nextToken()); questCompleteTask(questId, taskId, self); } else { debugConsoleMsg(self, "Usage: eas_completeTask . i.e. \"eas_completeTask quest/loot_5_widgets 0\""); debugSpeakMsg(self, "Usage: eas_completeTask . i.e. \"eas_completeTask quest/loot_5_widgets 0\""); } } else if (command.equals ("eas_emitSignal")) { if (tok.hasMoreTokens ()) { String signal = tok.nextToken (); groundquests.sendSignal(self, signal); } } else if (command.equals ("eas_testWaitForSignal")) { debugConsoleMsg(self, "hit eas_testWaitForSignal"); groundquests.sendSignal(self, "testsignal"); } else if (command.equals ("eas_testTaskNames")) { debugConsoleMsg(self, "hit eas_testTaskNames"); String questName = "quest/test_encounter"; if(groundquests.isValidQuestName(questName)) { debugConsoleMsg(self, "valid quest name"); } int questCrc = questGetQuestId(questName); int taskId = groundquests.getTaskId(questCrc, "killed_them_rats"); debugConsoleMsg(self, "questCrc=[" + questCrc + "] taskId=[" + taskId + "]"); if(questIsTaskComplete(questCrc, taskId, self)) { groundquests.sendSignal(self, "testSignal"); debugConsoleMsg(self, "sending signal"); } else { debugConsoleMsg(self, "not sending signal"); } } else if (command.equals ("eas_testRandomLocation")) { for(int i = 0; i < 50; ++i) { location l = groundquests.getRandom2DLocationAroundPlayer(self, 3, 5); obj_id object = create.object("object/tangible/gravestone/gravestone01.iff", l); } } else if (command.equals ("eas_setPendingEscortTarget")) { if (tok.hasMoreTokens ()) { String targetString = tok.nextToken (); obj_id target = obj_id.getObjId (java.lang.Long.parseLong (targetString)); if(!groundquests.isEscortTargetReadyForStaticEscortTask(target)) { debugConsoleMsg(self, "target busy"); } else { groundquests.setPendingStaticEscortTarget(self, target); debugConsoleMsg(self, "target target set"); } } else debugSpeakMsg(self, "Usage: eas_setPendingEscortTarget "); } else if (command.equals ("eas_prose1")) { debugSpeakMsg(self, "hit eas_prose1"); obj_id target = getLookAtTarget(self); prose_package pp = prose.getPackage( pet_lib.SID_SYS_CANT_CALL_YET, 5); showFlyText(target, pp, 1.0f, 255, 0, 0); prose_package pp2 = prose.getPackage( pet_lib.SID_SYS_CANT_CALL_YET, 10); showCombatText(target, self, pp2, 1.0f, 0, 0, 255); } else if (command.equals ("eas_requestActivateQuest")) { debugSpeakMsg(self, "hit eas_requestActivateQuest"); int questId = questGetQuestId("quest/ep3_gursan_slay_hsskas"); requestActivateQuest(questId, self, self); } else if (command.equals ("eas_requestCompleteQuest")) { debugSpeakMsg(self, "hit eas_requestCompleteQuest"); int questId = questGetQuestId("quest/ep3_gursan_slay_hsskas"); requestCompleteQuest(questId, self); } else if (command.equals ("eas_cancelQuest")) { debugSpeakMsg(self, "hit eas_cancelQuest"); int questId = questGetQuestId("quest/ep3_gursan_slay_hsskas"); questClearQuest(questId, self); } else if (command.equals ("eas_showroadmap")) { debugSpeakMsg(self, "hit eas_showroadmap"); newbieTutorialHighlightUIElement (self, "/GroundHUD.RoadMap", 7.0f); } } } return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- trigger OnPermissionListModify(obj_id actor, String playerName, String list, String action) { if(isGod(self)) { debugConsoleMsg( self, "OnPermissionListModify called with: " + playerName + ", " + list + ", " + action); // consoleMsg( self, "OnPermissionListModify called with: " + playerName + ", " + list + ", " + action); } return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- trigger OnQuestCompleted(int questCrc) { if(isGod(self)) { debugSpeakMsg( self, "OnQuestCompleted called with: " + questCrc); } return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- trigger OnQuestActivated(int questCrc) { if(isGod(self)) { debugSpeakMsg( self, "OnQuestActivated called with: " + questCrc); } return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- trigger OnSurveyDataReceived(float[] xVals, float[] zVals, float[] efficiencies) { if(isGod(self)) { if( xVals == null) { debugConsoleMsg(self, "xVals NULL"); return SCRIPT_CONTINUE; } if( zVals == null) { debugConsoleMsg(self, "zVals NULL"); return SCRIPT_CONTINUE; } if( efficiencies == null) { debugConsoleMsg(self, "efficiencies NULL"); return SCRIPT_CONTINUE; } if(xVals.length != zVals.length || zVals.length != efficiencies.length) { debugConsoleMsg(self, "vectors vary in size, bad"); return SCRIPT_CONTINUE; } for ( int i = 0; i < xVals.length; ++i ) { debugConsoleMsg(self, "point:" + i + " x: " + xVals[i] + " z: " + zVals[i] + " eff: " + efficiencies[i]); } } return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- messageHandler TestMessage() { debugSpeakMsg (self, "TestMessage messageHandler hit"); return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- messageHandler ColorizeCallback() { return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- messageHandler TransferCallback() { const int to = utils.stringToInt(params.getString(TRANSFER_INPUT_TO + "." + PROP_TEXT)); const int from = utils.stringToInt(params.getString(TRANSFER_INPUT_FROM + "." + PROP_TEXT)); debugSpeakMsg (self, "Transfer result: from:" + from + ", to:" + to); return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- messageHandler KeypadCallback() { const int result = utils.stringToInt(params.getString("result.numberBox" + "." + "localtext")); const String button = params.getString("buttonEnter.ButtonPressed"); debugSpeakMsg (self, "Keypad result: " + result + "\nButton Pressed: " + button); return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- messageHandler ProgressBarCallback() { debugSpeakMsg (self, "ProgressBarCallback"); return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- /* trigger OnImageDesignValidate(obj_id designerId, obj_id target, obj_id terminalId, int startingTime, int designType, boolean newHairSet, String newHairAsset, String hairCustomizationData, int designerRequiredCredits, int recipientPaidCredits, boolean accepted, String[] morphChangesKeys, float[] morphChangesValues, String[] indexChangesKeys, int[] indexChangesValues, String holoEmote) { debugSpeakMsg (self, "Hit OnImageDesignValidate"); // debugSpeakMsg (self, "Designer is: " + designerId); // debugSpeakMsg (self, "Recipient is: " + recipientId); return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- trigger OnImageDesignCompleted(obj_id designerId, obj_id target, obj_id terminalId, int startingTime, int designType, boolean newHairSet, String newHairAsset, String hairCustomizationData, int designerRequiredCredits, int recipientPaidCredits, boolean accepted, String[] morphChangesKeys, float[] morphChangesValues, String[] indexChangesKeys, int[] indexChangesValues, String holoEmote) { debugSpeakMsg (self, "Hit OnImageDesignCompleted"); // debugSpeakMsg (self, "Designer is: " + designerId); // debugSpeakMsg (self, "Recipient is: " + recipientId); return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- trigger OnImageDesignCanceled() { debugSpeakMsg (self, "Hit OnImageDesignCanceled"); // debugSpeakMsg (self, "Designer is: " + designerId); // debugSpeakMsg (self, "Recipient is: " + recipientId); return SCRIPT_CONTINUE; } */ //---------------------------------------------------------------------- trigger OnShipWasHit(obj_id attacker, int weaponIndex, boolean isMissile, int missileType, int componentSlot, boolean fromPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o) { string_id strFlyTextTarget = new string_id( "ship_test", "washit_target" ); color colFlyText = colors.VIOLET; showFlyText(self, strFlyTextTarget, 1.0f, colFlyText ); LOG("esebesta-debug", self + " WAS HIT by " + attacker + " in slot [" + ship_chassis_slot_type.getNameByType(componentSlot) + "]"); /* for(int i = ship_chassis_slot_type.SCST_reactor; i < ship_chassis_slot_type.SCST_num_types; ++i) { boolean isTargetable = isShipSlotTargetable(self, i); String is = "IS"; String isnot = "IS NOT"; if(isTargetable) LOG("esebesta-debug", "slot [" + ship_chassis_slot_type.getNameByType(i) + "] " + is + " targetable!"); else LOG("esebesta-debug", "slot [" + ship_chassis_slot_type.getNameByType(i) + "] " + isnot + " targetable!"); } setLookAtTargetShipComponent(self, ship_chassis_slot_type.SCST_num_types); int i = getLookAtTargetShipComponent(self); LOG("esebesta-debug", self + "'s targeted component is [" + ship_chassis_slot_type.getNameByType(i) + "]"); setLookAtTargetShipComponent(self, ship_chassis_slot_type.SCST_reactor); i = getLookAtTargetShipComponent(self); LOG("esebesta-debug", self + "'s targeted component is [" + ship_chassis_slot_type.getNameByType(i) + "]"); */ return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- /* trigger OnShipIsHitting(obj_id target, int weaponIndex, int componentSlot) { string_id strFlyTextTarget = new string_id( "ship_test", "washit_target" ); color colFlyText = colors.VIOLET; showFlyText(self, strFlyTextTarget, 1.0f, colFlyText ); LOG("esebesta-debug", self + " HIT " + target + " in slot [" + ship_chassis_slot_type.getNameByType(componentSlot) + "]"); return SCRIPT_CONTINUE; } */ //---------------------------------------------------------------------- trigger OnAttach() { return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- trigger OnFormCreateObject (string templateName, float xLoc, float yLoc, float zLoc, obj_id cell, string[] keys, string[] values) { debugConsoleMsg (self, "OnFormCreateObject hit"); debugConsoleMsg(self, "Template: " + templateName + " Loc: (" + xLoc + "," + yLoc + "," + zLoc + ")"); debugConsoleMsg(self, "Form data:"); for ( int i = 0; i < keys.length && i < values.length; ++i ) // go through all attributes { string key = keys[i]; string value = values[i]; debugConsoleMsg(self, "[" + key + "]" + value); } location loc = new location (xLoc, yLoc, zLoc, "tatooine");; // string harvesterTemplate = new string (templateName); obj_id object = createObject (templateName, loc); debugConsoleMsg (self, "New object is ID:" + object); return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- trigger OnFormEditObject (obj_id editObject, string[] keys, string[] values) { debugConsoleMsg (self, "OnFormEditObject hit"); debugConsoleMsg(self, "Object: " + editObject); debugConsoleMsg(self, "Form data:"); for ( int i = 0; i < keys.length && i < values.length; ++i ) // go through all attributes { string key = keys[i]; string value = values[i]; debugConsoleMsg(self, "[" + key + "]" + value); } return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- trigger OnFormRequestEditObject (obj_id objectToEdit, string[] keys) { debugConsoleMsg (self, "OnFormRequestEditObject hit"); string[] ourKeys = {"spawns", "minSpawnDistance", "maxSpawnDistance", "minSpawnTime", "maxSpawnTime", "spawnCount", "minLoiterDistance", "maxLoiterDistance"}; string[] ourValues = {"xwing,ywing,bwing", "0", "50", "1", "5", "8", "5", "15"}; boolean result = editFormData(self, objectToEdit, ourKeys, ourValues); if(result) debugConsoleMsg (self, "edit success"); else debugConsoleMsg (self, "edit failure"); return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- trigger OnDroppedItemOntoShipComponent (int slot, obj_id droppedItem, obj_id dropper) { debugServerConsoleMsg (self, "OnDroppedItemOntoShipComponent hit"); debugServerConsoleMsg (self, "params: slot[" + slot + "] droppedItem[" + droppedItem + "] dropper[" + dropper + "]"); debugSpeakMsg (self, "OnDroppedItemOntoShipComponent hit"); debugSpeakMsg (self, "params: slot[" + slot + "] droppedItem[" + droppedItem + "] dropper[" + dropper + "]"); return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- trigger OnTryToEquipDroidControlDeviceInShip(obj_id actor, obj_id droidControlDevice) { associateDroidControlDeviceWithShip(self, droidControlDevice); return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- trigger OnCommitDroidProgramCommands(obj_id droidControlDevice, string[] commands, obj_id[] chipsToAdd, obj_id[] chipsToRemove) { debugSpeakMsg (self, "OnCommitDroidProgramCommands hit"); debugSpeakMsg (self, "params: droidControlDevice[" + droidControlDevice + "]\n"); obj_id objDataPad = utils.getDatapad(droidControlDevice); debugSpeakMsg (self, "commands:" ); for (int i = 0; i < commands.length; ++i ) { string command = commands[i]; debugSpeakMsg (self, "[" + command + "]"); } debugSpeakMsg (self, "\nchipsToAdd:" ); for (int i = 0; i < chipsToAdd.length; ++i ) { obj_id chip = chipsToAdd[i]; debugSpeakMsg (self, "[" + chip + "]"); } debugSpeakMsg (self, "\nchipsToRemove:" ); for (int i = 0; i < chipsToRemove.length; ++i ) { obj_id chip = chipsToRemove[i]; debugSpeakMsg (self, "[" + chip + "]"); } return SCRIPT_CONTINUE; } //----------------------------------------------------------------------