Jump to content

Perg0

Resident
  • Posts

    43
  • Joined

  • Last visited

Everything posted by Perg0

  1. Wow thanks- i'll have to look deepering into this. There is alot of optimization that i can do. Thanks again! ^^
  2. Solved it- Your right the llDetectedKey(0) i added in this one was not one i neede later. As for the listen part above- i allways found the listen command to be a bit waco tobaco- but i works now. I can now- dispense, pour and collect chemicals! The next things i'm going to try is: A: change color of a prim in the flask so it's not just empty B: start working on the thing i hopefully have more understanding of- which is the combination and chemical reactions. I'll likely be opening a new thread for that since i has no relation to the storage of data. Incase someone stumples on this thread i'll post all my code so you can mix and match it as you please ^^ Thanks again Quistess Alpha! I feel alot more knowladge in LSL now! (Quick question- What is a good alternative for IF statements if i have ALOT of chemicals to dispens?) Dispenser Flask: ############################################# string message; string chemical; default { state_entry() { llListen(105,"",llDetectedKey(0),""); } listen(integer channel, string name, key id, string message) { llSay(0, "Bottel now has " + llDeleteSubString(message, -1, -1)); chemical = message; llSetText(llDeleteSubString(chemical, -1, -1), <1.0, 1.0, 1.0>, 1.0); llSetAlpha(1.0, ALL_SIDES); } touch_start(integer total_number) { key id2 = llDetectedKey(0); llSay(106, id2); llSay(107, chemical); llSetAlpha(0.0, ALL_SIDES); llSetText(" ", <1.0, 1.0, 1.0>, 1.0); } } Handheld Flask ############################################### key id2; key id3; string message; string chemical; default { run_time_permissions(integer perm) { } attach(key id) { id3 = llDetectedKey(0); } state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); llStopAnimation("HoldingB"); llSetAlpha(0.0, ALL_SIDES); llSetText("", <1.0, 1.0, 1.0>, 1.0); llListen(106,"",llDetectedKey(0),""); message = id2; llListen(107,"",llDetectedKey(0),""); } listen(integer channel, string name, key id, string message) { if((message) != "ChemWA") { chemical = message; } llSetText(llDeleteSubString(chemical, -1, -1), <1.0, 1.0, 1.0>, 1.0); if((id2) == id3) { llSetAlpha(1.0, ALL_SIDES); llStartAnimation("HoldingB"); } if((message) == "ChemWA") { llSay(108, chemical); llSay(0, "Pouring"); llSetText(" ", <1.0, 1.0, 1.0>, 1.0); llSetAlpha(0.0, ALL_SIDES); llStopAnimation("HoldingB"); chemical = " "; } } } Stationary flask (on desk) ############################################### key id2; key id3; string message; default { state_entry() { llListen(108,"",llDetectedKey(0),""); } touch_start(integer total_number) { key id2 = llDetectedKey(0); if((id2) == id2) { llSay(0, "if statement"); llSay(107, "ChemWA"); id2 = "0"; } } listen(integer channel, string name, key id, string message) { llSetObjectDesc(message); llSetText(llDeleteSubString(message, -1, -1), <1.0, 1.0, 1.0>, 1.0); state full; } } state full { touch_start(integer total_number) { message = llGetObjectDesc(); key id2 = llDetectedKey(0); if((id2) == id2) { llSay(107, message); llSetText(" ", <1.0, 1.0, 1.0>, 1.0); state default; id2 = "0"; } } }
  3. Thanks again- However i did manage to come up with an idear for a "solution" if you can call it that. Now i have run into a new problem. The Handheld beaker is sending messages to the one on the desk, however the desk one dosen't change it's content name. Here is the following code: Handheld beaker code ######################################################################################### key id2; key id3; string message; string chemical; default { run_time_permissions(integer perm) { } attach(key id) { id3 = llDetectedKey(0); } state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); llStopAnimation("HoldingB"); llSetAlpha(0.0, ALL_SIDES); llSetText("", <1.0, 1.0, 1.0>, 1.0); llListen(106,"",llDetectedKey(0),""); message = id2; llListen(107,"",llDetectedKey(0),""); } listen(integer channel, string name, key id, string message) { if((message) != "ChemWA") { if ((message) != "ChemGO") { chemical = message; } } llSetText(llDeleteSubString(chemical, -1, -1), <1.0, 1.0, 1.0>, 1.0); if((id2) == id3) { llSetAlpha(1.0, ALL_SIDES); llStartAnimation("HoldingB"); } if((message) == "ChemWA") { llSay(108, chemical); } if((message) == "ChemGo") { llSetAlpha(0.0, ALL_SIDES); llStopAnimation("HoldingB"); } } } ################################################################################# Stationary Beaker code: ################################################################################# key id2; key id3; string message; default { state_entry() { llListen(108,"",llDetectedKey(0),""); } listen(integer channel, string name, key id, string message) { } touch_start(integer total_number) { key id2 = llDetectedKey(0); if((id2) == id2) { llSay(0, "if statement"); llSay(107, "ChemWA"); llSay(0, "message was "+message); llSetText(llDeleteSubString(message, -1, -1), <1.0, 1.0, 1.0>, 1.0); llSay(107, "ChemGO"); } state empty; } } state empty { state_entry() { llListen(108,"",llDetectedKey(0),""); } listen(integer channel, string name, key id, string message) { } touch_start(integer total_number) { key id2 = llDetectedKey(0); if((id2) == id2) { llSay(107, message); llSetText(" ", <1.0, 1.0, 1.0>, 1.0); } state default; } } ###################################################################################### My question is- why is the stationary beaker not changin text? (it should get a message over 108? right?)
  4. I have looked into the system now- thank's for the inspiration ^^ This is the current code (i know it's messy but it's WIP). The chemical dispenser sends the code to the beaker on it and dose the following: ########################################################### string message; string chemical; default { state_entry() { llListen(105,"",llDetectedKey(0),""); } listen(integer channel, string name, key id, string message) { llSay(0, "Bottel now has " + llDeleteSubString(message, -1, -1)); chemical = message; llSetText(llDeleteSubString(chemical, -1, -1), <1.0, 1.0, 1.0>, 1.0); llSetAlpha(1.0, ALL_SIDES); } touch_start(integer total_number) { key id2 = llDetectedKey(0); llSay(106, id2); llSay(107, chemical); llSetAlpha(0.0, ALL_SIDES); llSetText(" ", <1.0, 1.0, 1.0>, 1.0); } } ###################################################### Once i then press it, it goes invisible and removes the text- i then have a beaker in my hand that appears and has the same name. It has the following code: ###################################################### key id2; key id3; string message; string chemical; default { attach(key id) { id3 = llDetectedKey(0); } state_entry() { llSetAlpha(0.0, ALL_SIDES); llListen(106,"",llDetectedKey(0),""); message = id2; llListen(107,"",llDetectedKey(0),""); } listen(integer channel, string name, key id, string message) { chemical = message; llSetText(llDeleteSubString(chemical, -1, -1), <1.0, 1.0, 1.0>, 1.0); if((id2) == id3) { llSetAlpha(1.0, ALL_SIDES); llSay(0, "Chemical is here.") ; } } } ####################################################### This is a rough idear for picking up and carrying the chemicals. (Still need to fix bugs, inconsistensies aswell as add the animation to the script.) Next is: How do i get a beaker on my desk to detect the chemical i'm carrying??? Is there a syntax/code for "Get attached item" or a way to have an "On avatar interact do x"? I'm thinking a initiated bit of code once i press the beaker on the desk to tell it the chemicals i'm carrying. Thanks again for the amazing help! ^^
  5. Hello again SL Forums. My laboratory project is going super well. I'm moving towards the final and biggest stages of it. My question is: How can i make a script that once touched: -Detect the player and his ID (so it's player specific) -Gets a pice of informatios from one of my machines (currently i use "message by channel 104 aka. llSay(104, "message")"), and then stores it on an object the player is holding? My intention with this is- Once you enter a menu i have and select a chemical- you will be able to press a beaker on the machine that now has set chemical "registed" inside it. Once you click the beaker, it goes transparent and should appear in your hand (allready attached just turns on animation and alpha to 0), with the value you select to be in the beaker. I hope my explanation makes sense, thanks in advance!
  6. Thanks for the quick respons. First: yes the channel and Listen script should be ignored- it's related to other object and some relays. Second: Thanks! it worked. It's a machine for labwork, just trying to make it do some animaitions and sound before i get into the functional calculations. Here is the fixed code incase someone stumples onto the thread. integer heat; integer pres; integer speed; integer MachineStart; float gap = 1.0; float counter = 0.0; string status; default { state_entry() { llListen(103,"",llDetectedKey(0),""); llStopSound(); llSetTimerEvent(gap); } listen(integer channel, string name, key id, string message) { if ((message) == "HeatMenu+") { llPlaySound("Beep1", 1.0); heat = heat + 5; } else if ((message) == "PreasureMenu+") { llPlaySound("Beep1", 1.0); pres = pres + 2000; } else if ((message) == "SpinMenu+") { llPlaySound("Beep1", 1.0); speed = speed + 5; } else if ((message) == "HeatMenu-") { llPlaySound("Beep1", 1.0); heat = heat - 5; } else if ((message) == "PreasureMenu-") { llPlaySound("Beep1", 1.0); pres = pres - 2000; } else if ((message) == "SpinMenu-") { llPlaySound("Beep1", 1.0); speed = speed - 5; } llShout(1, message); if ((message) == "StartMachine") { MachineStart = 1; llPlaySound("PU", 1.0); llLoopSound("Working", 1.0); if (pres > 28000) { llStopSound(); llPlaySound("Kaboomexpo", 1.0); llShout(103, "crackon"); } } else if ((message) == "StartStop") { MachineStart = 2; llStopSound(); llPlaySound("PD", 1.0); } } timer() { status = "°C: "+(string)heat+"\nkPa: "+(string)pres+"\nRPM: "+(string)speed+"\nTimer: "+(string)counter; llSetText(status, <1.0, 1.0, 1.0>, 1.0); if (MachineStart ==1) { counter = counter + gap; } else if (MachineStart ==2) { counter = 0; } } }
  7. After a 2+ year break from second life i now return with a idear for a laboratory. I'm trying to make a machine but i'm having issues with it playing the sound twice. Once i hit the start button it plays the preassure sound and explosion sound 2x. the turnoff sound it only plays once. Here is the current code: integer heat; integer pres; integer speed; integer MachineStart; float gap = 1.0; float counter = 0.0; string status; default { state_entry() { llListen(103,"",llDetectedKey(0),""); llStopSound(); llSetTimerEvent(gap); llSetSoundQueueing(1); } listen(integer channel, string name, key id, string message) { if ((message) == "HeatMenu+") { llPlaySound("Beep1", 1.0); heat = heat + 5; } else if ((message) == "PreasureMenu+") { llPlaySound("Beep1", 1.0); pres = pres + 2000; } else if ((message) == "SpinMenu+") { llPlaySound("Beep1", 1.0); speed = speed + 5; } else if ((message) == "HeatMenu-") { llPlaySound("Beep1", 1.0); heat = heat - 5; } else if ((message) == "PreasureMenu-") { llPlaySound("Beep1", 1.0); pres = pres - 2000; } else if ((message) == "SpinMenu-") { llPlaySound("Beep1", 1.0); speed = speed - 5; } llShout(1, message); if ((message) == "StartMachine") { MachineStart = 1; llTriggerSound("PU", 1.0); <---------------------- (This sound plays 2x) llSleep(2.5); llStopSound(); llLoopSound("Working", 1.0); if (pres > 28000) { llStopSound(); llTriggerSound("Kaboomexpo", 1.0); <---------------------- (This sound plays 2x) llShout(103, "crackon"); } } else if ((message) == "StartStop") { MachineStart = 2; llStopSound(); llPlaySound("PD", 1.0); <---------------------- (This sound plays once (working as intended)) } } timer() { status = "°C: "+(string)heat+"\nkPa: "+(string)pres+"\nRPM: "+(string)speed+"\nTimer: "+(string)counter; llSetText(status, <1.0, 1.0, 1.0>, 1.0); if (MachineStart ==1) { counter = counter + gap; } else if (MachineStart ==2) { counter = 0; } } } Thanks in advance to you bright minds out there! ^^
  8. NGL when the first thing you read from the wiki is: //all these functions are untested functions that may have some very strange cases were they acd badly or where the comments are wrong //see them as buggy PSEUDO-code and consider yourself lucky if there are less than 2 wrong counters and 4 bad pointers/names. //they are more an example and a concept and unlikely fully functional AS IS. You get sketchy XD. Tho it looks to have promising offers- i re-downloaded my python 3 aswell as configured a Google-Sheets doc for it. Ontop LSL seams to read the website just fine if i don't post "code" on it. All in all it looks like 2021 might be a better year, since already now stuff is working better! ^^ Thanks for the help again! imma keep looking into this.
  9. Thanks- i will experiment with it and see what i can get to work.
  10. i should mention by "limit" i mean that the script litteraly reads the entire HTML code like: !DOCTYPE html <head> <Title> SL </title> </head> <Body.....
  11. Bois... i think i finaly got in over my head big time. I'm working on a script that will work like a interactive cleverbot (because that seams like a good idear after 2020 >.<) I'm trying to make a script that can read the <p>Content</p> tags on my website- Tho i don't seam to be able to limit it. Here is the code and sorry for bad english in advance. key http_request_id; default { state_entry() { http_request_id = llHTTPRequest("https://purge-0.000webhostapp.com/SL.html", [], ""); } http_response(key request_id, integer status, list metadata, string body) { if (request_id != http_request_id) return; // exit if unknown vector COLOR_GREEN = <0.0, 1.0, 0.0>; float OPAQUE = 1.0; llSetText(body, COLOR_GREEN, OPAQUE); } } Thanks in advance for the help! this forum is the best! Link to the web ofc: https://purge-0.000webhostapp.com/SL.html ~Perg0
  12. Hi again Second life Fourms. It's a long while since i was on the game and i have been working on alot of scripts. Recently i re-watched the HBO chernobyl serie and got inspired to try and build a Powerplant in second life with a few friends. Tho i strongly recall that we all had 1 issue with the game. The prim count- Our main problem with Second life is that we would like a big building with alot of small rooms but it would take up 200+ prims. Dose anyone know of a program, designer and/or place you can make/buy/get buildings with a low-prim count? Thanks to everyone in advance and hope you have a wonderfull day! :3 (also sorry for bad grammar-)
  13. This is what the script looks like now- integer listen_handle; integer channel = 0; default { attach(key id) { if (id) { llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); listen_handle = llListen(channel, "", NULL_KEY, ""); } } run_time_permissions( integer perm ) { if (perm & PERMISSION_TRIGGER_ANIMATION) { llOwnerSay("Permissions has been granted automatically."); } } listen(integer channel, string name, key id, string message) { if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION ) { if (llToLower(message) == "Bot sit") { llSay(0, "Roger, Roger"); llStartAnimation("sit_ground"); } else if (llToLower(message) == "Bot stand") { llSay(0, "Roger, Roger"); llStopAnimation("sit_ground"); llStartAnimation("stand"); } } } }
  14. Wow that worked (both of you) THANSK! now when i read it i can see the falut *face palm*. Guess i don't have such a good grip after all ^^' Thanks again tho! you guys are the best
  15. So it kinda works! I can now make the bot sit by using the following: (it's croped) listen(integer channel, string name, key id, string message) { if ( llGetPermissions() & PERMISSION_TRIGGER_ANIMATION ) { if (llToLower(message) == "bot sit") { llSay(0, "roger, roger."); llStopAnimation(""); llStartAnimation("sit_ground"); } if (llToLower(message) == "bot stand") { llSay(0, "roger, roger."); llStopAnimation(""); llStartAnimation("stand"); llResetAnimationOverride(""); } } } As you can see i have been having issus trying to make the bot stand again... the llstopanimation and llresteanimationoverride dose not seam to make it stand back up. Any idears on how to make her stand? (i have also tried running the animation standup and Stand_1 ect...) I will go and read up on the WIKI and post if i find a solution- Thanks for all the help again, You guys are the best! ^w^
  16. Oh thanks! I will give it a quick try and see if i can make it work- I will also try to post the finished code here with a few edits so that ppl might be able to use it later as refmaterial- (or maybe it should be in "LSL lib?")
  17. I have been looking around but could not find the "sit_ground_constrained" in my inventory- But maybe im looking the wrong place? ^^ also thanks for the help
  18. Thanks for that i will give it a try tho i'm not sure if i understand this correct- Are you saying i should create an object that i can attach to the bot which will make it sit or that i need to make an object it can sit on. incase it's an object for it to sit on, that is not what im looking for. I need a function that uses the "Sit here" function you normaly have when you right click on you avi.
  19. Hello again fourm- I have been working on my "bot" and was wondering if there is a LSL function or command to make an avatar sit on ground (Not on an object)? Here is the current code i'm working with (also thanks to Rolig Loon for making the original script this is based off from.) integer listen_handle; integer channel = 0; default { attach(key id) { if (id) { llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); listen_handle = llListen(channel, "", NULL_KEY, ""); } } run_time_permissions( integer perm ) { if (perm & PERMISSION_TRIGGER_ANIMATION) { llOwnerSay("Permissions has been granted automatically."); } } listen(integer channel, string name, key id, string message) { if ( llGetPermissions() & PERMISSION_TRIGGER_ANIMATION ) { if (llToLower(message) == "bot sit") { llSay(0, "roger that."); llSitTarget(<0,0,0>, ZERO_ROTATION); //This is the function i want to make it sit } } } } Thanks again you guys, I have gotten a real bite into this LSL stuff after a while! ~Perg0
  20. Alright thanks! ^^ I must have added payment to the account at a point by accident then-
  21. Yes that is correct! But will that not also remove the ability to "buy L$" from my main ("perg0" this one)
  22. I have been working on some really fun project in LSL lately and wanted to give the AGENT and "BOT" functions a try too! You see i have an alt account that i would like to use... Tho i do not like the fact that i can use the "BUY $L" function on that account- Is there a way i can block that account incase of my code or anything else going totaly wrong- Don't wanna end up sleeping in a box on the street during this corona stuff. ^^' Thanks for your help and sorry for the bad grammar. I hope you all have a great day. ~Perg0
  23. Thanks for the help! ^^ I have gotten a better understanding of the code now and i even tried your code- unfortunately it seams to only go one direction. None the less i now have an idear of which part of the code dose what. Thanks again! ❤️
  24. Thanks! ^^ i will have a look if i can't make the other work. I'm taking a break from scripting all day so i will have a look later ^^ Thanks again everyone :3 this is the sort of community i was missing back in the day when i started with other scripts.
  25. Well thanks! i will give "llTakeControls" a try then! ^^ I'm happy for your help.
×
×
  • Create New...