Scripts – Hypergrid Business https://www.hypergridbusiness.com Covering virtual reality, immersive worlds, and other emerging technologies Tue, 25 Apr 2023 13:56:59 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 https://www.hypergridbusiness.com/wp-content/uploads/2019/02/cropped-HB-logo-512-32x32.png Scripts – Hypergrid Business https://www.hypergridbusiness.com 32 32 Free gates on Hyperica https://www.hypergridbusiness.com/2014/10/free-gates-on-hyperica/?utm_source=rss&utm_medium=rss&utm_campaign=free-gates-on-hyperica https://www.hypergridbusiness.com/2014/10/free-gates-on-hyperica/#comments Sun, 19 Oct 2014 18:37:48 +0000 https://www.hypergridbusiness.com/?p=48393 Now that the Hyperica hyperport is starting to get into shape, I’ve set out some free hypergates for people.

Just teleport over to hg.hyperica.com:8022 and pick them up.

I’ve got some all-in-one gates, like the one from The Hypergates, and a Blamgate from Pathfinder, and Diva Canto’s teleporter.

That's a gate from The Hypergates in the background, and a couple of boxed panels on the counter.
That’s a gate from The Hypergates in the background, and a couple of boxed panels on the counter.

The gate from The Hypergates is the one that looks like a Stargate, and you can dial it to go to any destination on their network.

And I’ve also got some two-piece gates, where you slide a square or circular panel inside any frame you like.

Linda Kellie's Froggy gate, Pathfinder's Blamgate, and Diva's Teleporter.
Linda Kellie’s Froggy gate, Pathfinder’s Blamgate, my castle gate, and Diva’s Teleporter. Telephone booth gates are boxed on the counter.

For example, you could use Linda Kellie’s Froggy gate, and slide in my circular panel gate. Each gate works differently.

My panels, for example, are programmed by changing the name of the object to the name of the destination, and the description to the hypergrid address. Then click once on a panel to set it, and walk through it to teleport. The panels automatically go black if the destination is down.

The flat panel has a white label on top with the name of the destination. The round panel has hovertext.

I personally prefer not to use hover text since it’s kind of hard to see, but it does open up a lot of design options.

What the round panel looks like up close.
What the round panel looks like up close.

If you just want the script for the round gate with hover text, you can download it here: MetaMarias Round Hypergate Panel Script with Hypertext v1.0

To use the round gate script, just create a cylinder, flatten it, rotate it to the orientation you want, and put the script in it, and the texture below on the top face:

CC0 portal 16-cell animation
(Click for full-size image.)

All of my content is CC0 licensed, for use in any way whatsover, as is Linda Kellie’s. The other gates have their own license terms.

]]>
https://www.hypergridbusiness.com/2014/10/free-gates-on-hyperica/feed/ 2
Hypergate script with region restart fix https://www.hypergridbusiness.com/2014/10/hypergate-script-with-region-restart-fix/?utm_source=rss&utm_medium=rss&utm_campaign=hypergate-script-with-region-restart-fix https://www.hypergridbusiness.com/2014/10/hypergate-script-with-region-restart-fix/#comments Sun, 19 Oct 2014 06:56:21 +0000 https://www.hypergridbusiness.com/?p=48389 The Hyperica hyperport gets a decent amount of traffic, and has a few scripts running on it. Plus, I recently rearranged the grid, and my hosting company updated our software.

Let’s just say that region restarts are common place.

And my gate scripts kept breaking.

It’s turns out, this wasn’t a coincidence. Fred Beckhusen tracked down the problem, and it was in the llDetectVolume command. This script command allows a gate to be phantom, allowing avatars to walk through it, but still detect it as a collision.

And it gets reset the wrong way when a region is restarted.

Beckhusen posted a fix to the problem, which I incorporated into my script.

I’ve also set it up so that it automatically changes the size of the font based on the length of the name of the destination. It’s adjusted to fit well with the gate frames I have. If you have differently-shaped frames, you may need to fiddle with that.

You can download the new script here: MetaMarias Hypergate Panel Script v1.0

Now, I have a lot of gates up on Hyperica. And, like anyone else running a hyperport, I find that updating all these scripts is a never-ending challenge.

Fortunately, Beckhusen saved the day here, as well, pointing me to his script in the Phaze Demesnes free LSL script library that allows me to update all the scripts in all the gates all at once, from a single controller. Whoo hoo!

It was remarkably easy to use. I put the client script in my gate prim. And the control script in a controller box. Then I put a gate script in the gate prim. When I dropped an updated version of that same script — with the same name — in the controller box, is was automatically sent to the gate prim.

Or, at least, in worked in my lab!

Newly updated gates on Hyperica.
Newly updated gates on Hyperica.

Assembling the gate

To put a working gate together, you need four things — the script above, a swirly water animation, a flat panel for the gate, and a frame to go around the whole thing.

To create the gate, rez a box, change the texture to plain white, and change the following settings, leaving the rest to their default values:

  • Size X: 3
  • Size Y: 4
  • Size Z: 0.005
  • Rotation X: 90
  • Taper Y: 1
  • Top Shear Y: 0.25

Click on “Select Face” and put this water texture on just the bottom panel:

CC0 portal 16-cell animation

Adjust the scale on the bottom panel:

  • Horizontal scale: 0.25
  • Vertical scale: 0.25

For the white section on top, adjust the texture scale to the following:

  • Horizontal scale: 1
  • Vertical scale: 0.25

Then build a frame around the whole thing using any materials you’ve got on hand, like this:

The gate is just the flat panel and can be slid into a gate frame.
The gate is just the flat panel and can be slid into a gate frame.

The reason I switched away from my old round gates to this style of gate is because I can have the text label generated by the same script that operates the gate, and because it’s easier to walk into when it has a flat bottom. You can just as easily make the gate frame a full circle, of course.

Also, I prefer to use text labels instead of hover text because hover text is hard to see — and it doesn’t work at all with the Oculus Rift.

]]>
https://www.hypergridbusiness.com/2014/10/hypergate-script-with-region-restart-fix/feed/ 5
Easier Google Spreadsheet Visitor Logger https://www.hypergridbusiness.com/2014/10/easier-google-spreadsheet-visitor-logger/?utm_source=rss&utm_medium=rss&utm_campaign=easier-google-spreadsheet-visitor-logger https://www.hypergridbusiness.com/2014/10/easier-google-spreadsheet-visitor-logger/#comments Thu, 09 Oct 2014 02:50:35 +0000 https://www.hypergridbusiness.com/?p=48164 One of the most popular articles on this site is Log your visitors to Google spreadsheet, which I wrote in 2012, and which Zuza Ritt updated the following year.

Here’s an easier way to do it, and the script to go with it.

Step One: Create the form

Sign in to your Google Drive (formerly Google Docs) account, click on the big red “Create” button and select “Form.” Name it something like “Visitor Tracker” or “My Guestbook” — the title doesn’t matter.

Then add exactly two questions, both plain text fields. Name the first Location and the second Avatar.

Create new form -- step one

You might see some settings options at the top of the form — leave them all unchecked.

Step Two: Get the special Google Forms link

Now look up at the menu, and under “Responses” click on “Get Pre-filled URL.”

Prefill form -- step two

Under “Location” type the word “Location.”

Under “Avatar” type the word “Avatar.”

Hit “Submit.”

You will get a long link to copy. Copy that link.

Save link -- step three

Step Three: Use that link to create the visitor logger

Now go in-world. Create any old object. Paste the link you copied into the description for that object.

Then cut and paste the following script into it:

Easier Google Spreadsheet Visitor Logger

The script pulls all the info it needs out of that link, and doesn’t need any further editing or configuration.

This script records a time stamp, and saves both the region name and the grid name. So you can use it on multiple regions. Or, say, if you have stores on several grids, you can track all of those visitors in a single spreadsheet.Visitor spreadsheet

This script records a time stamp, and saves both the region name and the grid name. So you can use it on multiple regions. Or, say, if you have stores on several grids, you can track all of those visitors in a single spreadsheet.

Next, I plan to add in a landmark giver and put it into a welcome medallion that would go on the ground in the middle of the welcome area.

When that’s done, I’ll put the whole thing up on the Kitely Market.

Visitor Logger

A hard-coded alternative

For some reason, once I moved the script to another grid, it stopped working. In particular, the osGetGridName command returned an error message instead, and the llParseString2List function insisted on working incorrectly — breaking up a number into two pieces even though there was no separator or spacer there. (If anyone has heard of this happening, please let me know!)

So here’s an alternative to the above script in case other people have similar issues. Instead of copying-and-pasting the long submitted form URL, you have to open up the script and paste it into the first three lines of the script.

Parsing the form URL

