a 'touch object, select from list and get notecard' script help?
|
|
Eiji Mayo
Registered User
Join date: 5 Jun 2007
Posts: 79
|
06-18-2007 15:15
Hi, sorry if this has already been done on here, but I wanted to find out how to make a script that lets anyone who touches the object it's in, get one ofthose boxes in the topright of the screen that they select a button. then when they select a button it brings up a note card... How do I go about this? sorry. I am new at this and told a friend I would try anyway(^_^); any help would be most appreciated.
Thank you, Eiji Mayo
|
|
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
|
06-18-2007 15:30
If you have 4 notecards in your item's inventory that are called notecard1,notecard2,notecard3,notecard4, then the following script should be a reasonable example for you to follow: integer channel = 1000; default { state_entry() { llListen(channel,"", "",""  ; } touch_start(integer total_number) { llDialog(llDetectedKey(0),"My NoteCard Giver Menu Thing",["NOTE1", "NOTE2", "NOTE3", "NOTE4"],channel); } listen(integer chan, string name, key id, string mes) { if(mes == "NOTE1"  { llGiveInventory(llDetectedKey(0), notecard1); } else if(mes == "NOTE2"  { llGiveInventory(llDetectedKey(0), notecard2); } else if(mes == "NOTE3"  { llGiveInventory(llDetectedKey(0), notecard3); } else if(mes == "NOTE4"  { llGiveInventory(llDetectedKey(0), notecard4); } } }
|
|
Eiji Mayo
Registered User
Join date: 5 Jun 2007
Posts: 79
|
06-18-2007 17:24
XD (^_^) thank you VERY VERY much. but I couldv'e just done with help on what to do(^_^) I'll use this script as reference though... again: THANK YOU VERY VERY VERY VERY VERY VERY MUCH!!!(^_^) this will help out alot!
Eiji Mayo
|
|
Eiji Mayo
Registered User
Join date: 5 Jun 2007
Posts: 79
|
06-18-2007 17:53
hmmm... It will do everything except give me the notecard XD works great other then that though(^_^)
|
|
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
|
06-18-2007 18:53
Chances are: llGiveInventory(llDetectedKey(0), notecard1); Should be: llGiveInventory(llDetectedKey(0), "notecard1"  ; To give the notecard named "notecard1" from inventory. Also make sure you got all the uppercase/lowercase stuff right.
|
|
Solomon Devoix
Used Register
Join date: 22 Aug 2006
Posts: 496
|
06-18-2007 18:54
llDetected* only work inside events like touch* and sensor, not inside listens. So just declare a global variable of type key and store the llDetectedKey(0) to it in the touch event, and then replace the llDetectedKey(0) commands in the listen event with the name of your global key variable you used to store the llDetectedKey(0) value.
|
|
Eiji Mayo
Registered User
Join date: 5 Jun 2007
Posts: 79
|
06-18-2007 19:57
>_< I thought something was screwy XD. So I don't need the 'listen' command? what about the 'state_entry'? I don't think that is need either... I don't want typed commands anywayXD needs to be able to jsut click either button [01] or [02] to open the corresponding notecard(book). It will open the dialog when i touch the object, but when I click either button it does nothing O>_<O
|
|
Eiji Mayo
Registered User
Join date: 5 Jun 2007
Posts: 79
|
06-18-2007 20:29
P.S. ( sorry for the double post by the way) The script you offered IS helpful(^_^) it got me this far, so thank you. I was not being rude, I was just saying what is was NOT doing. I do appreciate the fact that you are willing to help a fellow coder(^_^);
|
|
Solomon Devoix
Used Register
Join date: 22 Aug 2006
Posts: 496
|
06-18-2007 21:34
No, you still need the listen. When someone clicks on a button choice on a blue dialog box, that causes their answer to be said, and you need a listen to hear it.
You just need to store the name of the person who touches the item (in the touch event) and use that stored name in the listen event when giving the inventory, instead of using the llDetectedKey(0) in the listen event.
|
|
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
|
06-18-2007 23:35
er above was right, you can't detect in a listen, llDetectedKey should be just id, since key is passed into the listen event. Plus I missed quotes. integer channel = 1000; default { state_entry() { llListen(channel,"", "",""  ; } touch_start(integer total_number) { llDialog(llDetectedKey(0),"My NoteCard Giver Menu Thing",["NOTE1", "NOTE2", "NOTE3", "NOTE4"],channel); } listen(integer chan, string name, key id, string mes) { if(mes == "NOTE1"  { llGiveInventory(id, "notecard1"  ; } else if(mes == "NOTE2"  { llGiveInventory(id, "notecard2"  ; } else if(mes == "NOTE3"  { llGiveInventory(id, "notecard3"  ; } else if(mes == "NOTE4"  { llGiveInventory(id, "notecard4"  ; } } } Maybe second times a charm
|
|
Eiji Mayo
Registered User
Join date: 5 Jun 2007
Posts: 79
|
06-19-2007 13:09
YES! it worked thank you SOOOOOOOOO much!
|