Jump to content

Tighern McDonnell

  • Posts

  • Joined

  • Last visited

Everything posted by Tighern McDonnell

  1. So I have been racking my brain about the actual formula code for this one. I see the hints toward using the index from the llFindListFind command and using it to correlate to the "step" and also looking at the "for" and "while" but still cannot seem to get the right combination to get it to work. the one thing is I need each "step" effect to be slightly different as well... So a little more obvious of a place to look at examples similar to what I am trying to do. I am not asking somebody to write the code for me just point me to an example that is similar that i can learn from.
  2. so I am missing something... I decided to go with two lists instead of a strided list... I am using some code from the wiki and code I wrote... Please feel free to pick apart the entirety of the script. I am sure there is a much more efficient way of doing this whole thing and I hope you guys can understand what I am trying to do with it. The below code is not working correctly and I am not sure why. If the object is in default state, the listen will trigger to change to broken state. Once there it is listening for the tool to say its name on channel -9000... Using the variable string "CT" and having it "say" what it is... this seems to correlate to the right tool for the right step... but it does not advance the "step" integer... hopefully it is something simple I am missing and again im not too advanced with any of this so I am sure there is a much better way to do it. //Version 0.0.3 for panel //added chat command integer step=1; vector COLOR_RED = <1.0,0,0>; vector COLOR_GREEN = <0,1,0>; vector COLOR_WHITE = <1,1,1>; float OPAQUE = 1.0; float gTimer = 64800; integer gListenA; integer gListenB; integer chana = 128; integer chanb = -128; string gIndex; string CT ="ABC"; list glTools = ["Open","Polarity","Hypospray","Conduit","Tricorder","Spanner","ISO Chip","Fire Extenquisher","Torch","Micro-resonator","Fuse"]; list glCode = ["O","P","H","C","T","S","I","EF","To","M","F"]; tool_finder() { list tools = llParseString2List(llGetObjectDesc(),[","],[]); string currenttool = (string)llList2String(tools,step - 1); integer gIndex = llListFindList(glCode, [currenttool]); if (gIndex != -1) { list three_four = llList2List(glCode, gIndex, gIndex + 1); string CT = (string)llList2String(glTools,gIndex); llOwnerSay(CT); } } default { state_entry() { // llSetTimerEvent(gTimer); llSetText("Opperational",<0,1,0>,1); llSetColor(COLOR_WHITE,1); llMessageLinked( LINK_SET, 777, "STOP", NULL_KEY ); gListenA = llListen(chana,"","",""); gListenB = llListen(chanb,"","",""); } listen(integer channel, string name, key id, string message) { if (message == "breakme") { state broken; } } // timer() // { // llMessageLinked( LINK_SET, 777, "START", NULL_KEY ); // state broken; // } } state broken { state_entry() { llListen(-9000, "", NULL_KEY, ""); if (step==1) { llSetText("Broken\nStart with Spanner",COLOR_RED, OPAQUE); llMessageLinked( LINK_SET, 777, "START", NULL_KEY ); llSetColor(COLOR_RED, 1); } } listen(integer chan, string name, key id, string msg) { if (1 == step) { tool_finder(); if (msg == CT) { llSetText("Step " + (string)step + " completed move on to next step",<1.0,0.522,0.106>,OPAQUE); ++step; llWhisper(0,"Micro fractures present. Resonate material."); } else if (step != 1) { llWhisper(0,"That is the wrong tool. Becareful to not make this worse!"); step = 1; } } else if (step == 2) { tool_finder(); if (msg == CT) { llSetText("Step " + (string)step + " completed move on to next step",<1.0,0.863,0.0>,OPAQUE); ++step; llWhisper(0,"Please check the power polarity before replacing fuse."); } else if (step != 2) { llWhisper(0,"You made it to step " + (string)step + ". Now you need to start over for using the wrong tool"); step = 1; } } else if (step == 3) { if (msg == CT) { llSetText("Step " + (string)step + " completed move on to next step",<.004,1.0,0.439>,OPAQUE); ++step; llWhisper(0,"Move on to " + (string)step); } else if (step != 3) { llWhisper(0,"Wrong Tool - Resetting"); step = 1; } } else if (step == 4) { if (msg == CT) { llSetText("Repaired on " + llGetDate(),<0,1.0,0>,OPAQUE); llMessageLinked( LINK_SET, 777, "STOP", NULL_KEY ); llWhisper(0,"Repair completed"); step = 1; state default; } else if (step != 4) { llWhisper(0,"Wrong Tool - Resetting"); step = 1; } } llOwnerSay("test " + msg); } }
  3. I looks like the strided list may be the way to go. To explain even further... yes I want to be able to relate the "coded" numbers or letters in the description of an object to a "name" that a tool says... so the normal if statement would say in a listen event that IF (msg=="spanner") then do X... the tool will whisper "spanner" and i need to check the description list and compare it to the list of tools to see if that tool is the right one... I hope that makes more sense.
  4. So.... I have a "repair" script in an object that is listening for a set of tools (messages) in an order. I would like to make it easily editable so that the end user can select the order of tools used. I am currently trying to have a "list" in the object description in an example "S,M,P,F" - the script will then take the number or letter code and turn it into the message that designated tool will "say". I can use that variable in the "IF" statement to make sure the tool used is the right one. I am having a hard time taking the llList2string(gOrder, 0) and turning it from "S" into string gTool1 = "SpannerP... I am sure it is simple and I am just missing something. I hope this is clear enough to figure out.
  5. I am trying to figure out how to do the following... I know parts of the code but cannot seem to get the right functions. Script and objects located in a worn object (belt) - touch belt and it gives you a menu to select an item, the item is then rezzed at feet and a permission box to animate charecter comes up, permission granted and the object attaches to users hand and plays the animation in the object, user touches item, items does its thing and will then detach and die. I can make the menu, i can make the object and its actions but the attach and detach part are the things i am just not figuring out. Thanks for any help.
  6. Excellent. I was hoping it was something simple like that. Will try this and see how things go.
  7. Having a hard time wraping my head around how to script this... I have three separate objects that need to be used in order to talk to one object. each one will use llWhisper on the same channel. the message is different for each one. I need to make the main object listen for each command. once step one is done then it needs to listen for step two and then step three. If a different object is used or the items are used out of order it needs to "error out" (make a different effect)
  8. Thank you for the list information. I am working on relearning lists and attempting the strided list route to see how far I can go with it.
  9. Ok, so it has been a couple of years since I was doing a lot of scripting, trying to relearn things and get back into it. The basic idea of what I am trying to do: a Pouch/Backpack/Chest system for role play. No prim items are passing back and forth it is all in the script. There are multiple items that can be "picked up" or created using another script. I need a way to keep the inventory quantities of the items picked up. I am just trying to relearn lists and haven't gotten it all back. I am thinking of someway to make a dynamic set of lists to be stored. when the item being picked (imagine picking corn) the item script will talk to the pouch giving the pouch script its name and then the pouch script will look to see if there is a list of that name if so add 1 to qty. if now it will add the list and add 1. I cannot seem to grasp my head around how to make this happen. thanks.
  10. Yes the roleplay has it that the "fuse" has to be replaced and maintained. This is just a way to keep up with what needs to be replaced at any given time. What I am thinking about doing is when the "fuse" is rezzed in the box it will whisper to the box and set a variable. When it dies it will change the variable. This way the box doesn't need to know the fuse is there it just sends back the variable to the terminal. The terminal then says which ones sent back what varaiable. Would this be a more effeciant way of doing it and still keeping to the RP actions of replacing the "fuse"? I understand the scripting part that needs to happen just trying to figure out the best way to acheive the communication.
  11. So i am not really sure where to begin with what I want to do. Here is the basics of it. In my region there are "fuse boxes" destinguished by different names - Fuse Box 1, Fuse Box 2... Each box should have a "fuse" inside of it that is a simple box that "dies" in one weeks time. These boxes need to be replaced when they die for the RP fun of it. What I am trying to do is script a terminal that when touched will "call out" to see which fuses need to be replaced and which ones are good. I know the terminal would use a llRegionSay function to "call out" and that I would like to parse a list (know how to do this too) from the fuse box stating its name as part of the string so there is a way to tell which one is reporting in. But where I am just lost right now is how should I take what is sent out and get a yes or no back from the objects if they are there or not? I am figuring the terminal needs to call out to the fuse boxes who in turn whisper out to the fuse next to them. From there I need to determine if the fuse is active or not there and have the fuse box respond back to the terminal. I am sure I am overlooking something simple but I just can't fathom how to accomplish this. Thanks for any help.
  12. Excellent. Thank you. The list part works very well. I have the command option as the first part and that trigers the if statement in the relay to tell it which object to send the information to. Oh this is turning out be be a very fun project. Learning a lot of things to make it happen.
  13. I am making a hud and a in-world relay for a role play system. I already know I will be using llRegionSayTo a bit but what I am trying to figure out is how to pass a message to the relay. Example the user click button A on the hud and it calls to the relay to exicute "if" statement A but i need to pass the user's key as well. Would this be where I would use a list? I know nothing about lists at this point so will have to read up on the wiki on them if that is the case. Is there an easier way of doing this? example would be.... hud button A sends a beamup command to the relay and the relay passes it on to the teleporter. the beamup command consists of "beamup " + llGetDisplayName(llDetectedKey(0))could i just have that sent as a string (which it is) and then repeated by the relay? when it repeats it it would pass on "beamup Tighern McDonnell" which would work just fine. Would that be the easiest way?
  14. Ok so here is the next project... updating the single script in a hud. I am building a hud for our RP that is using a single script for the major functions. I have just descoverd and learned about llRemoteLoadScriptPin and am loving it. Here are my questions. I am utilizing a "update" button on the hud to set the pin and activate the updater prim with a chat command (if there is a better way I am open to suggestions) I am not really getting too fancy with this so keep that in mind. What I want to do if possible is to have the updater button remove the old script after it knows that it will be getting an update. So what I would do is make a check for an update, if update is coming use llRemoveInventory to remove the script then send the updater the signal to load the new script... am I missing something or is it again going to be this simple?
  15. Again thank you. It is always easier than I keep making it out to be.
  16. Working on making a hud with a single script in it to do multiple functions. I want to make linked prims touchable... The two ways I can think to do it is have each prim with a script that says its name or something on a - channel to the main script. The main script then using a listen will exicute that function... There other way I don't know if it is possible. Well I think it is but have no idea how to make it happen. Where the prim is linked to the main and is named "command" the main script knows that button is pressed and exicutes the command. I know how to do the listen version but I also know that is slow and can be a bit laggy. Any help in where to get started would be most apreciated. The ultimate goal is to make it so there is one script so I can send out a updater that will use the llRemoteLoadScriptPin function to update the hud quite often as it is a RP hud with teleport locations that change once every month or so.
  17. well dang it is that simple... so you can have the vector be a string by using it that way? Oh that will open up a few other things for me. Thank you.
  18. Is it even possable? I know how to get the position of the prim but what I want to do is Rezz a cube with the script in it... and have its position show up as <128,128,15> or whatever as floating text... is there a way?
  19. Ok sorry will try and be a little more specific. I have the hud that runs a scanner when touched. it searches the standardard 96m to see if an object with name "A" is found. If it finds one it then takes its location from the scan and changes color based on how far away object "A" is. There may be multiple "A"s located in the sim and typically are. This part is all set up and ready to go. What I would like to do is create a "server" where I set a name for the objects that are found by the HUD. This server would be set so that the HUD users can come up to it and touch it... it will then update the HUD with the current object name to be looking for. I guess what I am looking for is a resorce for a updater script or something like that... that will run an update on the script in the HUD to change the name of the object it looks for. I would like to keep it to name instead of key to make it easier for the end user to use. Giving the ability to create objects and place as many as they would like. I just do not know where to start for the "server" aspect of it.
  20. Ok so I created a hud that scans for an object and lets the user know if they are farther away or closer by changing color... What I would like to do is setup a "server" that the user clicks on that will update the name of the object the HUD is searching for. There will be multiple items with the same name located around the sim. I am not sure where to start with this. I would think that I create a string to pass to the HUD but what I have done before is just have one object Listen on a channel for the string then have that set as a string in the new object. Would this work on a HUD, or is there a better way? I would think that it would need to be set as a global instead of local. Any help stearing me in the right direction would be wonderfu. I am wanting to expand this much further but taking it one step at a time. Thanks.
  21. Excellent. Exactly what I as expecting to hear back. Just wanted to check as I am still VERY new to scripting. Thanks. Will see what I can get put together in the next couple of days.
  22. Ok before I spend a good bit of research time learning new functions (although I really enjoy doing that...) I am looking at making a hud that will search for a specificly named item. User clicks on the hud, it looks for the item at 15m if it does not find it the color stays red, if it does it it searches at distance of 5m if it does find it then it turns green, if not it turns yellow. The name of the object is going to set and not a variable. Is using llSensor the best way for this or is there another option out there? Also if llSensor is the best route are they any other resorces out there better than what little bit I can find on the LSL Portal wiki? It has good information but as a beginner I am not quite picking it up. Thanks again for any help. Almost have this project nailed down and useable.
  23. Excellent. I am learning. I actually put that together and tested it out before coming back here to check the replys. Thank you guys so much for all the help.
  24. so what I am doing is having object b actually pass the name of the notecard in the listen event. Do I just need to make it a different variable name and have that stored as the global notecard_name variable so it can be accessed in the dataserve event? Going to be re-reading the variable section in the wiki tonight. Thank you for all your help. I'm starting to get hooked to scripting. As you can tell it is my first venture into programing that I have actually stuck with.
  25. Here is what I have so far after adding the listen event in. key kQuery;integer iLine = 0;key notecard_key = NULL_KEY;string notecard_name; default{ state_entry(){ llListen(-25,"","","");} listen (integer channel, string name, key id, string notecard_name){ kQuery = llGetNotecardLine(notecard_name,(iLine = 0));} dataserver(key query_id, string data) { if (query_id == kQuery) { // this is a line of our notecard if (data == EOF) { llSay(0, "End of information."); } else { llSay(0, data ); // increment line count ++iLine; //request next line of notecard. kQuery = llGetNotecardLine(notecard_name, iLine); } } }} What it is doing now is saying that it cannot find notecard "". I think I understand why. it is because I do not have notecard_name defined where it can be used under the dataserv event. But how do I do this then? Right now it will pick the right card, and read the first line but then will pop up the error.
  • Create New...