Copy everything in the first half of the URL — up to, but not including “/viewform?…” and paste it into the first line. Do not include the slash. The first line of the script currently says the following:

string FrontPart = "https://docs.google.com/forms/d/#########################################";

So this script will not work out of the box — you will have to update it with your own info.

Then the second line in the script sets the LocationKey, which is the next longer number in the URL, the third line sets the AvatarKey, which is the last long number in the URL.

Finally, the fourth line lets you set the grid’s name.

So you still have to edit the script, but at least you don’t have to look around for where to make the edits. By hardcoding this data, it also makes the script shorter and less liable to break.

It still looks up the current region name, so as long as you have it on the same grid, once you have it updated with your own info you can just copy this script around to any object that needs it.

Download the script here: Easier Google Spreadsheet Visitor Logger — hardcoded

]]>
https://www.hypergridbusiness.com/2014/10/easier-google-spreadsheet-visitor-logger/feed/ 33
Hypergate script with built-in threat level check https://www.hypergridbusiness.com/2014/09/hypergate-script-with-built-in-threat-level-check/?utm_source=rss&utm_medium=rss&utm_campaign=hypergate-script-with-built-in-threat-level-check https://www.hypergridbusiness.com/2014/09/hypergate-script-with-built-in-threat-level-check/#comments Mon, 29 Sep 2014 23:50:42 +0000 https://www.hypergridbusiness.com/?p=48003 The gate is just the flat panel and can be slid into a gate frame.
The gate is just the flat panel and can be slid into a gate frame.

One annoying problem I’ve had with hypergate teleport scripts is that some regions have the right threat level settings to run walk-through scripts, while others don’t, and require a different command to activate the teleport.

Users had to know what their threat levels were — and who knows that? And they were the wrong types of threat levels, the users had to go into the script and edit it, replacing one command with another — and who wants to do that?

Unfortunately, there’s no function in OpenSim to tell you what the threat levels are. Which is too bad — it would be convenient to have one.

But there is a work-around, and it’s explained on this page.

The sample script provider loops through and checks the availability of most of the major functions you’d want to run. And I recommend that you grab a copy to use until someone creates an OSSL command.

But I only needed to check one function — osTeleportAgent. So I rewrote the script just to check that one function. If you need to check just one function for a script you’re writing, here it is: Check for osTeleport function.

Then I took that script, and smooshed it together with my easy hypergate script, updated with my own special effect, and moved the various pieces around until it worked.

Just put the script in any object, change the name of the object to the name of the destination, and the description to the destination’s hypergrid address. The script even checks whether the destination region is active or not — and turns black if its down.

I recommend creating a flat panel for the gate itself — as described here — and making the frame of the gate a separate object.

Download the CCO hypergate script for flat panel with whoosh, status and threat level check.

I’ve also updated the Kitely Market listing for this gate.

]]>
https://www.hypergridbusiness.com/2014/09/hypergate-script-with-built-in-threat-level-check/feed/ 5
Sound and explosion effects for hypergate portal https://www.hypergridbusiness.com/2014/05/sound-and-explosion-effects-for-hypergate-portal/?utm_source=rss&utm_medium=rss&utm_campaign=sound-and-explosion-effects-for-hypergate-portal https://www.hypergridbusiness.com/2014/05/sound-and-explosion-effects-for-hypergate-portal/#respond Thu, 29 May 2014 22:20:34 +0000 https://www.hypergridbusiness.com/?p=46451 Today, I decided that what my gates were missing were sound and light effects. Other gates had whooshing noises and particle explosions — I wanted them, too.

I couldn’t find any that I liked. Maybe I didn’t search hard enough but anyway, I looked up the instructions for llPlaySound and llParticleSystem and — after a couple of hours of trial-and-error — created my own.

The script attached is completely public domain, CC0 license, for use in any way, shape or form, including commercial. Go nuts.

Particle effect
I can’t get enough of that light show.

Put the script on any box, touch it, and watch the effects. Feel free to play around with the numbers on the llParticleSystem parameters to change the particle colors, sizes, speed, and other attributes. I recommend changing one number at a time to see what it does. Or you can use this handy particle effects tutorial here.

When I put the script inside a gate, however, I plan to change it so that it’s activated when someone walks into a gate, instead of when someone touches it.

The sound effect is actually the system teleport sound.

llPlaySound("d7a9a565-a013-2a69-797d-5332baa1a947", 1);

Makes a very nice whoosh-y noise, and, of course, the teleport sound is appropriate. You can find more system sounds here.

Download the script here: Whoosh effect for teleports.

]]>
https://www.hypergridbusiness.com/2014/05/sound-and-explosion-effects-for-hypergate-portal/feed/ 0
New interactive hypergate script https://www.hypergridbusiness.com/2014/04/new-interactive-hypergate-script/?utm_source=rss&utm_medium=rss&utm_campaign=new-interactive-hypergate-script https://www.hypergridbusiness.com/2014/04/new-interactive-hypergate-script/#respond Sun, 27 Apr 2014 18:32:07 +0000 https://www.hypergridbusiness.com/?p=45842 We’re in the process of redoing the Hyperica hyperport.

Part of the process is updating all the gate scripts.

Over the past couple of weeks, I’ve gone through and got rid of all the non-working scripts, so all the gates on hg.hyperica.com:8022 are usable.

It doesn’t necessarily mean that they work — the destination might be down, or might have moved. But the gate script itself is sound, though basic.

But I wanted to add a checking function, to see if the destination was actually up or not.

And to create a gate that would work better inside a nice shaped gate frame, and would also automatically show its destination as text on a prim, not just floating text, which can be hard to read.

The object on the left is the scripted functional gate. You can slide it into the gateway of your choice.
The object on the left is the scripted functional gate. You can slide it into the gateway of your choice, as I did with the gate on the right.

This is my current gate setup, which I’m sharing here.

The way it works is that you set the destination by editing the description line of the gate itself. For example, a description like “WELCOME,1” would automatically look up the top welcome region destination on Hyperica. In this case, LBSA Plaza on OSgrid.

Other options include EDUCATION, RETAIL, and VENUES. Venues are places where events are likely to happen, like clubs or concert halls.

Touch the gate and it will look up the destination on Hyperica and reset itself. It will also check if the destination is active, and turn black if it is not.

To use the gate, just walk through it. Right now, it’s set to instant teleports, but I’ve also included a line in the script for map-based teleports.

Instant teleports are nice — you walk through and bam, you’re there — but require appropriate threat level settings on your region, since the instant teleport function can easily be abused!

Map-based teleports bring up the map of the destination, and wait for the user to click “Teleport” before actually teleporting them over.

Download the script here: Hyperica Look up script 2014

]]>
https://www.hypergridbusiness.com/2014/04/new-interactive-hypergate-script/feed/ 0
Easy sticky note script https://www.hypergridbusiness.com/2014/03/easy-sticky-note-script/?utm_source=rss&utm_medium=rss&utm_campaign=easy-sticky-note-script https://www.hypergridbusiness.com/2014/03/easy-sticky-note-script/#comments Tue, 25 Mar 2014 01:35:01 +0000 https://www.hypergridbusiness.com/?p=45306 So there I am, making plans to redo the website, and put out some special reports and I realized that what I was really missing was an in-world project planning board.

Now, last time I just used a Google document and media-on-a-prim, but this time I wanted something a little bit more … tactile.

I wanted colored Post-It notes on a big board. I searched around and I couldn’t find one. Progress was stalled until I built one on my own.

Fortunately, OpenSim has a way to put text on in-world surfaces without creating a new texture each time, so the project was doable.

Unfortunately, it’s been a while since I wrote anything in LSL and I had to look up each and every command. And find out how to say “is not equal to” and set colors and everything else that goes into making a virtual Post-It.

And it’s done!

A close-up view of my new project planning board.
A close-up view of my new project planning board.

The board itself is just a single squished prim. The size is 2.5 by 1 by .005 meters, with a taper of 0.25 for both the X and Y values and a slice ending at 0.5.  It’s textured system plywood, painted brown, and the center surface is just system grass with a light violet tint to make it look vaguely like corkboard.

The little Post-It notes are just simple flat squares, 0.2 by 0.2 by 0.001. The magic is in this Post-It Script.

The way it works is that it pulls the text from the description line of the Post-It. Now, there’s no way for an object to be prodded into action once its description has been changed — as far as I know — so you also have to click it to get the text to update. I’ve set it up so that if you click it near the top of the note, it also increases the font size. If you click near the bottom, it decreases the font size. And if you click near the middle, it changes color!

Updating the text takes a few seconds since OpenSim has to generate the image. I’m hoping that they’ll speed it up. So when you click in the middle, to change the color, it only updates the text after checking to see if the description has changed, so you can cycle through the colors quickly to find the one you want.

