ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: 12TimesOver on August 07, 2011, 04:51:05 AM

Title: #LPC
Post by: 12TimesOver on August 07, 2011, 04:51:05 AM
Looking for a little feedback on the use of #LPC in a script or sub. I understand what #LPC is and have read what is actually not a bad Advanced Tutorial that Cheffe did a long time ago on EasyUO. The piece that I would like to understand is when people decide to change it in their scripts. What kind of actions, etc are you upping #LPC for?

For example, TM, you change the #LPC to 100 in your casting subs. Why?

TIA for any feedback.

X
Title: Re: #LPC
Post by: Cerveza on August 07, 2011, 07:03:53 AM
There's a utility that calculates LPC for your PC on easyuo.
Title: Re: #LPC
Post by: gimlet on August 07, 2011, 07:26:48 AM
OK What is LPC?
Title: Re: #LPC
Post by: JustAnotherFace on August 07, 2011, 07:56:06 AM
Lines Per Cycle.... basically it tells the script how fast to execute the lines in the script following that LPC# command, and continues executing the script at that speed until you reset it to something else.  It has been a long time since I have played with it, but if I remember correctly LPC# 100 is the standard speed at which all script lines execute without using the LPC# command. 
Title: Re: #LPC
Post by: JustAnotherFace on August 07, 2011, 07:59:50 AM
Correction... the default is 10 LPC.  As seen in the EUO command reference page:

Quote
The LinesPerCycle command sets the number of lines that the EasyUO parser runs through for every cycle. The default value is 10 and is reset when you stop the script.
 
Cheffe's description of lines per cycle, and cycles per second:

"EUO has 20 cycles per second and in each cycle it executes 10 lines (default). Some commands have built in waits so that the script speed slows down considerably.
 
You can't say that one command is faster than the other. EUO gives away most of the available processing time so that the UO client can have it.
 
EUO doesn't know the difference between a processing intensive task such as "finditem *" at WBB or a simple "set %x 3". While 10 lines per cycle is already too fast if you have 10 finditems in a row you could execute hundreds of set instructions in the same time without stressing the CPU."
 

Read here: http://www.easyuo.com/forum/viewtopic.php?p=21269


Quote from Cheffe:

Quote
Hmmm, maybe I should explain this a bit better:

EUO has 20 cycles per second and in each cycle it executes 10 lines (default). Some commands have built in waits so that the script speed slows down considerably.

You can't say that one command is faster than the other. EUO gives away most of the available processing time so that the UO client can have it.

EUO doesn't know the difference between a processing intensive task such as "finditem *" at WBB or a simple "set %x 3". While 10 liens per cycle is already too fast if you have 10 finditems in a row you could execute hundreds of set instructions in the same time without stressing the CPU.

I'm working on a concept that'll estimate the needed processing time for each command and speed up execution for commands that need virtually no time at all (so that you can execute more of those per cycle).

You can already do that now using linespercycle. If you use this command wisely you can speed up execution speed in parts of the script where a lot of time is wasted and slow down execution in parts that are more difficult for the CPU.

I hope that clears it up.

Also, an advanced tutorial on LPC posted by Cheffe can be found here:

http://www.easyuo.com/forum/viewtopic.php?t=17091 (http://www.easyuo.com/forum/viewtopic.php?t=17091)

JaF
Title: Re: #LPC
Post by: 12TimesOver on August 07, 2011, 08:20:53 AM
Thanks JaF, already read all that. What I'm wondering is how some of our talent actually utilizes it. Why? Where?
Title: Re: #LPC
Post by: JustAnotherFace on August 07, 2011, 12:17:04 PM
Thanks JaF, already read all that. What I'm wondering is how some of our talent actually utilizes it. Why? Where?

Sorry 12, that was directed mainly at Gimlet who asked what LPC was.  I unfortunately can not add much more useful information to this.

JaF
Title: Re: #LPC
Post by: Alpha on August 07, 2011, 12:51:12 PM
@ 12x

As far as I know the common things that people adjust LPC for are the ones that don't have set delays built into them. (ex... finditem)

Journal Scanning
Pixel Scanning

Are the 2 I use it most for.
Title: Re: #LPC
Post by: 12TimesOver on August 07, 2011, 01:08:22 PM
Ah k, gotcha JaF ;)

Journal Scanning
Pixel Scanning

Are the 2 I use it most for.
Thx Alpha.

I guess I'll have to do some testing with some of my subs to see what the difference seems to be. It doesn't seem to do much good to me to cycle 100 lines when I need to throw a wait in ther eanyhow for example.

