/** * Copyright (c)2000-2002 Sony Online Entertainment Inc. * All Rights Reserved * * Title: magic_eight_ball.script * DesCRiption: when examined displays a special message randomly picked * from 50 predefined messages * @author $AutHor: Matthew Kwid$ * @version $Revision:$ */ /***** INCLUDES ********************************************************/ include library.utils; include library.colors; include library.firework; /***** INCLUDES ********************************************************/ /***** CONSTANTS *******************************************************/ /***** TRIGGERS ********************************************************/ /***** SINGLE LAUNCH HANDLERS ********************************************************/ messageHandler handleFireworkLaunch() { if ( params == null || params.isEmpty() ) return SCRIPT_CONTINUE; obj_id player = params.getObjId("player"); if ( !isIdValid(player) ) return SCRIPT_CONTINUE; string[] fxs = params.getStringArray("fx"); float[] delays = params.getFloatArray("delay"); if ( fxs == null || fxs.length == 0 || delays == null || delays.length == 0 ) { firework.dud(player); destroyObject(self); return SCRIPT_CONTINUE; } if ( fxs.length != delays.length ) { firework.dud(player); destroyObject(self); return SCRIPT_CONTINUE; } int idx = params.getInt("idx"); if ( idx >= fxs.length ) { destroyObject(self); return SCRIPT_CONTINUE; } location here = getLocation(self); location there = utils.getRandomLocationInRing(here, 0.5f, 1f); if ( there == null ) there = here; params.put("loc", there); string fx = fxs[idx]; string template = dataTableGetString(firework.TBL_FX, fx, "template"); if ( template == null || template.equals("") ) template = dataTableGetString(firework.TBL_FX, "default", "template"); //debugSpeakMsg(self, "attempting to launch firework template: " + template); obj_id ignition = createObject(template, there); if ( isIdValid(ignition) ) attachScript(ignition, firework.SCRIPT_FIREWORK_CLEANUP); float delay = delays[idx]; if ( delay < firework.SHOW_DELAY_MIN ) delay = firework.SHOW_DELAY_MIN; idx++; params.put("idx", idx); messageTo(self, firework.HANDLER_FIREWORK_LAUNCH, params, delay, false); return SCRIPT_CONTINUE; } /***** SHOW LAUNCH HANDLERS ********************************************************/