I have four colors in the script right now, yellow, pink, violet and tan, but you can add as many as you’d like. The colors are defined right at the top of the script. I looked up the color codes for Post-Its on this Instructables page. Then, in-world, I opened an object edit menu and pulled up the color selector and used it to convert the standard HTML color values into the Second Life color codes.

Bulletin board sticky note closeup
A close-up of a sticky note.

So here’s me enjoying my new project planning board.

My Kitely avatar trying to figure out where the permission settings are going wrong.
My Kitely avatar trying to figure out where the permission settings are going wrong. Also, enjoying her new Brown Flower Heels by Sunny Whitfield.

And then I figured that other people might like this as well, and might not want to mess around with the scripts, so I decided to add it to the Kitely Market. This was an opportunity for me to test the hypergrid delivery mechanism as well, from the merchant point of view.

Now, I don’t know how other people do this, but I wanted to have people rez the board, and have the sticky notes attached to the board but not linked to it, so that they can be moved around. Or click-dragged and copied.

So I put the sticky notes inside the corkboard object and wrote a script so that when the corkboard was rezzed it would pull the sticky notes out of inventory and put them up on the side there, like they are in the picture. This required a quick refresher course on Second Life’s quarternion-based object rotation system and vector addition. Here’s the Sticky Note Rezzer Script for Cork Board if you’re interested.

Okay, I was a math major at college and kind of know my way around vectors — but how does everyone else manage this?

Then came the hardest part of all. Putting all the pieces together in such a way that the permissions worked right. I wanted everything to be full perm, so that people could do whatever they want with this thing, or take the scripts apart and use to build something new. Now, everything was created by me, completely from scratch, including the scripts. So I should have been able to set the permissions any way I wanted. You’d think — but no.

For example, I had four identical sticky  notes inside this object, different only in the object names and descriptions. I created them by shift-clicking-and-dragging. You can’t get more identical than that. But sticky note number two was full perm, and the others were no-copy, no-modify, and nothing I did would change that. After futzing around for half the afternoon, I just deleted them, and rezzed multiple versions of the second sticky note. Then, just in case, I deleted the text-based textures on these four objects, since they weren’t regular textures but created via the script, and who knows what would happen if Kitely tried to send these things out over the hypergrid.

In the end, it took almost as long to pack up these sticky notes as it took to create the original script in the first place.

Next time anybody complains about merchants overcharging for their content, I invite you to come over so I can slap you around the facial area.

So here’s the link to the Cork Board with Sticky Notes on Kitely Market.

Oh, I almost forgot to mention — this is licensed CC0. I hereby affirm that everything is completely original, and that anyone can do anything they want with these scripts, including using them commercially or reselling them. It’s all fine with me.

]]>
https://www.hypergridbusiness.com/2014/03/easy-sticky-note-script/feed/ 5
Updated Hyperica gate scripts https://www.hypergridbusiness.com/2014/01/updated-hyperica-gate-scripts/?utm_source=rss&utm_medium=rss&utm_campaign=updated-hyperica-gate-scripts https://www.hypergridbusiness.com/2014/01/updated-hyperica-gate-scripts/#comments Wed, 29 Jan 2014 05:28:37 +0000 https://www.hypergridbusiness.com/?p=44894 These scripts are for people who are thinking to themselves — now that Maria is hiring a researcher and putting them to work on updating the Hyperica directory, wouldn’t it be nice if I could just grab content from there for my own gates.

Well it would be nice, and yes you can.

For example, Hyperica has a snapshot of each destination, along with its hypergrid address. Some people might want to pull down that image to use as a background for their own hypergate system. Now, you can download the image manually, then upload it to your grid, then add it to the object.

But Hyperica has over 300 destinations — and new ones being added all the time. And old ones go down all the time, too, or change their locations. Just setting up the gates in the first place would be a nightmare, and then keeping them up to date would be a struggle.

And I have a solution. This is a script that automatically goes to the Hyperica website and downloads the region you want. That is, if you want a region in a particular category. Say, you want the highest-rated region in the shopping category. Or the second highest-rated. Or the fourth region in the grid welcome regions category. You could do that. You can set up a little hyperport with, say, the top ten shopping destinations, and if you touch it, it will automatically update itself. So all you have to do to keep it current is touch it once in a while. Or you can add a timer, if you’re an advanced user. Just don’t update it too often — if you do, you might break our servers, and we don’t have the money yet to set up an actual database to handle this stuff.

The way it works is that you change the description line of the object, touch it, and it’s programmed. No messing around with the script required — unless you want to.

Here are the lookup categories: http://www.hyperica.com/lookup/

For example, http://www.hyperica.com/lookup/?cat=1&region=5&sort=2 Would show the fifth most recent region in the Art and Culture category. To test it, just paste the link into your browser. You should get the computer-friendly info page for that destination. (I haven’t figured out how to get the footers and headers not to show up.)

Here’s the script to download. It’s a text file: Snapshot from Hyperica Lookup Script

LBSA on OSgrid snapshot in-world

Put it on a box with a Z-size of 0.010 meters, Top shear of Y=0.35, and Slice Begin and End of E=0.500.

The script uses two commands unique to OpenSim. First, it pulls an image down off the Web and puts it on the prim, without needing media-on-a-prim. So it works great with old viewers. And, second, it puts text right on the prim as well, because OpenSim has a function to write on a prim surface, in case the hanging text over the object isn’t visible.

Automatic hypergate

You can put the destination snapshot in a nice frame if you want — mine is just hanging in the air right now, looking stupid. Some day, I swear on my mother’s grave, I will make it look better.

The matching gate to the snapshot script works the same way. You put the lookup URL in the description, and drop the script onto any object you’d like to be the gate. When you touch the object, it updates itself. When you collide with the object, it triggers the teleport.

Here’s the script to download: Snapshot from Hyperica Lookup Script

I have the script in a typical watery animated circle, lying flat on the ground. It’s on a raised platform, though, so people don’t walk into it accidentally.

Hypergate with snapshot setup

You can see the full setup above. Nothing fancy.

When I step on the gate, a teleport windows pops up, offering to take me to the destination on the target grid. I can have it be automatic as well, without the confirmation window. The trick is in the first part of the script, the “PerformTeleport” section.

To teleport using the map: llMapDestination(SimAddress, LandingPoint, LookAt);

To teleport instantly without using the map: osTeleportAgent( WhomToTeleport, SimAddress, LandingPoint, LookAt );

In the script I uploaded, the second option has a double slash in front of it, meaning that it’s inactive. If your region has OpenSim scripts enabled and the threat level set appropriately, you can remove the slashes, and put them in front of the first option. If your region is hosted by a vendor, ask them to set the threat level so as to allow the osTeleportAgent function. It’s often not enabled on public grids because people can abuse it.

Imagine walking across a floor and stepping on an otherwise totally innocuous spot and being teleported to a nude lesbian beach grid. No, scratch that, who would mind? Make that a teleport to a spam grid that tries to sell you variable annuities. Oh, the horror, the horror!

You can also use the osTeleportAgent command to create bullets and swords and other weapons that, when touching an avatar, send them straight to hell. Bwa ha ha ha.

]]>
https://www.hypergridbusiness.com/2014/01/updated-hyperica-gate-scripts/feed/ 1
How to create a sign system https://www.hypergridbusiness.com/2013/05/how-to-create-a-sign-system/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-create-a-sign-system https://www.hypergridbusiness.com/2013/05/how-to-create-a-sign-system/#comments Fri, 10 May 2013 01:06:40 +0000 https://www.hypergridbusiness.com/?p=43583 So I’m building a themed region — Maria’s Virtual Fit Club — on Kitely. (Facebook group here, Kitely login link here, story about the project here.)

So, the first thing I think about, because I’m at heart a traditional newspaper layout designer, is the style template for the signs. There’s nothing I hate more than to keep having to pull up a graphics program to create signs, then import the images into OpenSim.

And I couldn’t find any simple tutorials for how to do this, so I came up with my own method. If anybody knows how to do this better, please let me know!

So, first, I created a template of 16 different sign shapes, and a template of 16 different symbols, with the idea that I could layer them and put text in front of them and create quick-and-easy themed signs in-world.

Here’s my sign shapes template:

Sign shapes.
Sign shapes.

The white background is actually transparent. I’d upload the actual GIMP file, but WordPress won’t let me. The shapes are all made from scratch, and if you want to use this, feel free. The license terms are CC0, which is functionally equivalent to public domain.

And here is my symbol template:

Navigation Symbols

I tried to put on one texture all the most common navigation signs you’d need on a region. Again, I can’t upload the original GIMP file. The source material for these icons is Clker, which has public domain icons and clip art.

Then I upload the texture to a sign, and use this script to click through each of the 16 frames until I get to the sign I want: Texture Animation Script by Renee Roundfield.

