include library.sui; include library.space_crafting; include library.space_utils; include library.utils; include library.space_pilot_command; // this script goes onto the memory module // it allows a player to "program" a memory chip with their desired commadns. // these commands are then eaten by the droid // this copies an array onto the droid. trigger OnInitialize() { if (!hasObjVar(self, "programSize" )) setObjVar(self,"programSize",1); return SCRIPT_CONTINUE; } trigger OnObjectMenuRequest (obj_id objPlayer, menu_info menuInfo) { // we check if it's been burnt in or not. // if you don't have the basic droid crap, you get nothing menuInfo.addRootMenu(menu_info_types.MEMORY_CHIP_ANALYZE, new string_id("space/space_interaction", "memory_chip_analyze")); return SCRIPT_CONTINUE; } trigger OnObjectMenuSelect(obj_id objPlayer, int item) { if(item==menu_info_types.MEMORY_CHIP_ANALYZE) { // opens up a sui box explaining some crap string strDroidCommand = getStringObjVar(self, "strDroidCommand"); if(strDroidCommand==null) { return SCRIPT_CONTINUE; } string_id strSpam = new string_id("space/droid_commands", strDroidCommand+"_description"); sui.msgbox(objPlayer, strSpam); } return SCRIPT_CONTINUE; } trigger OnGetAttributes (obj_id player, string[] names, string[] attribs) { int idx = utils.getValidAttributeIndex(names); if (idx == -1) return SCRIPT_CONTINUE; if (hasObjVar(self, "programSize")) { names[idx] = "droid_command_program_size"; int programSize = getIntObjVar(self, "programSize"); attribs[idx] = " " + programSize; idx++; } if (hasObjVar(self, "strDroidCommand")) { string strDroidCommand = getStringObjVar(self, "strDroidCommand"); names[idx] = "droid_command_name"; attribs[idx] = utils.packStringId(new string_id("space/droid_commands", strDroidCommand)); //attribs[idx] = strDroidCommand; idx++; if (idx >= names.length) return SCRIPT_CONTINUE; } return SCRIPT_CONTINUE; } trigger OnDestroy () { obj_id dataPad = getContainedBy(self); debugServerConsoleMsg( null, "DROID_COMMAND.OnDestroy *** ENTERED FUNCTION. obj_id passed in for self was: "+self); debugServerConsoleMsg( null, "DROID_COMMAND.OnDestroy *** obj_id for datapad via getContainedBy(self) was: "+dataPad); space_pilot_command.updateControlDevice(self, dataPad); return SCRIPT_CONTINUE; }