Jump to content

Loading Gauge Improvement


Recommended Posts

  • Forum Moderator

First one, thanks for release and good idea, here are some advices for the next time, how you should use zip method and lambda instead of __mem__func__ and others empty functions.

  • Since the loadStepList is declared with ascending numbers from 0 to 100 (by default), we don't have to use min and max method for get the values for range, just the first value and the last value from list.
  • __mem_func__ and the function 'bos' are useless in that case, we can replace it with a null lambda, will do the same job too.
  • Using an list comprehension with conditions inside, isn't so readable.

Good idea for zip method to get all the progresses values, but we don't need to initialize like that, you can acces the first reference by using index [0] from iterator.

Spoiler

# checkin, _ = zip(*self.loadStepList)

lst = [[1, None], [2, None]]
first, second = zip(*lst)
print (first, second)
>>> (1, 2) (None, None)

lst = [[1, None], [2, None]]
first = tuple(zip(*lst))[0]
print (first)
>>> (1, 2)

# I would use a bitwise and set method to get the missing values without doing a check for progress value.
print (list(set([0, 2]) ^ set([0, 1, 2, 3, 4, 5])))
>>> [1, 3, 4, 5]

 

On 5/25/2019 at 12:03 AM, Mali61 said:

def bos(self):
	pass

checkin, _ = zip(*self.loadStepList)
self.loadStepList = sorted(self.loadStepList+[(i, ui.__mem_func__(self.bos)) for i in range(min(checkin), max(checkin)+1) if i not in checkin])

Should look like

This is the hidden content, please
:

This is the hidden content, please

  • Metin2 Dev 23
  • Sad 1
  • Good 3
  • Love 1
  • Love 25
Link to comment
Share on other sites

  • Honorable Member
18 minutes ago, flexivk123 said:

Thanks a lot! cool stuff but i have expanded loading bar which is barely larger it loads just to 70% of gauge then it enters the game. Since im new to python i do not know how to solve it. 

Could you guys help me please?

I think you are looking for:

Quote

self.loadingGage.SetPercentage(p, 160)

Change 160 for your gauge

  • Love 1

 

Link to comment
Share on other sites

  • 4 months later...
  • Gold

 @VegaS™ I got  some error with this improvement:

Spoiler

1001 20:48:17180 :: Traceback (most recent call last):

1001 20:48:17180 ::   File "introLoading.py", line 287, in OnUpdate

1001 20:48:17181 ::   File "introLoading.py", line 196, in __SetProgress

1001 20:48:17181 :: KeyError
1001 20:48:17181 :: : 
0929 11:34:15143 :: 1 (load progress number so in sysser it's showing key errors from 1 to 99)
0929 11:34:15143 :: 

 

 

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • Forum Moderator

@ReFresh  You used a small extension which i did for you 3 years ago.

Spoiler

If somebody still have this problem, you need to check the key of the dictionary like:

This is the hidden content, please

  • Metin2 Dev 7
  • Love 17
Link to comment
Share on other sites

  • 4 weeks later...
  • 3 weeks later...
  • Forum Moderator
On 5/24/2019 at 11:49 PM, VegaS™ said:

tmpLoadStepList = tuple(zip(*self.loadStepList))[0]
for progress in range(tmpLoadStepList[0], tmpLoadStepList[-1] + 1):
	if progress not in tmpLoadStepList:
		self.loadStepList.append((progress, lambda: None))
	
self.loadStepList.sort()

 

There's a better version instead of what i did some time ago, which find the differences directly, without check each progress index.

This is the hidden content, please

  • Metin2 Dev 21
  • Good 2
  • Love 21
Link to comment
Share on other sites

  • 3 years later...

Optimized version for best performance.

		tmpLoadStepList = [step[0] for step in self.loadStepList]
		missingSteps = set(range(tmpLoadStepList[0], tmpLoadStepList[-1] + 1)).difference(tmpLoadStepList)
		self.loadStepList += [(progress, lambda: None) for progress in missingSteps]
		self.loadStepList.sort()

 

  • Good 1
Link to comment
Share on other sites

Announcements



  • Similar Content

  • Similar Content

  • Similar Content

  • Tags

  • Activity

    1. 3

      [Discussion] Rain - The First Person that leaked the M2 Files

    2. 0

      [Client] All tabs opening after quest/npc talk or even shop // PORTS

    3. 0

      Arrow does not hide at warp

    4. 0

      Problem with sidebar by vegas

    5. 58

      Discord Rich Presence

    6. 145

      Full Costume Mount System

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.