Creating A Basic Product Updater
|
|
Jodie Suisei
Lost In LSL Code
Join date: 6 Oct 2006
Posts: 66
|
09-10-2008 08:45
after thinking how can i offer updates to my products i was like ummmm whoops i dont want to be IM'ing people to return there trans items to me so i can manually do it ugh to that So i done a little forum search and on SLX on REZ to find something similiar to what i need but alas i got totally blown up by all these updaters needing PHP webspace which i dont have and totally bored of sifting through countless webpages in a hope i would find what i need lol anyway what i was attempting to do was make an open sourced script product updater that would require the owner of any of my products to goto my store and click the update prims then drag and drop using the CTRL key then the script verify the naming of the object and that i created it the basic of the script i will post below is that it needs to lock out all touchs apart from the first one who clicked so they can updates without some one messing it up for them and then i got stuck for how to tell the script i was clicked first by this person and deny any one else who clicks it. then i got double poked in the eyes by the how do i tell it to remove the inventory i looked through the wikis and pieced togather what i could on my own of what i wanted the scripts to do. the message linked is to send to another script that will check the creator of the object and its naming to see if it matchs the products already sitting in its contents tab then send the info back to the main script which will then go ok this items is by me and all checks out there is a new update so here and gives the id in this case the new product and then deletes the old one that was dropped into its inventory then once the timer hit 0 would unlock and allow others to have there update
//Instore Product Updater Basic Foundation Code //May Not Be Resold As This Will Be An Open Source Free Product :) //Can Be Modified //If You Use This Base Code Please Leave These Comments Intact // // //Created By Jodie Suisei 09/09/2008 // ///////////////////////////////////////////////////////////////////////
integer Update_Timer = 120; //Our Timer For The Length Of Time For The DetectedKey To Put There Item Into The Box
string inventory; // Will Be Used To Determine If I Created The Object If So Then Remove That Item From This Prims Inventory
key id; // Key Id Of The Clicker
default { state_entry() { llSetText("Updater", <1,1,1>, 1.0); } touch_start(integer total_number) { if( id = llDetectedKey(0)); { llSetTimerEvent(Update_Timer); //Lockout Timer llAllowInventoryDrop(TRUE); //Allow The Clicker Only To Put Contents Into The Inventory llSay(0, "Currently In Use By" +" " +llDetectedName(0) +" " + " Any Body Else Please Wait Your Turn"); } } changed(integer change) { if (change & CHANGED_ALLOWED_DROP | CHANGED_INVENTORY) { llGetInventoryCreator(inventory); // Want It To Check That I Made The Inventory Object And Then Check It Against A List Of Products That The Updater Is For llMessageLinked(LINK_SET, 0, "Product Check", id); // Sends A Link Message Passing The Info To A Second Script } else { llRemoveInventory(inventory); // After Verification To Remove The Item Added Into This Prim llMessageLinked(LINK_SET, 0, "Give Updated Product", id); // Then After It Has Been All Done To Give The Detectedkey There New Product } } timer() { llSetTimerEvent(0); llSay(0, "Session Expired Now Available For Other Users"); } }
anyway if any one of an open source of this kind of updater or simthing similiar they can point me to would also help lol any help on this would be great  would save me having to keep a manual list of every one who buys from me and then IM then for manual processing btw this is for transfer items not no trans 
|
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-10-2008 12:26
hmm, i haven't actually tried it. have you looked at  or 
|
|
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
|
09-10-2008 12:33
From: Jodie Suisei if( id = llDetectedKey(0)); Er.. Is this on purpose?
|
|
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
|
09-10-2008 16:18
I think you need to have a look into changing states, that way you can ignore any events that the new state is not set up to handle, apart from timer events which I believe cross states.
|
|
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
09-11-2008 05:31
Checking by name isn't a very secure method, as someone could get a hold of any full-perm freebie you've made and rename it for example.
Really you need something in the object to be updated that allows it to identify itself as legitimate, unfortunately this would require you to go into digital signatures (public-key cryptography) which is a very difficult problem to solve in LSL at the moment due to the inefficiency of lists.
Basically with a signature you want a chunk of data that identifies the object, e.g it's key. You then encrypt this in such a way that ONLY your updater can decrypt the message and verify its contents, using them to check your product is legitimate.
_____________________
Computer (Mac Pro): 2 x Quad Core 3.2ghz Xeon 10gb DDR2 800mhz FB-DIMMS 4 x 750gb, 32mb cache hard-drives (RAID-0/striped) NVidia GeForce 8800GT (512mb)
|
|
Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
|
09-11-2008 18:02
_____________________
Jocko Domo japanese goods [Blog]
|
|
Anya Ristow
Vengeance Studio
Join date: 21 Sep 2006
Posts: 1,243
|
09-11-2008 18:39
My update script just sends the owner a new copy of the whole product. Hit the update button in the menu and it'll tell you if a new version is available. It gets that info from my website. That doesn't even require PHP. If there's an update, you'd go to any sim that has one of my properties in it and hit the update button in the menu. If a new version is available, it's sent to you. If not, you're told so.
Part of the security is the name/creator, but as you've been told already that can be faked by using a prim from any of my freebies, so another part of security is the channel number. Theoretically someone could intercept my update messages and figure out the syntax, but I don't think there's a practical way to do that yet. Planning for it, though, update requests are also logged. I don't check a database to see if you're eligible for an update (that'd introduce another point of failure), but I could theoretically check once in a while to see if past updates were all legit. In the future I could add a database check before the transfer is made.
I could do signatures and encryption, but so far my planned products just aren't expensive enough to worry about it.
|
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-11-2008 23:23
she did say it's for transferable items, so if you have an auto update, they could simply wear the old version, get the new version, wear the older version again, and get the new version again and give them to their friends and so on
|
|
Jodie Suisei
Lost In LSL Code
Join date: 6 Oct 2006
Posts: 66
|
09-12-2008 06:38
Sorry for my lack of updating on the topic i was kicked offline for a few days with internet troubles.
as for the if id == llDetectedkey i was hoping some people might be able to poke me in the right direction for making it myself
thank you for the link to that open source code will take a look at it and see whats what. as for me giving freebies items i havent yet branched into that area with any of my products and as some one pointed out i needed a way for transferable items to be updated short of re-realeasing them as no trans i have solved my problems with the no trans updating and i bought myself into the hippo-tech update server with there modable update scripts to fold into the no trans so that area is solved.
i dont like to branch into no transfer to much as some of the products i have scripted and made thus far i like to make sure they can be given as gifts they include sunglasses , rings and some other bits and peices that i have been working on over the last two years lol.
as for the input of checking for names and if i made it yes i can see the potential problems that it will cause and people trying to fibble my products but the only option i face is to manually IM each purchaser and have them be online when i am to send out any updates if just to time consuming and frustrating to say the least lol.
think i will have to evaluate into making some updates for my products and tip into turning them no transfer and just give a IM to the existing customer about the change over and they will need to return there items and i send them the updated but as i said its rather time consuming and a product uypdater like i said to do that so they can do it as and when they want to without me having to be there for it would be great lol
EDIT as for the remoteload pin link that was provided that may well just be what i am looking for would addtionally be easy to send the updated prims out for the scripts to copy themselves over to the product then activate themselves will look into this and dabble around a little since for my sunglasses that i have scripted the only main changes would be to the menu scripts which is located in the root prim anyway lol
the only problem i found this far with the llGiveInventory is you need the avi key to send to the updater to and im not that advanced to have an external database of AVI keys but lets say i send an updater out to my exisiting customers how would i put about telling the updater prim to copy all its files to another prim?
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
09-12-2008 07:49
From: Jodie Suisei as for the if id == llDetectedkey i was hoping some people might be able to poke me in the right direction for making it myself There's two issues with that line.. One is that you're using = instead of == so "id" is getting set to the detected key, not being tested against the detected key. The other is that you've got a ; at the end of the if statement so if you fixed the = to be ==, it still would not do anything. Basically, "if( id = llDetectedKey(0));" is the exact same thing as "id = llDetectedKey(0);". One trick that people use to protect themselves against using = by mistake is to put the part that the script can't set on the left side. For example, both of these lines compile just fine but will produce very different results.. if (x == 10) if (x = 10) By moving the constant to the left side, you get these two lines instead.. if (10 == x) if (10 = x) The first line gives the exact same result as the "x == 10" one above. But because you can't set "10" to be some other value, the second line won't compile. If you try to do that in a script, you'll get a syntax (or something) error. To do this in the code you posted, you would say "if (llDetectedKey(0) == id)". If you miss type and do = instead of ==, it will not compile.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Jodie Suisei
Lost In LSL Code
Join date: 6 Oct 2006
Posts: 66
|
09-12-2008 14:40
From: Meade Paravane There's two issues with that line..
One is that you're using = instead of == so "id" is getting set to the detected key, not being tested against the detected key.
The other is that you've got a ; at the end of the if statement so if you fixed the = to be ==, it still would not do anything.
Basically, "if( id = llDetectedKey(0));" is the exact same thing as "id = llDetectedKey(0);".
One trick that people use to protect themselves against using = by mistake is to put the part that the script can't set on the left side. For example, both of these lines compile just fine but will produce very different results..
if (x == 10) if (x = 10)
By moving the constant to the left side, you get these two lines instead..
if (10 == x) if (10 = x)
The first line gives the exact same result as the "x == 10" one above.
But because you can't set "10" to be some other value, the second line won't compile. If you try to do that in a script, you'll get a syntax (or something) error.
To do this in the code you posted, you would say "if (llDetectedKey(0) == id)". If you miss type and do = instead of ==, it will not compile. thank you for the information cleared up some confusion i have been however nosing through the wiki for ways to give inventory to prims and remoteloadscript pin and got totally confused on it all works i have ideas in my head of how i would want to script the "updater prim" to send to customers for my transfer items but actually peicing the code together is very badly eluding me  was dabbling in world with a sensor to try to detect the object and then got stuck trying to figure out how exactly it will detect it and then start its update if it needs updating and then load its contents into the product and then start itself up with with script running state and all sorts. so much ideas float in my head but i dont seem to be able to put them into some sort of basic code that i could work from  i know LSL isnt easy to learn but after dabbling around with note readers and dialog menu's and some other things just want to dive in and make something that would make the rest of products and scripting life easier lol EDIT will try to peice together what i can from the wiki and post the code if i get totally stuck i dont mind making the final update box code open source when im done just would like to create something and put it out into the world for others to use hehe and to challenge myself and learn more
|
|
Jodie Suisei
Lost In LSL Code
Join date: 6 Oct 2006
Posts: 66
|
09-14-2008 02:45
I made a mini sensor that will give the owner a dialog box once it finds a scripted object within 1m when its touched. // Basic Sensor And Dialog Created By Jodie Suisei 2008-09-12
// Basic Sensor To Detect Another Scripted Object With An Active Script In It :)
// Free To Use Modify And Copy & Giveaway Just Please Dont Sell This Script For Profit!
// Please Leave These Upper Comments Inplace :)
// Will Pop A Dialog When It Finds A Scripted Object Within 1M And Says Its Name
list MiniMenu = ["Close"];
integer channel = -123456789;
key id;
default { state_entry() { id = llGetOwner(); llSetText("Basic Sensor Click Me To Find Scripted Objects", <1,1,0>, 1.0); } touch_start(integer total_number) { if (id == llGetOwner()) { llSensor("","",SCRIPTED, 1.0, PI); } } sensor(integer total_number) { llDialog(id, "I Found A Scripted Object!" +"\n" + llDetectedName(0), MiniMenu, channel); llSay(0, llGetKey()); } }
EDIT - ok i got it not to say the key of the object how can i store that key so i can use llRemoteLoadScriptPin(); to transfer a script using llGiveInventory();? also the sensor i made in the code above seems to stop detecting if the script has a listen remove in it tested this also against a basic object with just the hello avatar basic script in and it sometimes didnt even give me the dialog any one know possibly why that might be? im hoping to be able to peice this together and put it out once its finished  for all to use modify and experiement with 
|
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-14-2008 06:17
From: Jodie Suisei EDIT - ok i got it not to say the key of the object how can i store that key so i can use llRemoteLoadScriptPin(); to transfer a script using llGiveInventory();?
the key of the updater or the key of the product? the key will always be different for each copy of an object From: someone also the sensor i made in the code above seems to stop detecting if the script has a listen remove in it tested this also against a basic object with just the hello avatar basic script in and it sometimes didnt even give me the dialog any one know possibly why that might be?
the listen remove has nothing to do with the sensor, you are using llSensor, that only runs once when it is called, if it's something you want to run continuously, you would use llSensorRepeat. but if that's left on it can be quite laggy, so i recommend leave it to be activated on touch, but also use this piece of a script From: someone no_sensor() { llWhisper(0, "Did not find any scripted objects, disabling the sensor now"  ; llSensorRemove(); } what you could also do, it set a password or code in the updater. and then in the product have an update feature, either with a dialog button, or the user could simply say update. then have the item speak that password on a specified secret channel. if it matches update it. the remoteloadscriptpin could a good feature for that. it doesn't actually receive the script, it just loads the settings from it. the give inventory would be in the updater prim and would need to know the key of the item. problem with that is, when it is given that way, it's automatically not running. you would need the script in the item to detect inventory change, and if detects a script with a certain name, it could then activate that script and remove itself. i haven't tested this script, but it may work for that  happy scripting 
|
|
Jodie Suisei
Lost In LSL Code
Join date: 6 Oct 2006
Posts: 66
|
09-14-2008 06:36
Thank you for the link i have already poked around in that what my aim was is to get the key of the object and then use that to give its scripts or contents over pretty much just dabbling around untill i got it more or less trying to do as i wanted it to but i did redo a slightly more then basic copy of the script will post below should give a bit of a better understanding of what i was trying to  Also thanks for the tip on no_sensor had already added it to the code below after i had posted that first bit of code after dabbling with the sensor and llGetKey();
// Basic Sensor And Dialog Created By Jodie Suisei 2008-09-12
// Basic Sensor To Detect Another Scripted Object With An Active Script In It :)
// Free To Use Modify And Copy & Giveaway Just Please Dont Sell This Script For Profit!
// Please Leave These Upper Comments Inplace :)
// Will Pop A Dialog When It Finds A Scripted Object Within 1M And Says Its Name
list MiniMenu = ["Yes", "No"];
integer channel = -123456789;
key id;
key Object;
integer Pin = 123456789;
integer Running = TRUE;
string Inventory = "A Notecard";
integer start_param;
update() { llSay(0, "Starting To Copy Things To Target Object"); llSetRemoteScriptAccessPin(Pin); llRemoteLoadScriptPin(Object, "A Script", Pin, Running, start_param); llGiveInventory(Object, Inventory); }
default { state_entry() { llListen(channel, "", llGetOwner(), ""); id = llGetOwner(); llSetText("Basic Sensor Click Me To Find Scripted Objects", <1,1,0>, 1.0); } touch_start(integer total_number) { if (id == llGetOwner()) { llSensor("","",SCRIPTED, 1.0, PI); } } listen(integer channel, string name, key id, string message) { if (message == "Yes") { update(); } if (message == "No") { llSay(0, "Aborting Copying Procedure"); } } sensor(integer total_number) { llDialog(id, "I Found An Object!" +"\n" + llDetectedName(0), MiniMenu, channel); Object = llGetKey(); // I think the problem is me attempting to tell the script to recall the object as the llGetKey() and store it for use to transfer the contents and llRemoteLoadScriptPIn and such think i either got this wrong or havent done it right. } no_sensor() { llSay(0, "Unable To Find An Object!"); llSensorRemove(); } on_rez(integer start_param) { llSay(0, "Do Not Move The Object Which You Are Transfering The Contents To!"); llResetScript(); } }
As you can see i was attempting to make use of the llRemoteLoadScriptPin and playing around the functions the script above should give a bit more of a picture of what i was attempting to do with the script. Now everything works on it apart from my update() section gets as far as saying its going to copy and then i get a script error unable to add inventory message on the debug channel. but it should give a better picture of what im trying to do and then make the final result open source for people to modify and play around with and also give me some time to learn some more functions  EDIT - The Script named A Script is simply just a hello avatar script with a on_rez integer start_param llResetScript in without the touch event handler in it. and the notecard contents were just simply 123456789 writtien in it Double Edit I like your idea of putting an update button or listen channel into the actual acript to the prim can verify it i will do some inworld testing with a few prims and some basic dialogs and see what the results are but still having problems getting the Key of the object in world to be reognised  by just one script so i could load another script into prim with the llGiveInventory function tripple edit or is it possible to get the key of the object the script to be upgraded in and ll say that on the secret chat channel to the updater prim so when it hears that along with its secret password will then store the key so can be recalled with the llGive Inventory?
|
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-14-2008 09:00
From: Jodie Suisei Double Edit I like your idea of putting an update button or listen channel into the actual acript to the prim can verify it i will do some inworld testing with a few prims and some basic dialogs and see what the results are but still having problems getting the Key of the object in world to be reognised  by just one script so i could load another script into prim with the llGiveInventory function well with the listen even you already get the key of the avatar/object talking listen(integer channel, string name, key id, string message) the key id is where it finds out the key of who's saying it. so something like this if (message == password){ llGiveInventory(id, "newscript"  ; but like i said, using give inventory to give a script to an object isn't reliable because when an object receives a script that way, it's automatically not running, you would either need to have the owner put it in/start it manually. or in the previous version, part of the update process would be to activate the new script with llSetScriptState("newscript", TRUE); i also recommend changing the password for each version and having the previous version delete itself so that someone can't try to receive multiple copies of the script and using them
|
|
Jodie Suisei
Lost In LSL Code
Join date: 6 Oct 2006
Posts: 66
|
09-14-2008 10:47
Thank you for the advice has been really helpfull i think i have a basic system worked out soon as i have finished creating the two scripts that is very basic in nature i will post them up in a new thread so people can find it and hopefully learn from it as i have  EDIT ok i have a basic system working but the triggers for the llSetScripteState to make the transfer script running do not seem to be working correctly there tied in to wait on a sleep timer to give the contents of the prim time to register as being there but after the old script has been deleted and the new one left in there doesnt seem to want to set the script to running also if i try to set the script to running myself it just plain doesnt want anything to do with being made to run did i do something wrong? or is this some kind bug i have bumped into with llGiveInventory? i will test with the llSetScriptState a little more untill i find the combo that will make it work properly lol Edit again ok i threw out llGiveInventory and using Set Access Pin's Instead soon as i finished bug whacking i will post up the code 
|
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-14-2008 12:01
i've never used llRemoteLoadScriptPin personally, just thought it might be an idea to use. i have a theory of a script in my head that uses llgiveinventory. i'll try working on when i get home. i think for it to work though, the receiving object needs to be owned by the same person, or have inventory drop allowed. and in the script you have posted, the touch event is checking if the owner is the person touching. that would make it impossible for the other users to update it themselves
|
|
Jodie Suisei
Lost In LSL Code
Join date: 6 Oct 2006
Posts: 66
|
09-14-2008 12:17
In the new rework im about to post up the only owner check is for the menu popup to click the update its pretty much a very basic version of what i will use to recode all the sunglasses that i have made and put out a more solid version updat will involve me having to contact the buyers personally and have them send me the update back for the new to be issued but alot of new stuff will be going into it so the effort involved on creating an updater for my stuff after that latest version is put out is very easy now  the updated prim with the new scripts in will be put on sale for customers to come buy the updater for 0L$ from the update section in my store and will then be able to update there product the check for owner is second to none since the person buying the prim will be the new owner of the updater and should work without problem 
|