To put the text in front of the sign texture, I wrote my own script, using OpenSim’s text-on-a-prim functions. Click here to download it: Draw text on transparent background.

Change the first couple of lines to replace the title text. You can also change the size of the text and the color of the text by editing the next couple of lines.

You can also change the font itself with OSSL. Add the following line:

DrawList = osSetFontName(DrawList, “Times”);

The default font is Arial, and you can also set it to Courier. I’ve tried out all three and they work, but I haven’t found out if there are any other fonts that can be used instead.

So the idea is, you create your sign, and put a new, transparent prim right in front it, load it with your sign text script, and just change the first lines of the script anytime you need new text for a sign.

Simple sign

Unfortunately, because of the transparency layering problem, I will need to go back and redo the sign templates so that they don’t have any transparency in them — otherwise, the text floating in front will disappear at random moments.

On a side note, you can modify the script so that signs change automatically. For example, they could welcome visitors by name, or say how much time is left until the next event starts. Another option is to pull the text of the sign from the description line, which would make it even easier to change.

]]>
https://www.hypergridbusiness.com/2013/05/how-to-create-a-sign-system/feed/ 5
Free database for OpenSim scripts https://www.hypergridbusiness.com/2012/12/free-database-for-opensim-scripts/?utm_source=rss&utm_medium=rss&utm_campaign=free-database-for-opensim-scripts https://www.hypergridbusiness.com/2012/12/free-database-for-opensim-scripts/#comments Sat, 08 Dec 2012 04:06:45 +0000 https://www.hypergridbusiness.com/?p=42429 Update Apr. 25, 2023: It looks like I ran out of the free trial credits on the Google App engine, and my original app no longer works. You can create your own, however — instructions at the bottom of this article. Plus, the folks at Outworldz have put up their own clone, at outworldz.appspot.com., which still works, so I’ve changed all my links and the sample scripts to use the Outworldz version.

Late last summer, I had an idea for a hypergate script that would automatically calculate the distance to your destination’s address and, if it was too far away, send you to a mid-way transit gate on Hyperica, and then that gate would send you on to your destination.

However, this required a way for gates to communicate with one another, even if they were located on different grids. Now, there is a way for objects to send messages to one another via LSL, but it requires knowing the object’s HTTP address — and this HTTP address can change. So I needed a way for the hypergates to look up the HTTP addresses of the mid-point transit gates, in order to find out whether they were available, and to tell them the final destination the avatar wants to go to.

I needed a permanent way to save data.

Many scripts in OpenSim need to store variables, someplace where they won’t disappear.

Say, for example, you have a house that changes colors. And you want it to remember the color it was set to last, so you don’t have to keep setting it each time you rezz the house. You can add the color — say, “blue,” to the description line, but if you change the description, you lose the data.

If you had some permanent way to store the variable, then you could, say, change the color of that same house everywhere — even on other grids — when you change any one instance of it.

Okay, maybe that’s not so useful, but you could also use the same method to, say, send messages across grids, or update the location of hypergates, like what I needed — or set high scores for a particular game.

Earlier, I used a Google Spreadsheet to store data. Here’s my sample script for logging visitors to a Google Spreadsheet, and another one for displaying the data from a Google Spreadsheet.

The downside to using Google Spreadsheets is that you can only add rows of data — you can’t edit existing rows. Unless you can figure out the Google API and authentication mechanism, which I couldn’t. If anyone can, and can write a sample script to edit existing rows of data, please please let me know! And you also can’t search through data — you can only load the entire sheet and then search through it inside the script. And there’s only so much text you can load at once. I assume — I don’t know what the limits are here.

So I was looking for a way to save data into some database somewhere — ideally, a free database. A way to update that data. And a way to find that data.

I turned to Latif Khalifa’s Grid URL Persister for inspiration. It uses a Python script running on the Google App Engine, a free, cloud-based place to deploy applications and databases. Well, free for small projects — if you’re running something big and commercial on it, you’d have to pay some dough. But the limits on the free account are pretty good — you get ten free applications, 1 gigabytes for data storage, and 3,000 free calls a minute — more than half a million a day.

So I’ve been tinkering around with the Google App Engine ever since then, going through their tutorials, setting up the launcher on my desktop, deploying their sample Guestbook application, trying to figure out what the Go language was.

Finally, early this week, I decided to buckle down and just get it done. Based on advice from InWorldz CTO David Daeschler and InWorldz software developer Jim Tarber, I switched from Go to Python, the language Khalifa’s application was written in.

And … ta da! … here it is: the Hypergrid Business Easy Free Database.

Here’s the way it works.

First, you need to get a unique identifier for your LSL script. You can use a different one for each script, or, if you want to share data across several scripts, you can use the same identifier for all of them. You can get an identifier here. Don’t lose this — if you do, you will lose all your data!

Second, load the following URL to save data:

http://hbeasydatabase3.appspot.com/store?service=<service id>&keyfield=<name for the data>&datafield=<data to be stored>

The bold items are the ones you replace your own own data. Say, for example, you want to save high scores for two games, Bingo, and Blackjack. You get a new service ID, and invent key names for the data — BingoHighScore and BlackjackHighScore. Store the data by going to the following URLs:

http://outworldz.appspot.com/store?service=2b307c02-2133-4dba-bcc5-3d8f7db53eee&keyfield=BingoHighScore&datafield=786763

http://outworldz.appspot.com/store?service=2b307c02-2133-4dba-bcc5-3d8f7db53eee&keyfield=BlackjackHighScore&datafield=234873

Later on, you want to get these high scores back. You can look them up again by pulling up the following URLs:

http://outworldz.appspot.com/load?service=2b307c02-2133-4dba-bcc5-3d8f7db53eee&keyfield=BingoHighScore

http://outworldz.appspot.com/load?service=2b307c02-2133-4dba-bcc5-3d8f7db53eee&keyfield=BlackjackHighScore

Go ahead, give it a try.

If you also want to save the avatars who had the high scores, you can create two new key names, such as BingoHighScoreAvatar, and BlackjackHighScoreAvatar.

There might be a limit on how long you can make the key names, and how long the data strings are, but I don’t know what it is. If you have key names or data that has spaces or other characters in it, that’s fine, but you will need to encode them for the URL.

So, for example, if “John Smith” got the high score for Bingo, you would save it with the following URL:

http://outworldz.appspot.com/store?service=2b307c02-2133-4dba-bcc5-3d8f7db53eee&keyfield=BingoHighScoreAvatar&datafield=John%20Smith

Note that the space between “John” and “Smith” is replaced with %20.

You don’t have to just call these URLs from in-world scripts, of course. You can also call them from a website.

Say, for example, you want to be able to control the color of your house from a webpage.

You can create a key name HouseColor and use clickable links to set the house different colors, like this:

http://outworldz.appspot.com/store?service=###&keyfield=HouseColor&datafield=blue

http://outworldz.appspot.com/store?service=###&keyfield=HouseColor&datafield=red

http://outworldz.appspot.com/store?service=###&keyfield=HouseColor&datafield=green

Hint: if doing this from a website, use the “target=” link property so that you’re not sending your users to a blank page that just says OK. For example, you can load the “OK” into a small frame on the page.

I understand that many of my readers are really good Javascript programmers, or know MySQL, or whatever, and will ask, “Why not just write a little code to do the same thing, set up a MySQL database on your server?” And the answer is: There are people who want to add functionality to their scripts without having to learn JavaScript or Python or MySQL. Is that too much to ask?

Creating your scripts

To demonstrate the use of this tool — and to find out whether it works! — I created two LSL scripts. One turns a box a random color when it’s touched, and then saves that color. The second script, when touched, looks up the color and sets the box that color.

The box on my right — the pink one — turns a new random color when touched, then saves that color to the database. The box on my left — the orange one — is waiting for me to touch it, When I do, it will go to the database to find out what color it’s supposed to be, and then turn that color. That is, pink.

The LSL script to save the color is here in the form of a text file — copy and paste in-world.

The key lines are these:

string URL = “http://outworldz.appspot.com/store?service=” + serviceid + “&keyfield=colors&datafield=” + colors;
key httpkey=llHTTPRequest(URL, [] ,””);

In the first line, serviceid is a string variable, defined at top of the script, as the unique identifier. Change this for your own script. The name of the key field is “colors” and the datafield is the string variable colors, defined just above to hold a string composed of three floating point numbers, separated by commas. Since the string has commas in it, I used the llEscapeURL function so that it would work in a URL.

Once you define all the parts of the URL, you just use the llHTTPRequest function and that’s it. The data is stored into the database. Click on this link to see what’s stored there now: http://outworldz.appspot.com/load?service=b1e5e346-b831-47fa-9930-6ca5d4cd774b&keyfield=colors

