Author Topic: set #lpc What does it do?  (Read 3820 times)

0 Members and 1 Guest are viewing this topic.

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3014
  • Activity:
    4%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +206
  • Referrals: 2
    • View Profile
set #lpc What does it do?
« on: July 01, 2013, 09:15:26 PM »
0
What does this command do? I see it used a lot and I see it usually as set #lpc 100 and a few times as set #lpc 200.

Thanks!!

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: set #lpc What does it do?
« Reply #1 on: July 01, 2013, 09:32:00 PM »
0
LPC stands for lines per cycle.  The standard EUO script runs at 10 lines per cycle.  You can override the standard execution speed to allow your script to run quicker then it normally can.  Having a higher LPC effects other running scripts and will increase your overall performance.  So you should keep your LPC as low as possible.   You'll notice some scripts will bump the LPC up to very large values, but that should only be temporary for evaluation of specific instances.

Edit.  Cycle, not second.  Don't try answering questions when you're drunk.  lol
« Last Edit: July 02, 2013, 05:55:23 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Crome969

  • Elite
  • *
  • *
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: set #lpc What does it do?
« Reply #2 on: July 01, 2013, 11:06:16 PM »
0
LPC stands for lines per second.  The standard EUO script runs at 20 lines per second.  You can override the standard execution speed to allow your script to run quicker then it normally can.  Having a higher LPC effects other running scripts and will increase your overall performance.  So you should keep your LPC as low as possible.   You'll notice some scripts will bump the LPC up to very large values, but that should only be temporary for evaluation of specific instances.

If i remember right, it also use more cpu\memory so you will loose a few ressource.

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: set #lpc What does it do?
« Reply #3 on: July 02, 2013, 04:38:50 AM »
0
Pretty much exactly what TM Said. Unless you are Crunching large Amounts of Data, or Pixel scanning Bunches of Pixels, you don't really need to take your #Lpc above 100. Once your CPU starts Capping out on your Computer EUO starts Slowing Way Down, making your #Lpc Pointless.
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline ximan

  • Jr. Member
  • **
  • Posts: 98
  • Activity:
    0%
  • Reputation Power: 1
  • ximan has no influence.
  • Respect: +16
  • Referrals: 1
    • View Profile
Re: set #lpc What does it do?
« Reply #4 on: July 02, 2013, 08:51:48 AM »
0
Right, you want to use as low a #lpc as you can get away with.  However, load increase depends upon what is happening in the code, try running these three snippets in turn while monitoring your cpu usage with each:

Code: [Select]
set #lpc 200
set %a 1
while #true
{
  set %a %a + 1
}

Code: [Select]
set #lpc 200
set %a 1
while #true
{
 finditem *
  set %a %a + 1
}

Code: [Select]
set #lpc 200
set %a 1
while #true
{
 finditem *
  set %a %a + 1
  sleep 10
}

The reason I cranked up #lpc in your script was to run boiler plate (pure data manipulation, menu, and control flow) code as quickly as possible in order to increase UI responsiveness and to measure how long craft gumps disappeared when an item was created.  You can set it lower if it is causing problems, however most simple scripts tend spend a majority of their time waiting to do something cyclical, and such waits tend to break up the cpu utilization into bursts, regardless of the #lpc setting.


Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: set #lpc What does it do?
« Reply #5 on: July 02, 2013, 10:15:04 AM »
0
Nah, you're fine at 200. I think I actually do 9999 in my Cont_Timer Sub. There are a few gumps in UO that once they pop up, its impossible to force them to be the Topmost gump again, so you need to react pretty quickly.


What a lot of coders will do with their subs is set a variable to what the #LPC was at the start of their sub, increase the LPC, and then Reset it at the End of it.


Sub DO_Something
Namespace Push
Namespace Local DO_Something
set !LPC #LPC
set #LPC 200
; DO Something
set #LPC !LPC
Namespace Pop
Return
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: set #lpc What does it do?
« Reply #6 on: July 02, 2013, 10:18:46 AM »
0
Another thing to think about is how your LPC effects the operation of other scripts.  An instance of EUO seems to share from a pool of performance.  So if you are hogging the LPC with a script, it will make the other scripts run slower.  I probably have some examples somewhere when I was testing this, but it's pretty easy to modify what Ximan posted to convince yourself that you should be a good scripting neighbor.
Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: