Jump to content

Tighern McDonnell

Resident
  • Posts

    31
  • Joined

  • Last visited

Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  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.
×
×
  • Create New...