Jump to content

Help with configuration- part 2


Shihan Feiri
 Share

You are about to reply to a thread that has been inactive for 4094 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi 2 all,

Now, i have learn how to make configuration from notecard. Now i need to understund how to string value from dataserver in action.

 

Here I will post sample of one script that i have find 

  
    dataserver(key queryid, string data)
    {
        if(queryid == gNotecardHandle)
        {
            //not the last line?
            if(data != EOF)
            {
                //parse this line and set the relevant vars
                handleConfigLine(data);
                
                //get the next line
                gNotecardHandle = llGetNotecardLine(gNotecardName, gCurrNotecardLine++);
            }
            else
            {                
                //make sure everything was configured properly
                if(!isConfigComplete())
                {
                    llInstantMessage(llGetOwner(), "Your notecard was not of the correct format or was not filled out. Please try rewriting it");
                    
                    //don't do any of the things we would do if the config were proper
                    return;
                }
                
                gSettingsLoaded = TRUE;
                
                //normally we'd do... something once the config loaded properly, but for this example we'll just tell the owner what we loaded
                string stringified_config = (string)gANiceBool + "|" + gANiceString + "|" + (string)gANiceVector;
                
                //if our optional setting was set, add it to the string
                if(isSettingSet("anoptionalinteger"))
                    stringified_config += "|" + (string)gOptionalInteger;
                
                llInstantMessage(llGetOwner(), "GOT AN AWESOME CONFIG: " + stringified_config);
            }
        }
    }

 

 

  Now on end of dataserver we have

llInstantMessage(llGetOwner(), "GOT AN AWESOME CONFIG: " + stringified_config);

 

I dont know what i need to do that this message can be triger with dataserver value in eg. touch_start acton

 }

 

 

default
{
    state_entry()
    {
        llSay(0, "Hello, Avatar!");
    }

    touch_start(integer total_number)
    {
//Sample of message
        llInstantMessage(llGetOwner(), (string)gANiceBool + "|" + gANiceString );
    } 
Link to comment
Share on other sites

You have to make the variables globals, so they can be accessed from every event. In your case: set by the dataserver and read by the touch event. Global variables are declared outside the states - here is a simple example:

string gsOwner;default {   stare_entry() {      llRequestAgentData(llGetOwner(), DATA_NAME);   }   dataserver (key queryid, string data) {      gsOwner = data;   }   touch_end(integer num) {     llSay(0, gsOwner);   }}

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4094 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...