Scripts run on server or on client?
|
|
Laser Yiyuan
Registered User
Join date: 27 Jun 2007
Posts: 6
|
07-03-2007 22:40
I write a very simple script to test it. When it loops from 1 to 1000, SL can give the result, but very slowly. It seems that the script is running on the server. But if the loops go higher to 10000, there is nothing to display, not even an alert message. But the program has been compiled successfully and uploaded completely.
Even a simple script like this could not be found wrong easily. How can we find what's going on with more complicated scripts in SL?
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
07-03-2007 23:14
From: Laser Yiyuan It seems that the script is running on the server. All LSL scripts run on the server (sim).
|
|
Laser Yiyuan
Registered User
Join date: 27 Jun 2007
Posts: 6
|
07-03-2007 23:52
From: Deanna Trollop All LSL scripts run on the server (sim). It seems that the server will not process the cript if it is too resouce consuming. Is that right? If it is true is there any criterial we could know about?
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
07-04-2007 00:05
From: Laser Yiyuan It seems that the server will not process the cript if it is too resouce consuming. Is that right? Unfortunately, no.
|
|
Laser Yiyuan
Registered User
Join date: 27 Jun 2007
Posts: 6
|
07-04-2007 00:36
From: Deanna Trollop Unfortunately, no. pls try following script. You can get "Hello, Avatar!" in LSLEditor, but you get nothing in SL. default { state_entry() { for(integer i = 1; i < 100000000; i++ ) ; llSay(0, "Hello, Avatar!"  ; } }
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
07-04-2007 01:26
Loops tend to be slow in LSL. Even your simple loop which does nothing more than increment i and test if it is less than a constant value can take *much* longer to execute on an SL sim than on your local machine, since your local machine doesn't have x-thousand other LSL scripts, physics, agent updates, etc. using up processing cycles in between your loops. Yes, if you left it running long enough (and assuming the sim doesn't crash during that time), it would eventually complete it's hundred-millionth loop and greet you politely, if generically.
|
|
Laser Yiyuan
Registered User
Join date: 27 Jun 2007
Posts: 6
|
07-04-2007 01:48
From: Deanna Trollop Loops tend to be slow in LSL. Even your simple loop which does nothing more than increment i and test if it is less than a constant value can take *much* longer to execute on an SL sim than on your local machine, since your local machine doesn't have x-thousand other LSL scripts, physics, agent updates, etc. using up processing cycles in between your loops. Yes, if you left it running long enough (and assuming the sim doesn't crash during that time), it would eventually complete it's hundred-millionth loop and greet you politely, if generically. You mean sim will excute the code until it's down? I wish nobody will take advantage of it.
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
07-04-2007 02:57
From: Laser Yiyuan You mean sim will excute the code until it's down? Why wouldn't it? [Edit: I didn't mean to say that your hundred-million-iterations loop would in any way *cause* a sim to crash, if that's how you read it... I just meant if the sim didn't *happen* to crash while it was running your loop, and hence loose it's place]
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
07-04-2007 11:35
From: Laser Yiyuan pls try following script. You can get "Hello, Avatar!" in LSLEditor, but you get nothing in SL. That's because LSL Editor doesn't parse the code correctly and pseudo-executes the wrong code. Your code has a bug in it: you put a semicolon right after the for statement. Try this code instead: default { state_entry() { for(integer i = 1; i < 100000000; i++ ) llSay(0, "Hello, Avatar!"  ; } }
|