Jump to content

Help with notecard reader?


You are about to reply to a thread that has been inactive for 4742 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have found several scripts on the wiki, and have mixed and matched them to get what I need. What I have compiles well, and works fairly good, but I have a few problems that I need help with.

This script is supposed to make it where a person clicks the object, and pays the specified amount, and then they receive a random object from the objects inventory.

It will email the owner when the items contents become empty, and is supposed to use llSay to say what is specified when it is touched if the object is empty.

Here is what I have: (Please read the rest of my question at the bottom below the two codes)

 

EDIT

 

 

And here is the notecard:

 

EDIT

 

 

This is all working really well, but when i click it when it is empty, it doesn't display (say) the "empty_object_alert" message.

Next question, when I change the price in the notecard, it doesn't update on the object, unless I create a new object, and place the script and notecard into it.

And the final question, How would I make it where i can specify multiple lines on the main_hvr_txt? I can do so by placing \n in the script itself, but when I try that in the notecard, it will just say for example "This is \n hovertext" without breaking the line.

 

I appreciate if anyone can help me with this, I tried to make my questions as clear as possible, but if I need to clarify something, please let me know.

Link to comment
Share on other sites

For your first problem (it doesn't say anything when touched while empty)

llSay(50, (string)empty_object_alert);

Here your channel number is 50. Only when you use channel 0 it will be visible in actual chat. So:

llSay(0, (string)empty_object_alert);

 

 

 

For prices not updating. Hm.. are you actually changing the notecard thats in the object? And not the one in your inventory

 

For the \n stuff: If it reads that from notecard i think the actual string contains \\n. So it escapes the \ to turn it into a character \ rather than one for escape codes. You probably can search for \\n using llSubStringIndex and replace ist with \n (I don't know if theres a replace function but if not use llGetSubString

Theres also a custom-made replace function: str_replace

Link to comment
Share on other sites

quick and dirty \n from text replacer

inputString = llDumpList2String( llParseStringKeepNulls( inputString, ["\\n"], [] ), "\n" );

 

the problem with the notecard not being re read, I'm not sure about.... but I do see that you are resetting the whole script when you get ANY changed event when it's in the second state, you really don't want to do that... that's where you should be checking if the notecard key is the same as the saved key, then if it's not, change back to the default state which will rerun init and update it

if (CHANGED_INVENTORY & change){    if (llGetInventoryKey(notecard_name) != notecarduuid){        state default;    }}
Link to comment
Share on other sites

Price not updating happens when you have touched the object, and it is set to CLICK_ACTION_PAY but not paying it. Regardless you re-read a new price from the notecard, the object will not update the price untill you set

llSetPayPrice(PAY_HIDE, [price,PAY_HIDE,PAY_HIDE,PAY_HIDE]);

 

agian. But in your script, this will only happen when the object is payed. Set CLICK_ACTION_TOUCH when you read your notecard or update the price when you read the notecard.

 

Link to comment
Share on other sites

replace:

data = llStringTrim(llDeleteSubString(data, 0, s), STRING_TRIM);

with

data = llDumpList2String( llParseStringKeepNulls( llStringTrim( llDeleteSubString( data, 0, s), STRING_TRIM ), ["\\n"], [] ), "\n" );

note that I bolded your original code, and that it replaces "inputString" from the original, to see where it's all going

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4742 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...