Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Scripting help

Ranya Palmer
*Smoking Ace*
Join date: 21 Apr 2007
Posts: 46
12-10-2007 09:19
i am working on a gun script (LoLSBS to be exact) and i want to be able to like
have someone change the number of bullets and the velocity using chat,

something like: setclip 100 would set 100 bullets per clip
and : setvelocity 150 would make the bullets go that fast.

how would i set this up in a LoLSBS script?




oh and do anyone know how to make a bullet DCS2 or CCS compatible?
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-10-2007 12:45
seing as I don't have any of those scripts, so don't know how they are set up, I'd have to just shrug. maybe if you posted the script that you wanted to change?

the closest I can tell you without knowing that is it requires a listen, and modifying a variable in the listen event based on the chat heard
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
12-10-2007 12:47
You will need to change the variables which define clip size and bullet velocity by reacting to a listen() event.

Any impact from an object travelling over 17.5m/s will deal damage in DCS2 or CCS, so you just have to make sure that your bullets move over that speed.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
Bobbyb30 Zohari
SL Mentor Coach
Join date: 11 Nov 2006
Posts: 466
12-10-2007 12:51
Perhaps posting a copy of the script would give us a clue as to what your talking about.
_____________________
Laurence Corleone
Registered User
Join date: 12 Oct 2006
Posts: 126
12-10-2007 14:15
From: Bobbyb30 Zohari
Perhaps posting a copy of the script would give us a clue as to what your talking about.


Echo?
_____________________
There are no stupid questions, just stupid people.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-10-2007 14:50
From: Laurence Corleone
Echo?

Ah don't pay attention to the echo. Bobbyb30 is actually a Beta test of a post repeater bot that Linden Labs is currently testing.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-10-2007 15:18
maybe I'm on ignore (or bobby didn't read the replies)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-10-2007 16:05
From: Void Singer
maybe I'm on ignore (or bobby didn't read the replies)

Nope, several people have pointed it out repeatedly. I would give the benefit of the doubt except I have proof our answers are not only just being repeated but also plagiarized:

Look at this thread:

/54/2e/226458/1.html

My post #5:
From: someone
"To get the name you could do an http request;

http://world.secondlife.com/region/02b48...aa-0043-8835-6dc0316bdc0f

Will return the page for the region Michelangelo


This thread would give you a clue how to do it with a script:

http://forums.secondlife.com/showthread.php?t=225460&page=2&pp=15"


Bobbyb30's post #13

From: someone
"It's rather strange that you would know how to obtain region keys and not use them.

Yes you can gain a region's global position and name from its UUID by doing an httprequest and parsing what you get.

ie.
http://world.secondlife.com/region/02b48...aa-0043-8835-6dc0316bdc0f"


The absurdly large number of keys available in SL discounts any chance that this was random.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Ranya Palmer
*Smoking Ace*
Join date: 21 Apr 2007
Posts: 46
LoLSBS
12-10-2007 16:18
this is where most of the setup is done, im sorry i didn't post it earlier but i didn't
think that i would need to post it.

i hope this helps now.

thanks in advance.




//SETUP:
string firesound = "fire";
integer customanimation = FALSE;
string customname = "";
integer handgun = TRUE;
integer multibullet = TRUE;
integer fullauto = FALSE;
integer burst = TRUE;
integer reload = TRUE;
integer clipsize = 20;
float reloadtime = 1.0;
integer reloadanimation = TRUE;
string rcustomname = "Reload";
integer reloadsound = FALSE;
string rsound = "";
integer holster = TRUE;
integer loader = FALSE;
list exceptions = ["Loader"];


//DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING!


integer attached = FALSE;
integer permissions = FALSE;
vector eye = <0.0, 0.0, 0.84>;
list bullets;
string bulletname = "Bullet";
string firemode = "Single";
integer rbullets = clipsize;
integer reloading = FALSE;
integer holstered = FALSE;
integer listen1;
integer listen2;
integer listen3;
integer randomc;
integer listen1c = 2657;
//This is the channel for dialogs. If you change this, you must also change it in the main holster script and menu click script if you are using them.


init()
{
vector size = llGetAgentSize(llGetOwner());
eye.z = eye.z * (size.z / 2.0);
llListenRemove(listen1);
llListenRemove(listen2);
llListenRemove(listen3);
listen1 = llListen(listen1c, "", NULL_KEY, "";);
listen2 = llListen(0, "", llGetOwner(), "";);
randomc = (integer)llFrand(1000) + 1000;
//This creates a random number to use as a channel for the loader to talk to the gun.
listen3 = llListen(randomc, "", NULL_KEY, "";);
}


fire()
{
if (!holstered)
{
if (((!reload) || (!reloading)) && ((!reload) || (rbullets > 0)))
{
rbullets --;
rotation rot = llGetRot();
vector fwd = llRot2Fwd(rot);
vector pos = llGetPos() + eye+fwd*1.5;
fwd *= 100;
llTriggerSound(firesound, 1.0);
if (multibullet)
{
if (llGetInventoryType(bulletname) == -1)
{
llOwnerSay(bulletname + " could not be found. Please select a new bullet";);
}
else
{
//NOTE: New versions of LoLSBS bullets will be using the start parameter to controll bullet speed. 100 = %100 of the base bullet speed.
llRezObject(bulletname, pos, fwd, rot, 200);
}
}
else
{
llRezObject("Bullet", pos, fwd, rot, 200);
}
}
else
{
if (!reloading)
{
if (reloadanimation)
{
llStartAnimation(rcustomname);
}
if (reloadsound)
{
llTriggerSound(rsound, 1.0);
}
reloading = TRUE;
rbullets = clipsize;
llSetTimerEvent(reloadtime);
}
}
}
}
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-10-2007 17:16
Maybe something along the lines of this?:

CODE

integer clipsize = 20;
integer velocity;

default
{
state_entry()
{
llListen(123, "", "","");
}
listen(integer channel, string name, key id, string message)
{
integer divider = llSubStringIndex(message, "=");
string keyword = llGetSubString(message, 0 , divider - 1);
string variable = llGetSubString(message, divider + 1, -1);
if(keyword == "setclip")
{
clipsize = (integer)variable;
llOwnerSay("clipsize set @ " + (string)clipsize);
}
else if(keyword == "setvelocity")
{
velocity = (integer)variable;
llOwnerSay("velocity set @ " + (string)velocity);
}
}
}

If you say in chat:

/123 setclip=100
It will respond with:
"new: clipsize set @ 100"

or:
/123 setvelocity=150
it will respond with:
"new: velocity set @ 150"

You would have to put the parts in the right spot in your script. What you posted isn't the complete script & I had to guess at what the global variable for "velocity" is.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Ranya Palmer
*Smoking Ace*
Join date: 21 Apr 2007
Posts: 46
12-11-2007 04:21
thanks alot Jesse i will try this as soon as i get in world,

i can understand scripting enough to figure it out, its just that i did not know
how to go about inputing this into the script in the first place nor did i know
how to even begin to set something like this up.


and also thanks to Ordinal Malaprop for letting me know how to make a bullet
dcs2 & ccs compatible.


thanks guys



/me runs off inworld to play with my guns now