That’s it. Just two lines to save any data you want into the database. Again, remember — don’t forget the service ID, and don’t forget your key field names!

So how do you get the data back out of the database?

It’s a little trickier — it takes an extra subroutine (or whatever they’re called in LSL).

You can get the script, as a text file, here.

The first part is the same as before — an llHTTPRequest:

string URL = “http://outworldz.appspot.com/load?service=” + serviceid + “&keyfield=colors”;
key httpkey=llHTTPRequest(URL, [] ,””);

Again, the serviceid variable is defined as a string at the top of the script. Make sure that it matches the serviceid in your other script. Note that the datafield is missing — you’re not storing data here, you’re trying to get it. The other change is that instead of hbeasydatabase3.appspot.com/store?, you’ve got hbeasydatabase3.appspot.com/load? at the start of the URL.

But it’s not enough just to send the command out there — you have to actually get data back. That’s the function of the http_response subroutine:

http_response(key id, integer status, list meta, string body)
{
list colors = llParseString2List(body,[“,”],[” “]);
llSetColor(<llList2Float(colors,0), llList2Float(colors,1), llList2Float(colors,2)>,ALL_SIDES);
}

The data comes back into the body variable, in the form of a string. I had to unpack it a little bit to turn it into something I could use — first, parsing the string into a list, then, when I set the box color, turning each of the three elements of the list into a floating-point number.

If the command fails for some reason — the service ID or the key field name are wrong, for example, the body string will hold the error message.

If you want to add error checking to the first script, you can add an http_response section as well. The body string will be “OK” if the data was stored successfully, and will hold an error message if it wasn’t.

Saving more than one variable

In the example above, I save a three-element list. That’s one way of saving multiple data points.

Another option is to use multiple variables — like with the high scores example. But what if you want to save a long list of high scores? A list where you might not know the length of the list ahead of time?

One idea is to save one variable as ListLength, which is the total list of data points you’re saving. As the list gets longer, you can just increment this field. Then have the other variables with names such as ListField1, ListField2, ListField3 … just keep adding numbers to the word “ListField” until you have as many as you need.

Similarly, you can save tables. Have one variable called TableSize, with the number of rows and columns of your table. Then the table data can be saved as TableField1-1, TableField1-2, TableField1-3, TableField2-1, and so on.

Saving list data or table data into individual fields means you can store or load one data point at a time. However, if you need to load the entire list or table at once, you’ll have to send in a new llHTTPRequest for each one. That might take a lot of time. That’s why I saved all three colors as a single list variable in my script, instead of fetching them one at a time. I recommend using lists whenever possible, but there’s a limit to how long a URL can be — I just ran a quick test, and for a keyfield name of “longstring”, the longest data field string I could store was 500 characters even.

Run your own database

Someday, my Easy Free Database will run out of storage. If you’re creating business-critical in-world scripts, you don’t want your stuff to go down.

Sure, you can email me and let me know that the database is out of room, and, if I’m feeling generous, I could pay to add more storage.

Or you can create your own database.

Download my source code from BitBucket and unzip it. Create a free account with Google App Engine. Download and install the Google App Engine Launcher. Open the Launcher, go to File-Add Existing Application, point it to the folder where you unzipped my source code. Then hit the Deploy button and give it the email address and password you set up your Google App Engine account with.

It took me several tries to get this to work, but once it does, you can fiddle around with the application to customize it for your own needs. You can email me if you have questions at maria@hypergridbusiness.com, but keep in mind that, as of this writing, I have exactly three days worth of experience programming in Python.

Again, here’s the code:

Update April 2023: I tried to install the Google App Engine Launcher again and wound up with some kind of text-based console window shell environment and couldn’t get the old one back that I used ten years ago. The online instructions were ridiculously unhelpful, so I think this would be a case for finding and going through a bunch of tutorials about how to use the new Google Software Development Environment if you want to learn how to do this. If you plan on creating lots of in-world scripts that need server-side applications, then it’s probably a good idea to invest this time. For myself — maybe not so much. At least, not now.

]]>
https://www.hypergridbusiness.com/2012/12/free-database-for-opensim-scripts/feed/ 19
Create a billboard network https://www.hypergridbusiness.com/2012/03/create-a-billboard-network/?utm_source=rss&utm_medium=rss&utm_campaign=create-a-billboard-network https://www.hypergridbusiness.com/2012/03/create-a-billboard-network/#comments Sun, 11 Mar 2012 01:06:32 +0000 https://www.hypergridbusiness.com/?p=40821 Say you and your friends want to set up a self-serve system to post announcements on each other’s grids or sims?

Here’s how to do it without having to create any databases, by using Google Spreadsheets.

First, you go to Google Docs and choose Create – Form.

Here’s a sample form, which you can use to submit event announcements for Hyperica billboards: http://www.hyperica.com/add-new-event/

I created the form in Google Docs, then embedded it into my website by asking Google for the embed code, and just pasting it into a blog post, the same way you would embed a YouTube video.

My form asks for things like the event name and date, an image URL, the hypergrid address, and a website address.

The data that’s collected goes into a Google spreadsheet. But it’s ordered according to when people added the events. So I created a new sheet — there’s a plus button at the bottom left of the Google spreadsheet page where you can add new sheets that are part of the same spreadsheet.

This new sheet filtered all the events, to show just the ones that I haven’t happened yet.

Here is my formula:

=filter(Events!B:I,Events!C:C>=TODAY())

Where Events is the name of the first sheet, and column C is where the date is. Now you have two sheets — one with all the events, and one with all the events that haven’t occurred yet. I called the second sheet Events2.

Then I created a third sheet, where I would sort all the events chronologically — so that the event that will happen next is listed first.

Here is my formula:

=sort(Events2!A:H,Events2!B:B,TRUE)

You’re going to get an extra row at the end with the row headings. I don’t know how to get rid of that! Also, there might be a way to combine these two formulas into one, but just putting one inside the other didn’t work for me. But maybe I was doing it wrong.

Anyway, now, on the third sheet, you have just what you want — upcoming events, sorted in chronological order. But you could sort them in any other way you want, too. For example, if people pay you for these announcements, you could sort them by how much they’ve paid. Or you can filter based on what grid the events are on, or whether the event is free or costs money.

Then I went in-world and created an object on which to display an event.

My event announcement board.

It’s actually a flattened cube — I have the size set to X=1.8, Y=2.2, and Z=0.01. Then I have Taper set to X=0.40. That gives me a little strip at the top, a little strip at the bottom, and a wide area in the middle for the event’s image. You can adjust the tapering settings if you don’t want either of the strips — or you can make your billboard be just the image itself — and just have it do a teleport if you click on it.

Here is the script: Hyperica Event Script

(I had to change the file type to a .TXT file to upload it.)

The script pulls the event name, location and time from the Google Spreadsheet and writes it at the top of the panel. Then it pulls the event image down from the web and displays it in the middle of the panel. There’s a built-in timer, so the board will automatically download a new image once an hour.

It pulls the bottom buttons from a texture that needs to be placed inside the object and named “Grid-Website buttons.” If you rename the texture, just edit the script to use the new name.

Then it waits for you to click. If you click on the Teleport button, it will pull up the map with the destination on it, so you can confirm the teleport. And if you click on the Website button, it will bring up the Website. I created the texture for the button panel — feel free to use it, or create your own:

The way my script works is that you edit the first row to tell the script which event to display — the first event, the second event, etc… The reason I did it this way was to set up a big announcement board showing the next six events:

But you could also use it to show a random announcement, instead, as in this ad below:

Here, if you’re the owner, and you click on the middle image, it pulls in a new random ad from the spreadsheet — where the submissions aren’t ordered or filtered at all. Clicking on the top red panel takes you to the website where you can submit your own, free, Hyperica ad. (Feel free to do that.)

Here, I added a second texture to the object, “Click here for your free ad” to put in the top panel. Then I adjusted the image orientation and stretching manually so it would fit right.

Here is the script itself: Hyperica Ad Script

It pulls in the data from the spreadsheet, counts up the number of rows, and picks a random row to use. If you wanted to, you could add columns to give a particular weight to particular ads, and adjust the randomness calculation to bring up the weighted ads more often.

You could also take out the top and bottom panels, and just have a teleport function if someone clicks on the ad.

And it’s not just for ad billboards — you could also use this to display announcements simultaneously in multiple locations around your grid — use a timer to refresh the display on a set interval to keep the displays up-to-date.

Remember to make your Google Form public access if you want outsiders to add their own listings, or keep it private if you’re just going to manage it yourself. You will also need to make the spreadsheet public — the particular sheet you’re using for your script — and get its URL and update the script accordingly.

