Skip to main content

Setting up a Google Docs Form for Second Life Interaction

I'm using Google Docs now with Second Life for tracking a few different things, and the basic set up is the same, so I've decided to just make this it's own post, that I can reference later.  For this example, I'm using aspects of the sales tracker script, but it can be adapted for any script.

Google Forms can be easily used to track various inworld activities in Second Life.  I am currently using it to track visitors to my store and for tracking sales in my store.  It's free, it doesn't require running or setting up a webserver or PHP or SQL.  I will say up front, I have no idea if there are API limits at all to this.  My use is extremely low traffic.  I suspect that, since it's Google, it's pretty robust.

Firstly, go to your google drive, at drive.google.com.  Create a new form and name it something useful.  In this case, I used "Gique Sales Tracker".


Change the default included field to "Short Answer" and give it a useful name.  On a side note, all of these names are independent of anything in Second Life and can be anything you want them to be.  The interaction occurs via some key values, not the form names or LSL variable names.  Add additional form fields, all "Short Answer" using the + icon on the side.  For the sales tracker, I used "Avatar", "Item", "Price", and "Location".  If you are using this framework for your own projects, you can add as many or as few fields as needed.  NOTE:  The system adds date and time on it's own.


Now near the top of the form composer, select "Responses", and click the little green icon.  Select "Create new Spreadsheet", and name it whatever you'd like.  This will cause the form to dump all responses to a useful spreadsheet as they come in.  Because of the way Google works, you can even watch this happen in real time.  The system automatically adds a date and time column.  Notice the column names are the names of the form fills you entered earlier.



This next step is the trickiest part of this entire deal, but it's not as hard as it seems, so don't be deterred.  At the top of the form creation page, near "Send" is an eyeball icon, this will allow you to preview the form.  Click this, and it will open the form in a new tab on your browser.  If you want to test the functionality of the form, you can enter values into the form manually here and submit them and they should show up in your spread sheet.  This page will look very similar to the form creator page, except the creation buttons will be missing.

You will need to make some notes here.  I'd recommend using a notepad style program, you can write them down if you want, but at least one of the values you're pulling next is very long and complex, so I'd recommend something you can cut and paste to.  You will need all of these values in Second Life in the script, you can put them directly in the script, or an SL notecard even.

Right click on the Form Preview page, and select "View Page Source".  This may be called something else depending on your browser, but the idea is to view the code that makes the form page.  This will open a tab or a window with a mess of code.  You'll want to do a "Find".  In Windows, you can do this with "Control+F", I believe it's similar in Mac and Linux.  In the find box, search for "entry.", including the period.  Chrome highlights all occurrences of the search term, some browsers may require multiple searching to cycle through each occurrence.  What you are looking for, is the number that occurs just after "entry."


Record these numbers, and what they correspond to.  The numbers should occur in the order you added them to your form, but you can verify this by scanning back a bit in the code, the form name is listed under a tag "aria-label".  I've highlighted above where it shows "Avatar Name", notice lower in the example it reads "Item", "Location", and "Price".  The numbers from this example are, 1518898711, 1485797246, 1639291941, and 1768330639.  Your numbers WILL be different.  Using those 4 numbers will not work for you.

Also, in case anyone thinks they want to be clever, I created a dummy form for this example, so these numbers are not the numbers I use for my actual tracker.

Once you have these numbers, you can close the source code.  You can also close out the preview form if you want.  You will also need the form id, which can be found in the URL box at the top of your browser.



I've highlighted what you need above, but you want everything BETWEEN the slashes.  The actual URL for the example is here:

https://docs.google.com/forms/d/1zGN8eH4ZbwqZWEVw4qFB-nS9WrGv7yEeYWm8QzJ1MkM/edit

You want everything in between the slashes, highlighted above.  You do not need the slashes.  Mark this down as your form key.

And that's all that you need for basic set up of a Google Form for use in an SL script.  I'll post about a couple of projects using this form later.

A copy of the script that can be used with this set up can be gotten here.





Comments

Post a Comment

Popular posts from this blog

LSL - Vendor Script with Google Docs Tracking

Better late than never I suppose.  Last post, like 2 years ago, I talked about how to set up a Google Form to track data in a Google Sheet for use in LSL scripts.  It's very similar to how you would make a GET call in a PHP web form.  Anyway, I'm here to post a Vendor Script that is designed to work with the Google set up to track sales.  The form values you want to create in the Google Form are: Avatar, Location, Price, and Item. The script is available below, you can also have one delivered through the Marketplace .  I have used this vendor script in world but I didn't build the base Vendor functionality, so I would test it out with a cheap price and a friend or an alt to make sure it's working properly.  I take no responsibility if this screws up and you lose L$.  This script should be placed in the root prim of a vendor along with an informational Notecard of some kind, and a single item to be distributed on payment.  You'll need to box ...

A Quick Look at the Normie Head

I've tried a pretty wide variety of MESH bodies, but I've not really stepped into the realm of MESH heads yet.  Partially because they all are pretty expensive.  Also, there's a pretty large variety of options and it's not quite as clear on which is "best for me".  The body part felt pretty easy, for the most part, they are a layer a MESH that lays over your standard avatar skeleton to sort of smooth things out.  There are nuances in there, but picking one and then adjusting it with the standard body sliders felt pretty straight forward. Heads feel different.  Like, it would be easy to end up spending 2000+ L$ on something that I couldn't possibly make work for my "preferred style".  It's not clear to me how much these heads can be adjusted using the standard sliders.  The head and face are kind of a big deal, at least to me, as part of the identity of my Avatar.  It's what I look like.  I use it in SL, I have all of my values written d...