OsDetectedCountry

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Created)
 
 
(5 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
|permissions=true
 
|permissions=true
 
|delay=0
 
|delay=0
|function_syntax=string osDetectedCountry(string FirstName, string LastName)
+
|function_syntax=string osDetectedCountry(integer index)
 +
|description=Returns a string that indicates the country in which the avatar is located.
 
|ossl_example=<source lang="lsl">  
 
|ossl_example=<source lang="lsl">  
 
//
 
//
Line 11: Line 12:
 
default
 
default
 
{
 
{
  state_entry()
+
    state_entry()
  {
+
    {
      llSay(0, "Script running");
+
        // Notify in local chat that the script is running
  }
+
        llSay(0, "Script running");
 +
    }
  
  touch_end(integer num)
+
    touch_end(integer num)
  {
+
    {
      string country = osDetectedCountry(0);
+
        // Get the country in which the avatar is located
      llSay(0, "You are in country " + country);
+
        string country = osDetectedCountry(0);
  }
+
 
 +
        // Notify in local chat about the detected country
 +
        llSay(0, "You are in country " + country);
 +
    }
 
}
 
}
</source>
 
 
|description=Returns a string that indicates the country in which the avatar is located.
 
|additional_info=This function only works when called from within Detection events (collision, collision_start, collision_end, sensor, touch, touch_start, touch_end) or in functions called by Detection events.
 
  
 +
</source>
 +
|additional_info=This function only works when called from within Detection events (collision, collision_start, collision_end, sensor, touch, touch_start, touch_end) or in functions called by Detection events.<br>
 +
The country information must be added to grid database using external user admin tools.<br>
 
Added November 11, 2018 in 0.9.1.0 (commit #7bcef500).
 
Added November 11, 2018 in 0.9.1.0 (commit #7bcef500).
 
}}
 
}}
 +
== See Also ==
 +
* [[osGetAgentIP]]
 +
* [[osGetAgentCountry]]
 +
* [[osDetectedCountry]]

Latest revision as of 02:11, 7 March 2024

string osDetectedCountry(integer index)
Returns a string that indicates the country in which the avatar is located.
Threat Level None
Permissions Use of this function is always allowed by default
Extra Delay 0 seconds
Example(s)
//
// Sample script using osDetectedCountry
// 
 
default
{
    state_entry()
    {
        // Notify in local chat that the script is running
        llSay(0, "Script running");
    }
 
    touch_end(integer num)
    {
        // Get the country in which the avatar is located
        string country = osDetectedCountry(0);
 
        // Notify in local chat about the detected country
        llSay(0, "You are in country " + country);
    }
}
Notes
This function only works when called from within Detection events (collision, collision_start, collision_end, sensor, touch, touch_start, touch_end) or in functions called by Detection events.

The country information must be added to grid database using external user admin tools.
Added November 11, 2018 in 0.9.1.0 (commit #7bcef500).


[edit] See Also

Personal tools
General
About This Wiki