You can get more detailed information about how to pull data from a Google Spreadsheet in my previous article.

]]>
https://www.hypergridbusiness.com/2012/03/create-a-billboard-network/feed/ 12
Pull in data from Google spreadsheet https://www.hypergridbusiness.com/2012/02/pull-in-data-from-google-spreadsheet/?utm_source=rss&utm_medium=rss&utm_campaign=pull-in-data-from-google-spreadsheet https://www.hypergridbusiness.com/2012/02/pull-in-data-from-google-spreadsheet/#comments Sun, 19 Feb 2012 07:44:23 +0000 https://www.hypergridbusiness.com/?p=40650 A few weeks ago, I posted a script about how to add data to a Google spreadsheet from inside an OpenSim world (or from a Second Life region).

But what if you want to go the other way, and bring data from a spreadsheet in-world?

It’s not too hard.

First, pull up your Google spreadsheet, and go to File>Publish to Web.

Then choose which sheet you want to publish, set to republish automatically if the sheet changes, and hit “Publish now.”

Select the CSV format.

Now look at the second half of that window. Select the format as CSV — comma separated values — and choose which sheet you want to bring in. You can also just bring in a portion of a sheet by replacing “All cells” with a range, such as A1:C3.

Google will generate a URL for you — copy that URL.

Now paste the URL into the first line of the attached script, replacing the URL I have in there now. You don’t have to do much else — the script will pull in the data and say it in-world. Of course, that’s not very useful.

The inner workings

First, the script downloads all the data from the Web into a single string — the following two statements are key here.

httpkey=llHTTPRequest(URL, [] ,””);

http_response(key id, integer status, list meta, string body

You don’t want to mess with these parts.

Then, the string gets chopped into pieces, with each piece going into a separate list item. I have it being broken up by commas and line breaks, which works perfectly with my spreadsheet — but I don’t know how it will work if you have commas inside your cells themselves.

DataList = llParseString2List(body, [“,”,”\n”], [] );

The total number of cells is just the total number of entries in the list.

CellCount = llGetListLength(DataList);

I also count up the total number of rows in the spreadsheet by counting how many line breaks there were, and adding 1.

RowCount = llGetListLength(llParseStringKeepNulls(body, [“\n”], []))-1;

It works by converting everything into yet another list, one just broken up by line breaks. If you know how many columns your spreadsheet has — and that it’s not going to change — then you can speed up the script by skipping this step. So, say, if you have eight columns in your spreadsheet, which is what I have, I would calculate the total number of rows like this:

RowCount = CellCount /8;

In the end, you’ll have a list with as many line items as there are cells in the spreadsheet, or what they call in LSL, a strided list.

For example, if you needed to, you could sort by the first item in every row, or resort in random order.

To pull out an individual element from the list, use the following command, which returns a string, or text data:

 llList2String (DataList, row*ColumnCount + column)

Counting of the rows starts at zero. So if you wanted to get the third item in the second row of your spreadsheet, you would actually use 2 for column, and 1 for row.

The script is attached as a text file, since I’ve been having trouble embedding scripts in this blog.

Script to pull in data from Google spreadsheet

One application of this is to show the last ten visitors to a region. Sure, you can just pull in the Google spreadsheet itself as media-on-a-prim, but what’s the fun of that?

The tower control room at Hyperica Upper. (Click to see larger image)

The script below pulls in the data from my Google spreadsheet visitor counter script and shows the last 25 visitors on the surface of an in-world prim. This script only works in OpenSim, since it uses the OpenSim text commands to display the data on a surface.

In order to pull in the data, the spreadsheet has to be public, so don’t use this for sensitive corporate data. Google does have a secure API, which requires authentication, but I couldn’t figure it out.  If you can, then you probably don’t need this Google spreadsheet hack, anyway — you can write and read directly from a MySQL database.

The script — which has a touch-to-reset feature — is attached as a text file here:

Show last 25 visitors

]]>
https://www.hypergridbusiness.com/2012/02/pull-in-data-from-google-spreadsheet/feed/ 12
Log your visitors to Google spreadsheet https://www.hypergridbusiness.com/2012/01/log-your-visitors-to-google-spreadsheet/?utm_source=rss&utm_medium=rss&utm_campaign=log-your-visitors-to-google-spreadsheet https://www.hypergridbusiness.com/2012/01/log-your-visitors-to-google-spreadsheet/#comments Sat, 14 Jan 2012 07:02:24 +0000 https://www.hypergridbusiness.com/?p=40431 Update 3: There an simpler version of this script here: Easier Google Spreadsheet Visitor Logger

Update 2: Reader Zuza Ritt has found a solution to working with the new format. Read the full instructions here.

Update: Google has updated their form system so that this method doesn’t work anymore. However, you can get around it — for now — by setting up an old-style form. Just go to this link to create your form - drive.google.com/spreadsheet/newform – then follow the same instructions as below.

I have a problem. I want to be able to see who visits my region in a nice spreadsheet. Specifically, a Google spreadsheet.

There are reasons for this. For example, I want to be able to track who sees a particular billboard, and track that data with the advertiser. Or record who picks up a copy of a hypergate. Or simply know who stops by.

I don’t want to save IP addresses, or do anything creepy. Just the avatar name is enough.

So I ask around. How do I get data out of OpenSim without going in and checking notecards inside objects?

For example, in this free Visitor List Maker script, you have to walk up to the counter and tell it to show you the list.

The experts tell me I have to create a script that writes to an external database — and that I need a database and a server to run it on.

So much for that! But a couple of days later, I realized — I do have a database and a server, a Filemaker database and a hosted server for my company’s workflow. But the idea of trying to figure out the Filemaker API and send in database update requests — well, that would probably take the rest of my lifetime.

And then, a couple of days after that, I thought — why not use a Google form?

So I do some Googling and find out that you can send in form responses through a URL, pre-filling in all the fields.

And, a few hours of tinkering later, I had a script — a weird hybrid of the Visitor List Maker script and my old stand-by Hyperica Lookup HG Teleport Script (thanks, Paul Emery!). And it worked!

For anyone out there looking to get data out of an OpenSim region — or a Second Life region for that matter — feel free to use, adapt, and redistribute this script. Only restrictions — since it’s based on a Linden script, you can’t sell it, and you must leave the attributions in place.

The script itself is attached as a text file at the bottom of this post. If you can read LSL, and know your way around Google forms, just get it, change the first line, and you’re good.

If you need a little bit more information, here we go.

The Google form part

To create your Google form, go to Google Docs and click Create (on left side) and then choose Form from the drop down-menu.

To use the script attached as is, add two questions.

The first question is “Avatar.” The answer is a text field.

The second question is “Region.” The answer is also a text field.

You can name the form anything you want. In fact, you can name your questions anything you like. It doesn’t matter for this script. Save the form.

Now click on See Responses and pick Spreadsheet from the drop-down menu. This is where the incoming data will show up. Bookmark it.

But you’re not done yet.

In your spreadsheet view, in the menu bar on top, click on Form and then pick Go to live form from the drop down window.

Your form’s URL should look something like the one here:

https://docs.google.com/a/tromblyinternational.com/spreadsheet/viewform?hl=en_US&formkey=dEE5akZOWUM4WmdOSC0wZzFJUHFyNlE6MQ#gid=0

Now, there’s a reason I pasted the whole long URL above. It’s so that you can see that there’s a long string of characters after &formkey= and before #gid=0. Copy those characters. In my case, they were dEE5akZOWUM4WmdOSC0wZzFJUHFyNlE6MQ.

Now paste those characters in the first line of the attached script and drop the script on any object.

That’s it.

More info about the script

You don’t need to track the date and time the avatar stops by because, if you need it, Google automatically puts a date and time stamp on each submission. Handy.

The way the script works is that it remembers the names of the last ten avatars that walk by. If it sees an avatar that’s not in that list, it adds them to the spreadsheet. That way, if you just happen to be standing around the visitor counter, you don’t get added to the spreadsheet a million times. (Yes, that happened to me the first time I ran the script, because I thought I could leave that part out. Hah!)

You can change this by editing the second line of the script. It’s the list_size variable, and is set to 10 in my script. But if you have large groups of avatars stopping by, you might want to increase it. Otherwise, if, say, avatar number 11 isn’t on the list, his name gets added to the spreadsheet — and the first entry on the list is knocked off. But then that first avatar isn’t on the list anymore! So now the counter adds her, too — and knocks off guy number two. But now guy number two isn’t on the list! So the counter goes crazy cycling through all the avatars milling around. But don’t make the maximum size of the list too long because it will slow down the script.

The other thing you can change is that you can comment out the line that checks whether the avatar is you, the owner of the script. Maybe you want to find out whether your avatar is having a good time without you, when you’re logged out. Or maybe you just want to test the script. Comment out this line: if( llDetectedKey( i ) != llGetOwner() ) by putting two slashes in front of it — //.