X
Title: Re: #LPC
Post by: NObama on August 07, 2011, 03:28:06 PM
I think manwinc is a good person to ask.  As I recall, he's written some scripts that make judicious use of #LPC.
Title: Re: #LPC
Post by: TrailMyx on August 07, 2011, 03:53:23 PM
I think it was said before in this thread.  Especially when journal scanning I kick up the #LPC to iterate quickly through the unscanned journal entries.  At #LPC of 10, and there are 20 cycles per second, that means you can do 200 lines per second.  Suppose you have an iterative function that has maybe 20 lines in it, that means you may only be able to loop through it 10 times a second to look for 1 entry.  Suppose you haven't updated your journal pointer for a while and have a depth of 50 entries in your journal.  That means it would take 5 seconds to run that one call to the journal scan function.  If you kick up to 100 LPC, it would take 0.5 seconds.
Title: Re: #LPC
Post by: Crome969 on August 07, 2011, 11:22:05 PM
I just codet in past my Scripts and checked how many lines i have in end, and kept sure he can scan the whole lines in 1 cycle.But i noticed my Ressource using of euo getting up when #lpc is tooo high, so its nothing for old Computers:).
I used lpc a lot when it comes in a way of OCR, complicated handling of Routines or something about Journalscanning as MTx said.

Kind Regards

Crome
Title: Re: #LPC
Post by: 12TimesOver on August 08, 2011, 03:10:47 AM
Good stuff guys, thanks!!

X
Title: Re: #LPC
Post by: Neo on August 12, 2011, 04:03:04 PM
I'm new at using this, but this is what I found in my crafter's check sub:

This is part of it
Code: [Select]
repeat
finditem %weapon C_ , %trashbag
set %currentweapon #findid
wait 10
if #findkind = -1
   {
   return
   }
event property #findid
wait 5
for %cproprange %custompropmin 150
    {
    if ( %customprop , #spc , %cproprange in #property && %custompropchk = #true )
       {
       set %custompropcnt %custompropcnt + 1
       set %totalcnt %totalcnt + 1
       menu Text EUOLabel38 216 280 %custompropcnt
       menu Text EUOLabel19 456 296 %totalcnt
       gosub keep %currentweapon
       ignoreitem #findid
       return
       }
    }
So, I have several checks like this one in this sub... I use event property once, then I do all the checking for the weapon properties... In this first one (for %cproprange %custompropmin 150) the 'range' its going to check for is minimum amount of intensity the user wants, up until 150... So, if the user wants to save any weapon with Luck above 30, it will check for 30, 31, 32, ..., 150. Same thing to check for other properties. I have no full understanding how easyuo would work exactly doing this, but I did notice that it took a while to finish checking the weapon when I first wrote this sub like this...

Then I changed #LPC to 1000 for this specific sub, and apparently this "wait time" to check the weapon's properties was gone. It feels almost instant now...

So, while in this sub, I set #LPC to 1000, and before exiting the sub, I set it back to what it was previously (10 I guess).
Title: Re: #LPC
Post by: Endless Night on August 16, 2011, 05:22:22 PM
I use LPC in alot of functions... but i normally save the old LPC and restore it at the end of said function.

I use it to:
- Load large vairable lists (like in my overseer script)
- Large amounts of number crunching/calculations
- Intensive Tile scanning to make it seem like my miner/lumberjacker is not scripted as he instantly mines)
- any time intensive repetative action...

My buffbar scanner... uses a LPC of 9999... this allows it to function at acceptable speeds otherwise the scanner would be uselessly slow.
Title: Re: #LPC
Post by: TrailMyx on August 16, 2011, 06:51:19 PM
My buffbar scanner... uses a LPC of 9999... this allows it to function at acceptable speeds otherwise the scanner would be uselessly slow.

Same goes for the CLAw.  Without the LPC kicked up, you might as well evaluate the loot by hand faster.  The same can't be said for OEUO.  The CLAw evaluation engine in OEUO is stunningly fast.
Title: Re: #LPC
Post by: Endless Night on August 16, 2011, 07:10:28 PM
My buffbar scanner... uses a LPC of 9999... this allows it to function at acceptable speeds otherwise the scanner would be uselessly slow.

Same goes for the CLAw.  Without the LPC kicked up, you might as well evaluate the loot by hand faster.  The same can't be said for OEUO.  The CLAw evaluation engine in OEUO is stunningly fast.

Likewise with my buffbar scanner... as fast and efficent as i make the code in EUO with max lpc... bloated sloppy second rate code in OpenEUO is still faster.
Title: Re: #LPC
Post by: Crome969 on August 17, 2011, 02:44:30 AM
My buffbar scanner... uses a LPC of 9999... this allows it to function at acceptable speeds otherwise the scanner would be uselessly slow.

Same goes for the CLAw.  Without the LPC kicked up, you might as well evaluate the loot by hand faster.  The same can't be said for OEUO.  The CLAw evaluation engine in OEUO is stunningly fast.

Likewise with my buffbar scanner... as fast and efficent as i make the code in EUO with max lpc... bloated sloppy second rate code in OpenEUO is still faster.


Example for OCR, Lethal Dart Quest
EUO = 3-6 seconds to Scan with 10.000 lpc
OEUO = uncountable in the second i see its scanned.