Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Couple of questions: Measuring Time & Duplicating Objects

Graham Mondrian
Registered User
Join date: 16 Mar 2005
Posts: 59
03-29-2005 09:38
Hey peeps,

Im rollling together a custom game script and there are 1 or two things that i cant find examples of :-

1) I need to measure the passage of time and I cant figure out how to model it without using llSleep or while(1) which both dont seem to be interrupted by the listen handler.

2) I need to make some pieces appear in front of my board with different names. They can be renamed versions of the same inventory object but i dont get how to duplicate something as a linked object bound to the script duplicating it. The end result will be to message all of these objects in order to hide some of them on demand (they obscure the board as part of the game) and to keep a list of their link numbers.

3) Making text appear as though written on the object in question. You know like the names on the tringo board? Is there a way to do this other than to use a texture that is the entire alphabet and rotate it :P Like a pixel drawer or text overlayer?

ty in advance for all help
Graham
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-29-2005 09:47
1) http://secondlife.com/badgeo/wakka.php?wakka=llGetWallclock
http://secondlife.com/badgeo/wakka.php?wakka=llGetTime
... etc...

2) Please clarify what you mean for this one. It doesn't sound to me as though this is very easy to do "on demand" on a mobile object.

3) Xytext, unless you want to make your own texture. Alternately, you can do fun tricks with llParcelMediaCommandList and imported text, but... well, not until 1.6 is official. :rolleyes:
_____________________
---
Graham Mondrian
Registered User
Join date: 16 Mar 2005
Posts: 59
03-29-2005 09:59
From: Jeffrey Gomez
2) Please clarify what you mean for this one. It doesn't sound to me as though this is very easy to do "on demand" on a mobile object.



Hey Jeff, thanks for such a quick response.

I'll explain the full problem.

I'm building a game that hides an image and slowly reveals it. The image is on the controller script and then there will be 16-25 smaller panes (linked to the controller) covering the image that will be randomly sent a message to move out of the way and reveal part of the image. ATM I have a hard-coded "numberOfPanes" and X hard-coded panes with their name as an X,Y co-ordinate on the board i.e. "0,0" is top left pane. I wanna be able to create the panes by duplicating one in the inventory and then renaming it to its co-ordinate so i can create as many panes as i want and this can be a user customisable feature for every game.

If its just possible to duplicate them in front of the board then they dont need to be linked, I can send messages down the priv channels.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-29-2005 10:08
Oh. That's easier.

Either: Set up an object to rez them and use llRezObject.
Or: They can "duplicate" themselves via llGiveInventory as well. Be advised, however, that this can quickly get out of hand if you're not careful. :rolleyes:
_____________________
---
Rayve Mendicant
Scripts for L$5 billion
Join date: 12 Mar 2005
Posts: 90
03-29-2005 18:57
about that #2 :)

after you rez the object you'll want to call llCreateLink within the object_rez event and then do your list.

If I understand correctly though, I would go about this a totally different way.
I'd set the alpha of the tile to 1 when covering the object and then use llSetAlpha(0) to make the tile "disappear" you can even fade it away by using a for loop and decrementing to 0.

much more efficient than rezzing new objects and linking them and messing with all that.

hope this helps.

Rayve Mendicant AKA cell Neutra
Pushing The Limits
Jonathan Shaftoe
... the titleless.
Join date: 11 Feb 2005
Posts: 44
03-30-2005 03:35
Regarding the duplicating items, I had a similar requirement for the go game, and this is how I solved it, so this may or may not be helpful for you, but anyway.

I needed a grid of 20 objects, each with a script in which listens for link_messages and reacts accordingly (in my case moving around rather than appearing/disappearing). So, I create one script which does the link_message handling and has a global variable called gIndex. I initialise this to 0 by default, but also nave an on_rez handler which sets it to the value passed into the on_rez event.

Next I create my object, put the above script in the object, then take it into my inventory. Then I create an instance of the object, and put a copy of itself in its inventory. Then I drop in a 'rezzing/linking' script. This essentially just loops the required number of times (19 in this case, as I want 20 objects in total) calling llRezObject to rez a copy of the object from its inventory, passing the loop counter (which starts at 1 not 0) as the parameter. I also have an object_rez handler in this script which in turn calls llCreateLink so each rezzed object gets linked together (naturally you'll also need to set up the required permissions for this to work). This rezzing/linking script then removes itself once it's finished. Note it will take a little bit of time, as both rezzing and linking incur a one second delay, which is why I do this with a separate script so it's all set up before the main script runs.

So now I have an object made up of 20 of these individual objects, each with a script in it with an index value set to 0, 1, 2 etc. I can now drop this object into the inventory of my main parent object, and as part of its initialisation it rezzes this object and links it. It can then send linkmessages to LINK_ALL_CHILDREN, which will be received by each of the 20 objects, which can use the index value to decide if the link message is meant for it and act accordingly (far easier than trying to work out actual link numbers to send a link message to a specific object). Mapping the single 0->19 index number to a 'coordinate' is fairly trivial and left as an exercise for the reader.

Hope that's of some use. I'd post actual code but I'm at work and don't have it here :)