Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Expiring demo script

RJ Dumart
Registered User
Join date: 10 Aug 2006
Posts: 20
08-04-2007 05:50
*pulls big eyes*
OOoookay...now it gets obvious that I'm nothing NEAR a decent scripter.

I somewhat understand the essence. But implementing it in my gun-script thats not even mine? Yowza, I would have no idea how to do that...Someone contact me in-world and help me out with this, please?

I'm using Lolsbs. Yes, I know its freebie stuff, but still, ive screwed around with it enough...
So, if someone wishes to help me around with it...
Its a real good script and my guns sell good, but its a dead shame I can't give people a 'taste' of it. Sure, my freebie gun I give out is something too. But I'm really proud at my mp5 (since ive been adding other scripts that enable quite some neat stuff) and would like to show everybody, without losing profit...
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
08-04-2007 09:20
Here's a trivial Proof of Concept:

CODE

integer ScriptId;
vector Colour = <1.0, 1.0, 1.0>;
integer Toggle;
integer Count;


init()
{
if (ScriptId == 100) Colour = <0.0, 1.0, 0.0>;
else Colour = <1.0, 0.0, 0.0>;
}

default
{
state_entry()
{
llSetColor(Colour, ALL_SIDES);

if (llGetScriptName() == "Main") ScriptId = 100;
else ScriptId = 0;

if (llKey2Name(llGetOwner()) == "RJ Dumart" || ScriptId != 0) init();
else llOwnerSay("Script reset not allowed - now you've broken it. :-(");
}

touch_start(integer total_number)
{
if (ScriptId == 0)
{
Count ++;
if (Count > 10)
{
llOwnerSay("You've used up all your clicks!");
return;
}
}


if (Toggle == 0)
{
Toggle = 1;
llSetColor(Colour, ALL_SIDES);
}
else
{
Toggle = 0;
llSetColor(<1.0, 1.0, 1.0>, ALL_SIDES);
}
}
}


You should find if you call the script 'Main' then clicking the object will toggle it's colour between white and green... forever. Call the script anything else and it will toggle between white and red... 10 times before it stops accepting clicks.

Anyone can reset the script when it's called 'Main', for any other name if anyone other than 'RJ Dumart' resets the script it will break. Once it's broken it will never function again unless 'RJ Dumart', and only 'RJ Dumart', resets the script

One script... two different behaviours depending on what it's called.
RJ Dumart
Registered User
Join date: 10 Aug 2006
Posts: 20
08-05-2007 05:20
So, if the script isn't called Main, it'll have a limited set of clicks that can be done.
This being clicks in mouselook, right?

And as soon as its done, it'll give the 'custom' message that youve broken it (with the smily, lol) and it'll break the script...
Now, should I need to implement this script in another, is it all the same WHERE I do this? Or should it be at the beginning or something?

Thanks for your support. I'll be trying it out in a seperate one.
Then implement it onto my lolsbs gun script, see if I'm lucky...
Ive had a share of experiences, nonetheless.

How does 'RJ Dumart' reset a script anyway? =P


EDIT:

Seemingly it wouldve been perfect for huds, since they require alot of clicking outside mouselook...
May I contact you in SL? Maybe we can solve it more easily and effective there.

If I won't forget it, I'll post it here if its been resolved.
Domneth Dingson
Registered User
Join date: 20 Nov 2006
Posts: 126
08-05-2007 10:23
From: Ordinal Malaprop
But they could rip it out? People can copy scripts from no-mod no-copy items? This is a bit worrying! The script is the item! Surely that can't be the case... I've not seen that on no-mod no-copy items that I possess.



I'm too lazy to read the rest of the thread, so I don't know if this has been posted, but yes.

There's things you can do though. One action I've taken for a previous item is have it check the creator and the owner of the prim it's in. If creator and (myself) don't match, script deleted/doesn't function.

As long as your original item is NO MOD, they can't link their own prims to it to change this. I'd say combine this with the demo script and you're safe.


edited for clarity.
RJ Dumart
Registered User
Join date: 10 Aug 2006
Posts: 20
08-06-2007 04:23
Thats the whole deal.
I'm such a retard that I can't figure out how to implement it into Lolsbs...

Yesh, I'm that stupid.
Now that ive confessed, would anyone mind helping me?
Preferrably in-world or WHATEVER.
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
08-06-2007 12:39
Easiest thing I can think of that you should be able to drop right in the on_rez event of the default state is....first start the gun off as Alpha 100% (you can do this just by putting a script in it that does llSetAlpha, and then take it back out...you use a script so you can get 100% alpha instead of 95? don't remember if that's what it is in the GUI)

In the on_rez event you have a check the script name like Pale has it...as long as it the name of the script is what you want it to be to start off with, it just checks another integer that you set to count how many times it's been attached, which I would recommend storing that permanently in the description of the item, and if everything is fine it lets it go on and unalphas the gun.

Now you can use the clicks or a timer...for a gun, clicks are probably better since that essentially is how many shots, but the Touch event isn't something I think you're using in a gun...you'd have to go into the control and the LBUTTON for the mouse is what you would want to count for shots. Most-likely whatever script you have already does this, and you could just remove the 'reload' function.

Once they reach the end of their magazine, it sets it to 100% alpha and changes the name of the script to a value that the on_rez event looks for and it detaches. Then when they attach it again, it will see that 1) they've attached it too many times according to the description, 2) the script name is not what it should be, or any number of other items you want to use to secure it

Now I'm an ok scripter, I wouldn't say I'm great or anything....That said, perhaps I'm missing something, but it looks to me like there's a problem with Pale's script. I kinda what to say that it won't work for anyone other than you at all.

Unfortunately, since we're dealing with an item you have to give someone, there's no way to give it back or remove it or anything, because it now belongs to them now and the Lindens are very protective as far as what we can do to each other's things.

Scripting to make it unusable by them after so long is going to be a chore just because there are so many variables they could use to get around most things unless you deal with stuff outside of the script...like object color, script name, description, etc - These will work because in a no mod object, they cannot change them.

Setting them in the script is subject to resets, no script land, etc. If you set it to change the description as soon as they attach the gun, and then it only gives them 10 shots before it detaches itself...all you would have to do is check that description on_rez, and basically they'll get 10 shots or one attach and then it becomes unusuable forever because they can never change the description.
RJ Dumart
Registered User
Join date: 10 Aug 2006
Posts: 20
08-07-2007 04:13
Yes, I understand...

...No, I don't... I give up.
Its getting way above my head...
1 2