So that’s about it for basic tinkering.

Moving on.

Say you want to adapt the script to track other types of stuff.

The secret sauce is in this line:

string URL = "http://spreadsheets.google.com/formResponse?hl=en_US&formkey=" + google_formkey
+ "&entry.0.single=" + detected_name + "&entry.1.single=" + region_name + "&submit=Submit";

The first part is the URL Google uses to send in form responses. The last part — “&submit=Submit” — tells it that you’re submitting the form. Don’t mess with these parts.

In between, you’ve got the google_formkey — you copied and pasted this from your Google Form URL into the first line of the script, and this is the variable holding it.

And right after that you’ve got the data you’re saving.

The first data saved is preceded by “&entry.0.single=” — then you put in the variable holding your data. In my case, I put in the detected avatar name. Yes, Google starts counting at zero, not one.

The second data saved is preceded by “&entry.1.single=”, and I’ve got it followed by the region name, thinking that I can drop this script into counters all over my grid and it will track who went where. If I wanted to, I could add additional form fields —  “&entry.2.single=”, “&entry.3.single=”, and so on, and track the exact positions of the avatars, or their heights, or anything else I wanted. Just add more fields to your original form. Remember to put an ampersand — & — in front of each new field, and make sure your quotation marks are in the right places, and the variable name is set off by plus signs.

This is why the text of the questions in the forms doesn’t matter — all Google cares about here is the order of the fields.

And here is what the final result looks like:

Google form spreadsheet visitor counter

Hey, Breen stopped by. Hi, Breen!

Avatars local to my grid just show their avatar names — avatars from other grids show their full hypergrid name.

Now what?

Now that you’ve got your data in spreadsheet form, you can share the spreadsheet with your colleagues. You can embed the spreadsheet on your website. You can share it with your customers.

Is it totally secure? Probably not. If someone knows your Google Form ID, they can flood it with useless data. That means, for example, that anyone who can see your script can mess with your head. You can reduce this risk by running the script on regions or grids that you control, and set the permissions of the objects so that folks can’t peek in.

But it’s a great option for folks who don’t want to set up a separate database and just want to track stuff. This is especially useful for anyone tracking the behavior of in-world simulations and is collecting a lot of data. Google spreadsheets are perfect — you can collect the data, and then analyze it, all in one place.

You can also use it for quick in-world surveys — put up a sign with your survey questions and nice big boxes showing the possible responses on the side of a prim. Check to see which box folks press, and save that information to your Google spreadsheet along with the avatar name. Since Google can instantly generate a graphic showing the responses, you can pull in that graphic’s URL onto a nearby prim to show voting results in real-time. You can put these signs up on multiple regions — even multiple grids — and people can see the combined results from all these sources. Or you can use it to put up a monitor screen on one region, to show you what’s going on in a different region — or many different regions.

You can also track interactions with objects. For example, you can have objects that ask questions when avatars walk by, and then save their responses.

And you don’t have to update just one spreadsheet. Say you’ve got a sign showing four different destinations, and you want to know who clicks on each destination. You can set up a separate spreadsheet for each one, and then send the avatar names to just the appropriate sheet. And then you can share different spreadsheets with different people, or embed them on different Web pages.

And there’s other cool stuff you can do, as well. For example, say you don’t want to embed the whole spreadsheet on your Website or blog. You might not want everyone to see all the data. You might want some people to see some data, and other people to see other data, or you might want to process and massage the data first.  Here’s a sample bit of code showing how to pull data out of a Google spreadsheet into a Webpage. I was thinking of playing around with that, but then I took a look at the sample code, and maybe I’ll wait a while.

Get the script

Click here to download the text file with the script: Google spreadsheet visitor logger

I’ve been having problems uploading scripts recently, so please let me know if there are any problems with it. Either with the formatting of the file, or with the script itself. For some reason, between the time I get the script working and the moment at which I cut-and-paste it into a text file, variable names mysteriously change, closing brackets disappear, and semi-colons turn into colons.

]]>
https://www.hypergridbusiness.com/2012/01/log-your-visitors-to-google-spreadsheet/feed/ 33
Put Google drawing on a prim https://www.hypergridbusiness.com/2011/09/put-google-drawing-on-a-prim/?utm_source=rss&utm_medium=rss&utm_campaign=put-google-drawing-on-a-prim https://www.hypergridbusiness.com/2011/09/put-google-drawing-on-a-prim/#comments Fri, 02 Sep 2011 22:20:37 +0000 https://www.hypergridbusiness.com/?p=39480 Use this script to put a Google graphic on any prim. Clicking on the drawing in-world will automatically refresh it.

You can use it to create a white board for an in-world presentation. You can allow several people to edit at once by sharing the Google Doc with them.

Of course, if you’re using a second or third-generation viewer, you can simply edit the document in-world, in real time, without using this script at all.  This script is for those using SLv1-compatible viewers.

You can also use this to create signboards for your grid that you need to update on a regular basis. Just change the appropriate Google drawing, click on your sign boards, and you’re done — no need to upload new drawings and edit the textures on each surface.

Create your drawing

First, you will need to go to Google Docs and go to Create New – Drawing (in the drop-down menu on top left of screen).

Now, draw something. If you leave the background as is, it will come out transparent.

When you’ve got your drawing, click on Share – Publish to the Web (in the drop-down menu on top right of screen).

You will get a URL that looks something like:

https://docs.google.com/drawings/pub?id=1xLB4NvrfXrlWttsTAUoQdX65lj5PmA0mDuAay4Ibgdc&w=960&h=720

Save that URL and paste it into the top of this script, where I’ve got the text highlighted in blue, and drop the script on any prim (flat panels work best):

//Change the address inside the quotation marks on this next line to your Google drawing:
string website = "https://docs.google.com/drawings/pub?id=1xLB4NvrfXrlWttsTAUoQdX65lj5PmA0mDuAay4Ibgdc&w=960&h=720";

float firstClick= 0;

default {

          state_entry() {

          string URLTexture = osSetDynamicTextureURL("", "image", website, "", 600);
            if (llStringLength(URLTexture)>0) {
                llSetTexture(URLTexture, ALL_SIDES);
                 }
               }

         touch_start(integer total_number)
             {
                key gAvatarKey = llDetectedKey(0);
                string URLTexture = osSetDynamicTextureURL("", "image", website, "", 600);
                     if (llStringLength(URLTexture)>0) {
                                  llSetTexture(URLTexture, ALL_SIDES);
                                                   }
           float t= llGetTime();
        if( (firstClick != 0) && (t < (firstClick + 1)) ){
            firstClick=0;
            // Double Click Event
            llLoadURL(gAvatarKey, "View the original website.", website);

        } else {
            firstClick= t;
        }
    }

     }
]]>
https://www.hypergridbusiness.com/2011/09/put-google-drawing-on-a-prim/feed/ 3
Hyperica Lookup HG Teleport Script https://www.hypergridbusiness.com/2011/01/hyperica-lookup-hg-teleport-script/?utm_source=rss&utm_medium=rss&utm_campaign=hyperica-lookup-hg-teleport-script https://www.hypergridbusiness.com/2011/01/hyperica-lookup-hg-teleport-script/#comments Mon, 03 Jan 2011 05:55:40 +0000 https://www.hypergridbusiness.com/?p=38486 The script below works by pulling in data from the following page:

http://www.hyperica.com/lookup/

Simply replace the URL at the top of the script with the codes for which region you want to go to. For example, you can use it to automatically look up the newest Retail destination, or the most highly rated Arts region.

There are twelve categories that lookup page uses, so this script can be used as the basis for a menu-based travel system.

It works with both touch and collision (just delete the one you don’t need) and the LLMap script, which you can replace with osTeleport if you prefer — OSTeleportAgent works instantly, no confirmation step needed — but requires OS scripts to be enabled on your region (if you don’t know what this is, they’re probably not). And since osTeleportAgent scripts work instantly, anyone who accidentally bumps into a gate will get teleported to another grid!

osTeleportAgent( WhomToTeleport, SimAddress, LandingPoint, LookAt );

All the parts that work are thanks to Paul Emery. The parts that don’t are all my fault.

Hyperica Hypergate Teleport Script

WordPress kept mangling the script, so here it is again as a text file download.

Hyperica single destination teleport script with Web lookup

Please let me know if there are any problems with it.

]]>
https://www.hypergridbusiness.com/2011/01/hyperica-lookup-hg-teleport-script/feed/ 5
Simple Hypergate Teleport Script https://www.hypergridbusiness.com/2011/01/hypergate-teleport-script/?utm_source=rss&utm_medium=rss&utm_campaign=hypergate-teleport-script https://www.hypergridbusiness.com/2011/01/hypergate-teleport-script/#comments Sun, 02 Jan 2011 19:08:48 +0000 https://www.hypergridbusiness.com/?p=35797 The following is a script you can place on any object to turn it into a hypergrid teleportation portal.

