Giter Club home page Giter Club logo

opensimtide's Introduction

OpenSimTide v0.2

This is a INonSharedRegion module that controls the tide on your region. It also reports the current tide level to the region on two channels so that scripts can use it, for example to make items appear to float.

If you are running multiple regions on one simulator you can have different tide settings per region in the configuration file, in the exact same way you can customize per Region setting in Regions.ini

The configuration file for this module should be placed in:

bin/addon-modules/OpenSimTide/config/OpenSimTide.ini

and follows the similar format as a Regions.ini file, where you specify settings for each region using the [Region Name] section heading. There is an example .ini file provided which should be edited and copied to the correct place above.

Here is an example config:

[Test Region 1]

	;# {TideEnabled} {} {Enable the tide to come in and out?} {true false} false
	;; Tides currently only work on single regions and varregions (non megaregions) 
	;# surrounded completely by water
	;; Anything else will produce wierd results where you may see a big
	;; vertical 'step' in the ocean

	TideEnabled = True

	;; update the tide every x simulator frames
	TideUpdateRate = 50

	;; low and high water marks in metres
	TideLowWater = 17.0
	TideHighWater = 20.0

	;; how long in seconds for a complete cycle time low->high->low et
	TideCycleTime = 900

	;; provide tide information on the console?
	TideInfoDebug = False

	;; chat tide info to the whole region?
	TideInfoBroadcast = True

	;; which channel to region chat on for the full tide info
	TideInfoChannel = 5555

	;; which channel to region chat on for just the tide level in metres
	TideLevelChannel = 5556

	;; How many times to repeat Tide Warning messages at high/low tide
	TideAnnounceCount = 5

To add this module to your OpenSim, cd to your addon-modules directory and type:

git clone https://github.com/JakDaniels/OpenSimTide.git

Rerun the prebuild script in the main opensim directory and rebuild with xbuild or nant. Remember you need an .ini file in bin/addon-modules/OpenSimTide/config/

How do I use the tide data in scripts? Here is an example script. Rez a spherical prim above the water and place this script in it. Name the script FloatOnWater and take a copy of it into your inventory for later.

integer listen_handle;
vector myPos;
float tideLevel = 20.0;

default
{
    on_rez(integer start_param)
    {
	llResetScript();
    }
    state_entry()
    {
	listen_handle = llListen(5556, "TIDE", NULL_KEY, "");
    }
    listen( integer channel, string name, key id, string message )
    {
	tideLevel=(float)message;
	myPos = llGetPos();
	llSetPos(<myPos.x, myPos.y, tideLevel + 0.05>);
    }   
}

To make items float on water just place this script into their root prim.

More complex stuff can be done using the full info channel, which has data about where in the tide cycle we are. Rez a cube prim and place this script inside:

integer listen_handle;
default
{
    state_entry()
    {
	listen_handle = llListen(5555, "TIDE", NULL_KEY, "");
    }
    listen( integer channel, string name, key id, string message )
    {
	llWhisper(0,channel + " " + name + " " + id + "\n" + message);
    }
}

The cube will whisper info about the current tide position every time the tide is updated.

If you have any question please contact Jak Daniels, [email protected]

opensimtide's People

Contributors

jakdaniels avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.