This module was not designed for people who don't know nothing about python.
Here is a simple functions which gives you the chance to be able to turn all objects of script loader (uiScript) into a a simple list and control all very simple.
This is more easy if you have a lot a objects and want to do some actions with them like set multiples text, load images etc. do a simple loop by range start:end and you can play with it.
self.OBJECT_MAX_NUM = 25 | You can change how many max objects you can send into list.
self.Realloc(state, objectList) | You can run a action (Hide() / Show()) for all objects what you sended on list.
Probably changing the way it indexes the data does the deal, using strings instead of numbers sounds good to me.
Now you can use it more easy, have fun.
Code:
#root/ui.py
def GetChildDictionary(self, received_objects):
if isinstance(received_objects, (list, tuple)):
return {item : self.ElementDictionary.get(item, None) for item in received_objects}
return dict()
def Realloc(self, state, received_objects, allowed_type = [self.STATE_HIDE, self.STATE_SHOW]):
if (not state in allowed_type or not isinstance(received_objects, dict)):
import dbg
dbg.TraceError(
"<ScriptWindow> Failed to change state.\n{0}\n{1}".format(
"<state '{0}'> Allowed states: {1}.".format(state, allowed_type),
"{0} Allowed type: {1}.".format(type(received_objects), type(dict()))))
return
for item in [zip for zip in received_objects.values() if (zip is not None)]:
if state is self.STATE_HIDE:
item.Hide()
else:
item.Show()
#main.py (example):
self.childrenDict = self.GetChildDictionary(["LoginButton", "LoginExitButton"])
self.childrenDict["LoginButton"].SetPosition(20, 500)
self.childrenDict["LoginExitButton"].SetPosition(-300, 800)
self.Realloc(self.STATE_SHOW, childrenDict) # Use Realloc(state, object_dictionary) for a action as Hide() or Show() by state.
[item.Hide() if (state is self.STATE_HIDE) else item.Show()
for item in [object for object in (received_objects
if len(received_objects) < self.OBJECT_MAX_NUM else
received_objects[:self.OBJECT_MAX_NUM])
if (object is not None)]]
Well, this is quite bad code style.
Try to stay to the pythonic way, list comprehensions should only be used for simple list-related methods (and only for one line, mostly) and here you could easily use a normal loop and a if, this would make your code much more readable.
[Python] Modules after GameForge-Update (01.10.2013) 05/23/2015 - Metin2 Guides & Templates - 21 Replies Good afternoon Elitepvpers.
The update from the 01.10.2013 has changed a few things in the Metin2Client concerning Python.
Some Pythonmodules have been removed from the Root-Eterpack and were moved directly into the client-executable.
Dump:
Module: background
004511C0 IsSoftwareTiling
004511E0 EnableSoftwareTiling
00451240 EnableSnow
00451970 GlobalPositionToLocalPosition
Fatal errror: failed to load platform modules 05/02/2011 - Counter-Strike - 9 Replies ja ich kann kein CS:S mehr spielen/starten denn bei steam is irgendetwas kaputt, naja immer kommt die fehler meldung "Fatal errror: failed to load platform modules" kann mir da jemand weiter helfen?
mfg
BotResourcePack (VB.net modules) 05/04/2009 - CO2 Bots & Macros - 58 Replies I was bored so I decided to try the level-bot for taos in BanditL97 cave.
I noticed it lagged the system alot and didnt sit/meditate or auto-disconnect when attacked so thought "I should make a better one!" ...which I did.
The bot was almost finished when I decided to change what it did... modularisation was then needed so I spilt functions off into their own self-contained modules.
This download is what resulted.
These modules can be used with any Bot-making in VB.net so far and I...
Question about modules 10/13/2007 - Conquer Online 2 - 0 Replies This might not be the right part of the forum to ask, But i tried search so dont say use search =P
I was wondering if theres a VB module around to allow editting memory adresses, this is to make a trainer in VB for SV :)
So if anyone can point me to the right direction it would be very apreciated.