Nexus Pager System/API

From Nexus
Revision as of 21:45, 19 May 2015 by Shymus (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

← Nexus Pager System

API Documentation

The API Documentation is only relevant to version number 3.0.0. Anything older than that will not work on this page.
This API is a transmit only API. Until we find a way to effectively send messages to a user with the API, we will not be displaying our receive API.
To use this API, you must have some knowledge of Linden Script Language and Linked Messages
Want to know what an API is? Look here on Wikipedia.
To navigate this wiki better, please use the navigation on the right side of the screen.

API Features


  • Transmitting Messages
  • Receiving Messages

How to make an API Call


Before you are to start messing with this, you must have knowledge of how Linden Scripting Language works. If you can't script, then this guide will be worthless to you.
Currently, there is only one way to make an API call. You are required to use our helper script that is supplied in the box when purchased. You can also obtain this script at the vendor in world.
If you are going to use Linked Messages you must either get the script from our In World Store or from your Product Box.

Setting Everything Up


Time to start setting things up!
Follow these steps and you should have a perfect prim that will be able to send out messages to anything.
  1. Create a prim and add the API Script.
  2. Edit the Computer Terminal and copy the computer's description.
  3. Paste that description into the prim where you have the API Script.
  4. Create a new script and paste the following.
integer TRANSMIT_PAGER      = 21001; // The Number to pass into Link Message to tell the API script to send the message only to pagers.
integer TRANSMIT_SPEAKER    = 21002; // The Number to pass into Link Message to tell the API script to send the message only to speakers.
integer TRANSMIT_ALL        = 21003; // The Number to pass into Link Message to tell the API script to send the message to everything.

string JSON;
string channel = "CHANGE ME!"; //Change the name of this channel to something you have in your own network.
string message = "Hello World!";

default {
    touch_start(integer total_number) {
        if(llDetectedKey(0) == llGetOwner()) {
            JSON = llJsonSetValue(JSON,["channel"],channel);
            JSON = llJsonSetValue(JSON,["message"],message);
            llMessageLinked(LINK_SET,TRANSMIT_PAGER,JSON,NULL_KEY);
        }
    }
    link_message(integer sender_number, integer num, string value, key id) {
        if(value == JSON) return;
        llOwnerSay(llJsonGetValue(value,["success"]));
    }
}
All Done! Once you have all those items in the prim, everything should be working. All you need to do now is to change the name of the channel to a channel in your own network.

Transmitting Messages

One of the major functions that this API will allow you to do is to transmit messages to other users who have pagers or speakers.
You can find the channel by going to your channels in your computer terminal and selecting Channels Then List.
You must use the Channel Names exactly the way you added them to the database.

Sending a Transmission

Sending a transmission is very simple once you have the hang of it.

Helpful Variables

There are some variables that are required to tell the API Script what you are trying to do.
The Numbers that you pass through the llLinkMessage() Function are the action that is sent to the API Script.
Variable List
  • TRANSMIT_PAGER = 21001 This action tells the API Script that you want to transmit a message to other pagers on a certain channel.
  • TRANSMIT_SPEAKER = 21002 This will tell the API Script to only send a message to the speakers.
  • TRANSMIT_ALL = 21003 This will send messages to all the devices on that channel.
Did you send a message and have it be a success? Here is the response.
{
    "success" : "Message has been successfully sent!"
}