zzzz

Join us in Phaze Demesnes or follow us:

Home   Show All
Category: Contributor: Creator
Rezzers Simple_Casting  

Simple_Casting

Simple Casting.lsl

Category: Rezzers
By : Anonymous
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life + OpenSim

the Zip file

Download all files for Simple_Casting
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Simple_Casting_1.lsl
1
2 //global variables
3 integer handle; //used to track a listener
4
5
6 //Methods
7 startup(){ //Method name.
8 llListenRemove(handle); //Removes any old listeners
9 handle = llListen(0,"",llGetOwner(),""); //Sets the wand to listen to the current owning agent
10 }
11
12 //States
13 default //The Default State.
14 {
15
16 //Event that runs when the current state is entered.
17 //In this case, whenever the script is resaved.
19 startup(); //Startup to set listener if you change the script
20 }
21
22 //Event that runs when the object is rezzed
23 //parameters (1) : an integer value passed by the rezzing object.
24 //If it is rezzed by dragging out of the inventory the value is 0.
25 on_rez(integer para){
26 startup(); //Startup for current owning agent
27 }
28
29
30
31 //Event that runs whenever a listener "hears" text
32 //Parameters:
33 //(1) channel: the channel that the text occured on
34 //(3) id : the "key" of the agent/object that said the text
35 //(4) message : the text that was said
36 listen( integer channel, string name, key id, string message )
37 {
38 if(llGetInventoryType(message) == INVENTORY_OBJECT) { //Did the owning agent say a name of a spell
39
40 //MATH BLOCK
41 rotation rot = llGetRot(); //Get the holder's rotation
42 vector fwd = llRot2Fwd(rot); //Figure out which direction is forward
43 vector pos = llGetPos(); //what is the holder's location
44 pos = pos + fwd; //Set the location a litte infront of them
45 pos.z += 0.75; //Set the location a little bit up
46
47 llRezObject(message, pos, fwd * 10 , rot, 42);
48 //Rezzing parameters:
49 //(1) message : rez the object named by the holder
50 //(2) pos : rez the object at the location
51 //(3) fwd * 10 : rez the object with a velocity of fwd * 10
52 //(4) rot : rez the object facing rot
53 //(5) send the value 42 to the object that is rezzed (useful in adv. spells)
54
55 }
56
57 }
58
59
60 }
61 // END //