Pamela Galli Posted November 2, 2013 Share Posted November 2, 2013 or maybe Chat on Rez? I would like my prop to say something when it is rezzed. Can someone point me to a script that will do this?Thank you! Link to comment Share on other sites More sharing options...
Dora Gustafson Posted November 2, 2013 Share Posted November 2, 2013 on_rez( integer p ){ llSay( PUBLIC_CANNEL, "Something");} See on_rez event :smileysurprised::smileyvery-happy: (the above is not a script but can be included in a script) Link to comment Share on other sites More sharing options...
Pamela Galli Posted November 2, 2013 Author Share Posted November 2, 2013 Thank you Dora :-) Link to comment Share on other sites More sharing options...
LepreKhaun Posted November 4, 2013 Share Posted November 4, 2013 Dora Gustafson wrote: on_rez( integer p ){ llSay( PUBLIC_CANNEL, "Something");} See on_rez event :smileysurprised::smileyvery-happy: (the above is not a script but can be included in a script) Careful, that should read PUBLIC_CHANNEL. Link to comment Share on other sites More sharing options...
steph Arnott Posted November 4, 2013 Share Posted November 4, 2013 Could never see the point in that as it is 13 characters longer than 0.:smileywink: Link to comment Share on other sites More sharing options...
Dora Gustafson Posted November 4, 2013 Share Posted November 4, 2013 Readability! Nowadays we have computers to store information so we can shift memory load from brain to computer :smileysurprised::smileyvery-happy: Link to comment Share on other sites More sharing options...
PeterCanessa Oh Posted November 4, 2013 Share Posted November 4, 2013 Goody; another "question of style"; I enjoy these :-) Apart from being able to read and remember a name more easily than a number predefined CONSTANTS (such as PUBLIC_CHANNEL, NULL_KEY, etc.) give you a bit of insurance. Unlikely as it is LL could change the main chat to something other than 0. The compiler will know this and substitute the correct number without you having to change your source code. It can also make it easier to make quick changes when you want to - there are likely to be a lot more '0's in a script than "PUBLIC_CHANNEL"s so a simple replace-all won't work. As a chat-specific thing I also tend to use DEBUG_CHANNEL quite a bit so I'm not spamming people while testing. Link to comment Share on other sites More sharing options...
steph Arnott Posted November 4, 2013 Share Posted November 4, 2013 So llSay(0,"public_chan") is difficult to remember? ADDED: OK, Lets do it this way. code _I talking to everyone with in a 10 meter radii on the public channel "hi it me "throttle output to that range limit (that's readable.) GOD gave us brains and memory, humans rely to much on computers to prop up laziness. This is a 64k memory limit not 900Mb. Human nature always goes for the easy to remember option. And you spelled it incorrect so it would not work any way. Just another way of creating a bug. which way do you all use? This llSay(0,"public_chan") or this llSay(PUBLIC_CHANNEL,"public_chan") Link to comment Share on other sites More sharing options...
LepreKhaun Posted November 4, 2013 Share Posted November 4, 2013 I tend to use PUBLIC_CHANNEL, for the reasons already given, but I might use 0 in a quickie one-off. But it really is just a matter of style. My preference is always for one of the +500 LSL constants, which LSL Editor autocompletes for me. And out of all those constants, http://wiki.secondlife.com/wiki/Category:LSL_Constants, I doubt more than two or three of them (if any) have fewer characters than the number they represent. But, frankly, trying to recall the exact number to use for DEBUG_CHANNEL or ATTACH_HUD_BOTTOM is going to be time better spent writing my script, not to mention making my script almost unreadable if I didn't make use of these constants Link to comment Share on other sites More sharing options...
steph Arnott Posted November 6, 2013 Share Posted November 6, 2013 I think about that. But I really detest the use of PUBLIC_CHANNEL to spew out no relevant info to others when the message is of use only to the owner and/or the agent. Also I was not really referring to other constants just this one. ADDED: LepreKhaun. Most LSL beginners use the in built editor so as the example above shows, a constant that can produce an error in typing is not very helpful and "0" unless one types o is almost impossible to get wrong. I accept what you saying about constants, but this one. I can see no need for it. I can only assume that this is a programmers rule. Link to comment Share on other sites More sharing options...
LepreKhaun Posted November 8, 2013 Share Posted November 8, 2013 steph Arnott wrote: I think about that. But I really detest the use of PUBLIC_CHANNEL to spew out no relevant info to others when the message is of use only to the owner and/or the agent. Also I was not really referring to other constants just this one. ADDED: LepreKhaun. Most LSL beginners use the in built editor so as the example above shows, a constant that can produce an error in typing is not very helpful and "0" unless one types o is almost impossible to get wrong. I accept what you saying about constants, but this one. I can see no need for it. I can only assume that this is a programmers rule. Back in 1991, in the 1st edition of Programming Perl (known as the Camel Book), Larry Wall said "We will encourage you to develop the three great virtues of a programmer: laziness, impatience, and hubris." You are certainly on your way to developing all three, Steph. Link to comment Share on other sites More sharing options...
steph Arnott Posted November 8, 2013 Share Posted November 8, 2013 Not sure what you mean? Link to comment Share on other sites More sharing options...
PeterCanessa Oh Posted November 8, 2013 Share Posted November 8, 2013 steph Arnott wrote: Not sure what you mean? Take it as a compliment, Steph, even though laziness, impatience and hubris are not usually virtues :-) Good programmers are lazy - we prefer the easiest/quickest solution that works. Programs using 'what works', work. Good programmers are impatient - whenever we do mess around with 'what works' it's to make it even easier to write, maintain and execute. Almost everything can be improved. (Not sure about this one) Good programmers are full of hubris - if we manage to find a 'better way' we show-off like mad about it. Everyone else can be lazy thanks to what we discovered. That you have understood what we've said about PUBLIC_CHANNEL and other constants but have your own reasons for not using it demonstrates that you have your own style. :-) This is all about 'a question of style' remember :-) What works for you is what you should use, unless you find a better way - in which case please tell us. Cool :-) Link to comment Share on other sites More sharing options...
LepreKhaun Posted November 10, 2013 Share Posted November 10, 2013 That statement caused so much discussion amongst programmers at the time, the glossary of the 2nd edition of Programming Perl included this: Laziness The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don't have to answer so many questions about it. Hence, the first great virtue of a programmer. Impatience The anger you feel when the computer is being lazy. This makes you write programs that don't just react to your needs, but actually anticipate them. Or at least pretend to. Hence, the second great virtue of a programmer. Hubris Excessive pride, the sort of thing Zeus zaps you for. Also the quality that makes you write (and maintain) programs that other people won't want to say bad things about. Hence, the third great virtue of a programmer. [it might be noted that it didn't stop the discussion btw. However, it did point how this "vices" could be regarded as "virtues" when it came to programming. And, yes, I meant to be complimentary.] Link to comment Share on other sites More sharing options...
steph Arnott Posted November 10, 2013 Share Posted November 10, 2013 LepreKaun wrote And, yes, I meant to be complimentary.] _______________________________________________________________________________________________ I did not think you meant it as an insult, i just did not know what it was refrenced to. But thanks for the update. All this free education, lol. Link to comment Share on other sites More sharing options...
LepreKhaun Posted November 10, 2013 Share Posted November 10, 2013 Here's a link to a (minor) collection of some of the discussion this generated at the time in the Usenet groups http://c2.com/cgi/wiki?LazinessImpatienceHubris A lot of sidelinks there as well to related discussions, all still entertaining/informative reading for geeks and programmers. 1 Link to comment Share on other sites More sharing options...
steph Arnott Posted November 10, 2013 Share Posted November 10, 2013 I will read thru it, have saved the link, thanks. Link to comment Share on other sites More sharing options...
Yingzi Xue Posted November 14, 2013 Share Posted November 14, 2013 The best argument for constants, for future compatibility, is the winning argument for using them. However, allow me to digress... I admit, I prefer to use 0 instead of PUBLIC_CHANNEL. For me personally, since I'm the only one that ever sees the actual code, I can read it just as easily as I can PUBLIC_CHANNEL. In fact, I prefer the code to be a bit obscure, because it's a good reading exercise to be able to scour through code that might not have everything labeled and perfect and get the gist of what's going on. It's like word find puzzles; the more you do them the better you get at picking things out of obscurity. Don't get me wrong, the merits of using ALL constants (I use quite a few, just not PUBLIC_CHANNEL) far outweighs what I just described, but hey... I like to be difficult and set in my ways. LOL Sometimes we can take LSL so seriously (and programming in general) that we become stuffy and set in our ways. Constants are there for ease of use. They're optional. You may have just convinced me to make a change though, for the best of 0... er I mean PUBLIC_CHANNEL. Link to comment Share on other sites More sharing options...
Recommended Posts
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