Difference between revisions of "LlGetSimulatorHostname"
Jump to navigation
Jump to search
All Issues ~ Search JIRA for related Bugs
m (chop some expensive delay workarounds we don't need any more) |
|||
(13 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{LSL_Function | ||
|func_id=283|func_sleep=10.0|func_energy=10.0 | |||
|func=llGetSimulatorHostname | |||
|return_type=string | |||
|func_footnote | |||
|func_desc | |||
|return_text=that is the hostname of the machine the script is running on (same as string in viewer Help dialog) | |||
|spec | |||
|caveats | |||
|constants | |||
|examples=<source lang="lsl2"> | |||
// The beginnings of a region-info script. | |||
string region; | |||
string sim; | |||
default | |||
{ | |||
state_entry() | |||
{ | |||
llSetTimerEvent(1.0); | |||
} | |||
timer() | |||
{ | |||
string here = llGetRegionName(); | |||
if(region != here) | |||
{ | |||
sim = llGetSimulatorHostname(); | |||
region = here; | |||
} | |||
llSetText( | |||
" REGION NAME : " + region + | |||
"\n SIM HOSTNAME : " + sim + | |||
"\nTIME DIALATION : " + (string)llGetRegionTimeDilation() + | |||
"\n REGION FPS : " + (string)llGetRegionFPS(), | |||
<0,1,0>, 1.0); | |||
} | |||
} | |||
</source> | |||
<source lang="lsl2"> | |||
// llGetEnv now offers an equivalent function without the 10 second delay. | |||
SaySimulatorHostname() | |||
{ | |||
llOwnerSay("Simulator Hostname: " + llGetEnv("simulator_hostname") ); | |||
} | |||
default | |||
{ | |||
on_rez(integer start_param) | |||
{ | |||
SaySimulatorHostname(); | |||
} | |||
changed(integer iChange) | |||
{ | |||
if (iChange & (CHANGED_REGION_START|CHANGED_REGION)) | |||
SaySimulatorHostname(); | |||
} | |||
state_entry() | |||
{ | |||
SaySimulatorHostname(); | |||
} | |||
} | |||
</source> | |||
|helpers | |||
|also_functions={{LSL DefineRow||[[llGetRegionFPS]]|Gets the region FPS}} | |||
{{LSL DefineRow||[[llGetRegionTimeDilation]]|Gets the region time dilation}} | |||
{{LSL DefineRow||[[llGetEnv]]("simulator_hostname")|Equivalent function without the script delay}} | |||
|also_tests | |||
|also_events | |||
|also_articles={{LSL DefineRow||[[Simulator IP Addresses]]|}} | |||
|notes | |||
|cat1=Region | |||
|cat2 | |||
|cat3 | |||
|cat4 | |||
}} |
Latest revision as of 13:53, 17 May 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: string llGetSimulatorHostname( );283 | Function ID |
10.0 | Forced Delay |
10.0 | Energy |
Returns a string that is the hostname of the machine the script is running on (same as string in viewer Help dialog)
Caveats
- This function causes the script to sleep for 10.0 seconds.
Examples
// The beginnings of a region-info script.
string region;
string sim;
default
{
state_entry()
{
llSetTimerEvent(1.0);
}
timer()
{
string here = llGetRegionName();
if(region != here)
{
sim = llGetSimulatorHostname();
region = here;
}
llSetText(
" REGION NAME : " + region +
"\n SIM HOSTNAME : " + sim +
"\nTIME DIALATION : " + (string)llGetRegionTimeDilation() +
"\n REGION FPS : " + (string)llGetRegionFPS(),
<0,1,0>, 1.0);
}
}
// llGetEnv now offers an equivalent function without the 10 second delay.
SaySimulatorHostname()
{
llOwnerSay("Simulator Hostname: " + llGetEnv("simulator_hostname") );
}
default
{
on_rez(integer start_param)
{
SaySimulatorHostname();
}
changed(integer iChange)
{
if (iChange & (CHANGED_REGION_START|CHANGED_REGION))
SaySimulatorHostname();
}
state_entry()
{
SaySimulatorHostname();
}
}
See Also
Functions
• | llGetRegionFPS | – | Gets the region FPS | |
• | llGetRegionTimeDilation | – | Gets the region time dilation | |
• | llGetEnv("simulator_hostname") | – | Equivalent function without the script delay |
Articles
• | Simulator IP Addresses |