MetaLife
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Statistics
Latest topics
» List of weapons approved (after test)
How to communicate with the region server EmptyWed Feb 22, 2012 12:43 pm by 7Sins Admin

» MetaLife FAQ
How to communicate with the region server EmptyWed Feb 22, 2012 11:58 am by 7Sins Admin

» MetaLife License
How to communicate with the region server EmptyWed Feb 22, 2012 11:09 am by 7Sins Admin

» MetaLife Feature List, version 1.21
How to communicate with the region server EmptyFri Feb 17, 2012 11:19 am by 7Sins Admin

» NEU MetaLIfe 2 Bedienungsanleitung (deutsch)
How to communicate with the region server EmptyFri Feb 17, 2012 10:56 am by 7Sins Admin

» NOUVEAU MetaLife2 manuel d'instruction (français)
How to communicate with the region server EmptyFri Feb 17, 2012 10:53 am by 7Sins Admin

» NEW MetaLIfe 2 Manual (English)
How to communicate with the region server EmptyFri Feb 17, 2012 10:47 am by 7Sins Admin

» NUOVO MetaLIfe 2 - manuale di istruzioni (italiano)
How to communicate with the region server EmptyFri Feb 17, 2012 10:46 am by 7Sins Admin

» NUOVO - manuale di istruzioni (italiano)
How to communicate with the region server EmptyFri Feb 17, 2012 10:43 am by 7Sins Admin


How to communicate with the region server

Go down

How to communicate with the region server Empty How to communicate with the region server

Post  Tala Mon Oct 12, 2009 1:36 am

The ML region server provides a way to tell a script about some sim settings. This is e.g. useful for weapon which want to test if the region is ML-enabled, or need more information on the combat settings. The communication channel for this is -399422. The only possible request is the string "info?", which will result in an answer string on the same channel.

In a script you would poll the data by
Code:
llRegionSay(-399422, "info?");
The answer will be something like
Code:
info|5fa6a4d6-86b5-3ec3-10cc-a9a505880300|melee_factor=1.300000
ranged_factor=1.000000
splash=1
roles with defence points
breathlessness=1
ranged_distance_restr.=110.000000
unconsciousness=15
randomize=0
This string consists of a '|'-separated list whose first entry is always 'info', the second is the UUID of the object which has sent the request and the third is a free form data string. The data string is a newline-separated list with obvious syntax. Please note the data string might change in future version (i.e. there might be more settings accessible).

ATTENTION: IF YOU USE THIS COMMUNICATION CHANNEL THEN PLEASE REMOVE THE LISTENER AFTER YOU HAVE RECEIVED AN ANSWER OR AFTER A TIMEOUT, IN ORDER TO FREE SIM RESOURCES!

Here is an example script:
Code:
integer iHandle;

default
{
    state_entry()
    {
        iHandle=llListen(-399422, "", "", "");
        llRegionSay(-399422, "info?");
        llSetTimerEvent(5);
    }

    timer()
    {
        //tineout, no region server present
        llSetTimerEvent(0);
        llListenRemove(iHandle);
    }
   

    listen(integer ch, string name, key id, string msg)
    {
        list lInfo=llParseStringKeepNulls(msg, ["|"], []);
        if(llList2String(lInfo,0)!="info") return;
        if(llList2Key(lInfo,1)!=llGetKey()) return;

        // this is the answer we requested
        // let's turn off the listener!

        llSetTimerEvent(0);
        llListenRemove(iHandle);

        string sData=llList2String(lInfo,2);
        list lData=llParseString2List(sData, ["=", "\n"], []);

        //look for a specific setting, e.g. splash
       
        integer iEntry=llListFindList(lData, ["splash"]);
        string sValue;
        if(iEntry>=0) sValue =llList2String(lData, iEntry+1);

        if(sValue=="1")
        {
            //splash is on
            llOwnerSay("splash is on");
        }
        else
        {
            //splash is off
            llOwnerSay("splash is off");
        }
    }
}

Tala
Admin

Posts : 56
Join date : 2008-06-27

http://metalife.powerrpg.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum