Jump to content

Pumpkin Carver

Resident
  • Posts

    2
  • Joined

  • Last visited

Reputation

0 Neutral

Recent Profile Visitors

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

  1. Thank you so much! And for the second part, this is something I would not have considered if you hadn't pointed it out. I didn't know that that could happen, so thanks for that info!
  2. Although I think it will be fairly clear from everything I write here, I might as well state I am new to scripting. I've been around many years, but just decided to start trying to learn. I've read through some of the tutorials, but it wasn't making much sense until I started trying to implement it. Today I decided I'd try to make a simple script that would, on touch, give a random item from the object's inventory after a set amount of time. Finding the information on giving the random item wasn't difficult, and that was executed and working very easily, however, it gives the item instantly, and in order for the overall item to function how I wanted, I need it to wait a set amount of time before it sends the random item out. I read up on timers in the LSL wiki (which proved a bit confusing to me, as much of it does), then I came to the forums and searched quite a bit trying to figure out how to set this up correctly. I tried a few things without any results other than the fact that now my script will not give out an item at all. Simply put, the script is now doing nothing as far as I can tell. I'm needing to know what I've done wrong here, and what the correct approach would have been. I understand this is probably a stupid question, and that I need much more practice reading about scripting in general, but as I said before, I was having trouble grasping anything until I actually started trying to dive in. I'm attaching the working script without a timer event and the script with how I THOUGHT the timer event should be placed. I appreciate any help that can be provided. WORKING WITHOUT TIMER EVENT - - default { touch(integer num_detected) { key id = llDetectedKey(0); integer randomIndex = llGetInventoryNumber(INVENTORY_OBJECT); randomIndex = (integer)llFrand(randomIndex); string itemName = llGetInventoryName(INVENTORY_OBJECT,randomIndex); llGiveInventory(id, itemName); } }NOT WORKING - - default { touch_start(integer num_detected) { llSetTimerEvent(10); } timer() { key id = llDetectedKey(0); integer randomIndex = llGetInventoryNumber(INVENTORY_OBJECT); randomIndex = (integer)llFrand(randomIndex); string itemName = llGetInventoryName(INVENTORY_OBJECT,randomIndex); llGiveInventory(id, itemName); llSetTimerEvent(0); } }
×
×
  • Create New...