Example Script: Visitor Tracker

The example script, Visitor Tracker (VisitorTrackerExample.cs), tracks the number of visitors that visited your experience over the course of a session. Grab the file at the download link at the end of the page. 

Here is a step-by-step guide to using the script:

  1. In the My Experiences app, choose the scene you want to edit and click the Edit Scene edit_icon_sm.png button.
  2. If you already have the file in your inventory, jump to step 3 to start using the script. Otherwise, download the VisitorTrackerExample.cs example script at the bottom of this page and upload the file into your inventory. See Uploading and Applying Scripts for more information.
  3. Now that you have the script in your inventory, choose an object in the scene that you want to apply the script to.
  4. Select the VisitorTrackerExample.cs file from your Inventory and drag the script onto the object in the scene. Alternatively, you can add the script to an object via the Scene Objects panel.
  5. Now that the script has been applied on the object, open the properties panel for the object. At the bottom of the object's properties panel is a Script Settings section. 
    Note: Alternatively, you can also access the Script Settings section from the object's dropdown hierarchy on the Scene Objects panel. Right-click on the script component to access the script properties panel.
    vistor_tracker.png
    The parameters for Visitor Tracker


  6. If you prefer to have the script listen only to your commands, set the OwnerName to your display name. Otherwise, leave it blank to let anyone issue the command.
  7. Next, set the command word to trigger the script. In the VisitorListCommand field, type the word you would like to use as a command. For example, let's use "/visitors" as a command.
  8. Once you have finished these steps, your script is ready. Save and build your scene.
  9. If you want to verify if the script is running correctly, visit the built scene.  
  10. While visiting the scene, open the Chat app.
  11. In the chat field, type the command that you have set. In this example, /visitors. This prompts the script to run and a message box opens showing a log of all the visitors who have visited the scene. 

chat_type.png

A few notes for the VisitorTrackerExample.cs example script:

  • The script logs the visitors who came and visited your experience.
  • This script only runs until an experience session ends. Once it ends, the tracker resets and all data is lost.
  • An experience session ends when your scene has been empty (no visitors) for some time. 

 Creative Commons License

This content is licensed under the terms of the Creative Commons Attribution 4.0 International License. When using this content, you must:

  • Acknowledge that the content is from the Sansar Knowledge Base.
  • Include our copyright notice: "© 2017 Linden Research, Inc."
  • Indicate that the content is licensed under the Creative Commons Attribution-Share Alike 4.0 International License.

Include the URL for, or link to, the license summary at https://creativecommons.org/licenses/by-sa/4.0/deed.hi (and, if possible, to the complete license terms at https://creativecommons.org/licenses/by-sa/4.0/legalcode.

For example:

"This work uses content from the Sansar Knowledge Base. © 2017 Linden Research, Inc. Licensed under the Creative Commons Attribution 4.0 International License (license summary available at https://creativecommons.org/licenses/by/4.0/ and complete license terms available at https://creativecommons.org/licenses/by/4.0/legalcode)."

 

Example Script File: 

Was this article helpful?
2 out of 2 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.