If you put it on something that looks like a giant blue swirly circle, everyone will know that it’s a hypergate. But you can also use it to create teleport buttons or a teleportation doorway, or anything else.

Notes: Set the destination name in the first line of the script, and the hypergrid address in the second line. Use the same address you would enter in Map-Search to teleport to your destination.

Warning: You can only travel 4,096 regions in any direction. If you’re on ReactionGrid, you can’t jump to OSGrid center — they’re too far apart. But you can jump to some intermediary regions, first. You also can’t jump to another region with the same exact coordinates as yours, you can’t jump to a region that’s running HG 1.5 if you’re running HG 1.0 and vice versa. (ReactionGrid is currently on HG 1.0, and OSGrid is on HG 1.5.) You also need to have hypergrid enabled on your home region.

The script below uses both the “touch-start” function and the “collision” function. You can cut out the part you don’t need. So if you want the hypergate to work only when touched, take out the two lines at the end of the script that start with “collision”. If you want the gate to work only when someone walks into it, take out the two lines near the end of the script that start with “touch_start”.

In order for the collision detection to work, the gate must not be phantom. However, you can put some a nice watery object in front of it to create the illusion that you’re walking through that weird Stargate plasma stuff.

The script uses the llMapDestination command. This brings up the map, with the destination coordinate filled in. Hit the “search” button and then hit “teleport.” You can also use the osTeleport command instead, which doesn’t work on all regions — you have to have OS functions enabled, and set the threat level to high. Check with your hosting provider for more details.

Here is the OS function alternative:

osTeleportAgent( WhomToTeleport, SimAddress, LandingPoint, LookAt );

Hypergate Teleport Script

I’ve given up trying to post the script in here — WordPress keeps replacing key parts with gibberish!

Here’s a text file download, instead:

Hyperica single destination teleport script

Please let me know if there are any problems with it.

]]>
https://www.hypergridbusiness.com/2011/01/hypergate-teleport-script/feed/ 4
Hypergate Teleport Script https://www.hypergridbusiness.com/2010/10/hypergate-teleport-script-2/?utm_source=rss&utm_medium=rss&utm_campaign=hypergate-teleport-script-2 https://www.hypergridbusiness.com/2010/10/hypergate-teleport-script-2/#respond Thu, 28 Oct 2010 18:09:41 +0000 https://www.hypergridbusiness.com/?p=35715 The following is a script you can place on any object to turn it into a hypergrid teleportation portal.

If you put it on something that looks like a giant blue swirly circle, everyone will know that it’s a hypergate. But you can also use it to create teleport buttons or a teleportation doorway, or anything else.

Notes: Change the destination in the first line of the script — the hypergrid address goes inside the quotation marks. Right now, it’s set to go to LBSA Plaza.

Warning: You can only travel 4,096 regions in any direction. If you’re on ReactionGrid, you can’t jump to OSGrid center — they’re too far apart. But you can jump to some intermediary regions, first. You also can’t jump to another region with the same exact coordinates as yours, you can’t jump to a region that’s running HG 1.5 if you’re running HG 1.0 and vice versa. (ReactionGrid is currently on HG 1.0, and OSGrid is on HG 1.5.) You also need to have hypergrid enabled on your home region.

The script below uses both the “touch-start” function and the “collision” function. You can cut out the part you don’t need. So if you want the hypergate to work only when touched, take out the two lines at the end of the script that start with “collision”. If you want the gate to work only when someone walks into it, take out the two lines near the end of the script that start with “touch_start”.

In order for the collision detection to work, the gate must not be phantom. However, you can put some a nice watery object in front of it to create the illusion that you’re walking through that weird Stargate plasma stuff.

The script uses the LLMapDestination command. This brings up the map, with the destination coordinate filled in. Hit the “search” button and then hit “teleport.” You can also use the OSTeleport command instead, which doesn’t work on all regions — you have to have OS functions enabled, and set the threat level to high. Check with your hosting provider for more details.

Here is the OS function alternative:

osTeleportAgent( WhomToTeleport, SimName, LandingPoint, LookAt );

Hypergate Teleport Script

string SimName = “hg.osgrid.org:80“;
vector LandingPoint = <128.0, 128.0, 36.0>;
vector LookAt       = <1.0,1.0,0.0>;
list LastFewAgents;
PerformTeleport( key WhomToTeleport )
{   integer CurrentTime = llGetUnixTime();
integer AgentIndex = llListFindList( LastFewAgents, [ WhomToTeleport ] );
if (AgentIndex != -1)
{     integer PreviousTime = llList2Integer( LastFewAgents, AgentIndex+1 );
if (PreviousTime >= (CurrentTime – 5)) return;
LastFewAgents = llDeleteSubList( LastFewAgents, AgentIndex, AgentIndex+1);
}
LastFewAgents += [ WhomToTeleport, CurrentTime ];
llMapDestination(SimName, LandingPoint, LookAt);
}
default
{   state_entry()
{  llSetText(SimName, <1,1,1>, 1);
}
touch_start(integer number)
{    PerformTeleport( llDetectedKey( 0 ));  }
collision(integer number)
{    PerformTeleport( llDetectedKey( 0 ));  }
}
]]>
https://www.hypergridbusiness.com/2010/10/hypergate-teleport-script-2/feed/ 0
Free Scripts https://www.hypergridbusiness.com/2010/08/free-scripts/?utm_source=rss&utm_medium=rss&utm_campaign=free-scripts https://www.hypergridbusiness.com/2010/08/free-scripts/#comments Sun, 15 Aug 2010 02:12:29 +0000 https://www.hypergridbusiness.com/?p=34601 Last updated March 10, 2013.

Looking to add some jazz to your virtual world? Say, by having doors that swing open when you touch them, fish that swim in your lakes, or cannons that actually fire?

Sure, you can buy all this stuff, but if you’re a do-it-yourselfer kind of guy or gal, pick up a free script instead. To create scripts in OpenSim, open your inventory (tab on bottom left if you’re using an older viewer, or the suitcase tab if you’re using a newer viewer such as Firestorm) and select Create-New Script. Then just paste in the script, save it, rename it, and drop it on top of the object you want to animate. A rotating door script, for example, would be added to the door itself, or to its hinge (depending on the script and shape of door).

Almost all Second Life scripts work as-is in OpenSim, though there are some vehicle physics commands that haven’t been implemented yet. In addition, OpenSim has added some new commands, called OSSL, and can also run scripts written in C#. (List of OSSL functions is here.)

LSL isn’t the easiest language to just sit down and start writing code in if you’ve never programmed before. But by playing with these scripts, you can soon get the hang of it.

OSGrid’s Script List: This is a list of scripts that have been posted to the OSGrid forum, the go-to-place for OpenSim discussions of all kinds. As the largest grid on the hypergrid, OSGrid is the crossroad of the metaverse, and even folks who live on other grids frequently pop in for help or to just to chat.

Second Life Script Library: This is a repository of scripts on Second Life’s official Wiki. There’s also a very active Second Life scripting forum here. And there’s the LSL Wiki Script Library., with a smaller collection of useful scripts.

Internet LSL Script Database & Library: More than 700 scripts, nicely arranged by category. This site gets lots of traffic, and Ferd Frederix, the guy who runs it, responds to questions and comments.

Fred Gandt’s Free Scripts: Dozens of useful, and free, scripts on the Second Life Wiki. Don’t forget to click on “More Free Scripts” and “Even More Free Scripts” — he’s got several pages of scripts here, in no particular order.

FoxSan’s LSL Script Repository: Just over 150 scripts available. Use the search box — or the tags — on the right to find what you’re looking for.

The Script Shack: A low-traffic forum, with a small selection of scripts for doors, menus, and for helping merchants.

Benja Kepler’s SL Blog: A small collection of scripts, last updated in 2008.

Digigrids: A collection of free game-related scripts for OpenSim

None of these have what you need?

Instantly generate a new script with the Script Me! LSL script generator.

A super easy-to-use Web-based scripting tool that uses visual building blocks is Greenbush Lab’s ScripTastic, which we recommend highly, especially for kids. (But adults can try it out to, particularly those just learning how to script.)

For more advanced users, MiceOnABeam offers a downloadable application that helps scripts build with a visual interface, available in both free and paid pro versions.

You can also instantly create a new particle generator script with the Free LSL Particles System from Zeja Pyle.

There is also a program called Scratch for Second Life that you can download and run to generate more complex scripts with an easy graphical interface.

Or work your way through Second Life’s excellent collection of scripting tutorials.

]]>
https://www.hypergridbusiness.com/2010/08/free-scripts/feed/ 3