Jump to content

URL script - url in object description


Catwise Yoshikawa
 Share

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

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

Recommended Posts

  • 11 months later...

This script is wonderful except that I have to reset the script every time I change the Object Description.  I wanted to be able to reset the script without re-rezzing the Object; so I tried adding llResetScript() to the touch_start event.  If llResetScript() is added after the llLoadURL(llDetectedKey(0), "Your message goes here.", gsURL) line; it does reset the script, but only after the second time the Object is touched.  The first time I touch the Object after changing the Object Description, it will still show the old URL in the menu.  Then I have to wait 10 seconds, because of the caveat; and once I touch the Object the second time, I will see the new URL in the menu.  If I add the llResetScript(); before the llLoadURL(llDetectedKey(0), "Your message goes here.", gsURL) line, the script will stop working.  I also tried experimenting by adding llResetScript() to the state_entry event, for the hell of it; and it also causes the script to stop working.  So I have concluded that the only three ways to get the new Object Description URL to register is 1.) reset the script in the Content tab manually, 2.) add llResetScript() as the last line in the touch_start event, and touch the Object when done so that the URL will change on the second Object touch, and 3.) add llResetScript() to an on_rez event and re-rez the Object when done.  I fee that Option #2 takes too long, and I don't want to re-rez the Object each time I changed the Object Description; so I'm just going to use the standard llLoadURL script on the Wiki page and edit the script contents whenever I want to change the URL.  :-/

Link to comment
Share on other sites

Wow - a lot of testing and fiddling you did - that's good.

The most obvious answer to your question is frustratingly simple

string gsURL;default {		touch_end(integer num_detected) {                gsURL = llStringTrim(llGetObjectDesc(), STRING_TRIM);		llLoadURL(llDetectedKey(0), "Your message goes here.", gsURL);	}}

 

Link to comment
Share on other sites

If you reset the script as the first thing in the touch it shouldn't be surprising that the script resets when you touch it.  That's different to "doesn't work".  If you reset the script after you open the URL it shouldn't be surprising that the URL doesn't change until next time.  That's different to "doesn't work".

There's a really simple way to make this work without any reset at all.  Just move the line that reads the description out of state_entry() - where it only happens on a reset - and into the touch.

ETA:  Well done Darkie - beat me again.  Scars, keep chatting to us in the scripting forum when you need anything.  :-)

Link to comment
Share on other sites

Wow!  It works like a charm now!!!  I'm glad I complained on here.  ;-)

Em, PeterCanessa Oh.  I know that "stopped working" wasn't a completely accurate way of describing the events that occured after I tried adding llResetScript in the wrong places in the script; but the fact is that when I touched the Object afterwards, the menu wouldn't appear so I thought I could get by with that wording without someone making a big deal about it.  I was aware at the time that I was writing my post, that it could be worded better; but the correct wording escaped me.  When I have writer's block, I can sit there however many minutes until I figure out a better way of explaining myself, which I often do because I want to be explicit; but in this case I felt that it wasn't very necessary.  You have been very helpful to me in the past, and I hope that you will continue to offer your help in the future; but I gotta say that I'm a bit disappointed that you even made an issue about that.  I know you probably feel pretty good about yourself for having so much expertise and for always assisting others, but you have to consider other people's feelings when communicating with them.  In this case it felt like you were talking down to me, and you came off as being sorta an egotistical, demeaning, a-hole.

Darkie Minotaur, thank you for understanding.  I realized the reasons why the script behaved as it did when I added the llResetScript function, but I wanted to experiment on my own using what little I knew and whatever info jumped out at me on the web.  Based on what little scripting I have seen, I thought my best course of action was to do something with llResetScript, and once I came to that conclusion the only thing left to do was to insert it at different locations to see what would happen.  I thought it would be better to make an effort first before coming to you guys for help, instead of expecting you guys (and gals) to do all the work for me.  And also, I gain a little experience and knowledge each time I do a little "fiddling" and "testing" on my own.  I do this so I'll have a clear conscience.

Link to comment
Share on other sites

I'm sorry you took it that way.  It's hard to convey tone in text and, like you, I was in a rush.

I had meant "Don't think the script has stopped working just because it's not doing what you want.  Stop and think about what it IS doing and you WILL be able to work out why".  Believe me, getting anything to 'work' at all is an achievement and it's all about debugging and debugging and debugging.  Endless frustration is the programmer's lot in life.  The simplest stuff won't work properly first time.  When you follow-through the logic you can get there.  Then the simplest change (which I'm sure you expected this would have been) will stop it working as you expected.  Two steps forward and one step back at least means you're one step forward!  As a matter of course I assume that anything I write over a couple of lines will have a mistake in it.  And that's once I've edited out the typos so that it'll even compile ^^.

So I should have said "Don't worry, nothing ever works as you expected, but it is working as its programmed.  Stop, read, think, debug and keep trying, you will get there."  I hope that sounds better.

[ETA: Yes, I do feel pretty good about my programming skills gained from long experience.  Mostly I've learnt to stop slapping myself when I still make stupid, obvious, mistakes.  If a comment from a regular sounds like "Duh!  That's so simple" it's followed by a silent "I know, because I've done it too".  A real "Duh" is usually reserved for "Come on, we've already seen you do better than this, you're not thinking it through"]

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4415 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...