You last visited: Today at 03:32
Advertisement
[Python] Need help please
Discussion on [Python] Need help please within the Metin2 forum part of the Popular Games category.
11/21/2014, 18:09
#1
elite*gold: 0
Join Date: Oct 2012
Posts: 11
Received Thanks: 0
[Python] Need help please
Greetings Fellow EPVPers!
So, recently i started programming simple tools in python, but i got stuck.
I'd be glad if someone would help.
First problem:
I got this simple window with one editable box and one button and i need to send the text from self.slotbar_editline as GM notice.
if i want to send /n Hello world! i'll use this:
Code:
net.SendChatPacket("/n Hello World!")
But i don't know how to use the text from editable box.
Second problem:
How do i hide this window on start and make it visible on keypress? Like if you press F7 the window will show and if you press F7 again, it will hide again.
Code:
import ui
import dbg
import app
import net
class Dialog1(ui.Window):
def __init__(self):
ui.Window.__init__(self)
self.BuildWindow()
def __del__(self):
ui.Window.__del__(self)
def BuildWindow(self):
self.Board = ui.BoardWithTitleBar()
self.Board.SetSize(170, 170)
self.Board.SetCenterPosition()
self.Board.AddFlag('movable')
self.Board.AddFlag('float')
self.Board.SetTitleName('Send notice')
self.Board.SetCloseEvent(self.Close)
self.Board.Show()
self.__BuildKeyDict()
self.comp = Component()
self.send = self.comp.Button(self.Board, 'Send!', '', 50, 105, self.send_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
self.slotbar_editline, self.editline = self.comp.EditLine(self.Board, '', 30, 85, 100, 15, 30)
def send_func(self):
#net.SendChatPacket()
pass
def __BuildKeyDict(self):
onPressKeyDict = {}
onPressKeyDict[app.DIK_F5] = lambda : self.OpenWindow()
self.onPressKeyDict = onPressKeyDict
def OnKeyDown(self, key):
try:
self.onPressKeyDict[key]()
except KeyError:
pass
except:
raise
return TRUE
def OpenWindow(self):
if self.Board.IsShow():
self.Board.Hide()
else:
self.Board.Show()
def Close(self):
self.Board.Hide()
class Component:
def Button(self, parent, buttonName, tooltipText, x, y, func, UpVisual, OverVisual, DownVisual):
button = ui.Button()
if parent != None:
button.SetParent(parent)
button.SetPosition(x, y)
button.SetUpVisual(UpVisual)
button.SetOverVisual(OverVisual)
button.SetDownVisual(DownVisual)
button.SetText(buttonName)
button.SetToolTipText(tooltipText)
button.Show()
button.SetEvent(func)
return button
def ToggleButton(self, parent, buttonName, tooltipText, x, y, funcUp, funcDown, UpVisual, OverVisual, DownVisual):
button = ui.ToggleButton()
if parent != None:
button.SetParent(parent)
button.SetPosition(x, y)
button.SetUpVisual(UpVisual)
button.SetOverVisual(OverVisual)
button.SetDownVisual(DownVisual)
button.SetText(buttonName)
button.SetToolTipText(tooltipText)
button.Show()
button.SetToggleUpEvent(funcUp)
button.SetToggleDownEvent(funcDown)
return button
def EditLine(self, parent, editlineText, x, y, width, heigh, max):
SlotBar = ui.SlotBar()
if parent != None:
SlotBar.SetParent(parent)
SlotBar.SetSize(width, heigh)
SlotBar.SetPosition(x, y)
SlotBar.Show()
Value = ui.EditLine()
Value.SetParent(SlotBar)
Value.SetSize(width, heigh)
Value.SetPosition(1, 1)
Value.SetMax(max)
Value.SetLimitWidth(width)
Value.SetMultiLine()
Value.SetText(editlineText)
Value.Show()
return SlotBar, Value
def TextLine(self, parent, textlineText, x, y, color):
textline = ui.TextLine()
if parent != None:
textline.SetParent(parent)
textline.SetPosition(x, y)
if color != None:
textline.SetFontColor(color[0], color[1], color[2])
textline.SetText(textlineText)
textline.Show()
return textline
def RGB(self, r, g, b):
return (r*255, g*255, b*255)
def SliderBar(self, parent, sliderPos, func, x, y):
Slider = ui.SliderBar()
if parent != None:
Slider.SetParent(parent)
Slider.SetPosition(x, y)
Slider.SetSliderPos(sliderPos / 100)
Slider.Show()
Slider.SetEvent(func)
return Slider
def ExpandedImage(self, parent, x, y, img):
image = ui.ExpandedImageBox()
if parent != None:
image.SetParent(parent)
image.SetPosition(x, y)
image.LoadImage(img)
image.Show()
return image
def ComboBox(self, parent, text, x, y, width):
combo = ui.ComboBox()
if parent != None:
combo.SetParent(parent)
combo.SetPosition(x, y)
combo.SetSize(width, 15)
combo.SetCurrentItem(text)
combo.Show()
return combo
def ThinBoard(self, parent, moveable, x, y, width, heigh, center):
thin = ui.ThinBoard()
if parent != None:
thin.SetParent(parent)
if moveable == TRUE:
thin.AddFlag('movable')
thin.AddFlag('float')
thin.SetSize(width, heigh)
thin.SetPosition(x, y)
if center == TRUE:
thin.SetCenterPosition()
thin.Show()
return thin
def Gauge(self, parent, width, color, x, y):
gauge = ui.Gauge()
if parent != None:
gauge.SetParent(parent)
gauge.SetPosition(x, y)
gauge.MakeGauge(width, color)
gauge.Show()
return gauge
def ListBoxEx(self, parent, x, y, width, heigh):
bar = ui.Bar()
if parent != None:
bar.SetParent(parent)
bar.SetPosition(x, y)
bar.SetSize(width, heigh)
bar.SetColor(0x77000000)
bar.Show()
ListBox=ui.ListBoxEx()
ListBox.SetParent(bar)
ListBox.SetPosition(0, 0)
ListBox.SetSize(width, heigh)
ListBox.Show()
scroll = ui.ScrollBar()
scroll.SetParent(ListBox)
scroll.SetPosition(width-15, 0)
scroll.SetScrollBarSize(heigh)
scroll.Show()
ListBox.SetScrollBar(scroll)
return bar, ListBox
Dialog1().Show()
Any help is appreciated.
Thank you Very much, Masteriako.
11/21/2014, 18:30
#2
elite*gold: 726
Join Date: Jul 2010
Posts: 14,233
Received Thanks: 7,915
PHP Code:
net . SendChatPacket ( self . editline . GetText ())
.
11/21/2014, 18:45
#3
elite*gold: 0
Join Date: Oct 2012
Posts: 11
Received Thanks: 0
Quote:
Originally Posted by
123klo
PHP Code:
net . SendChatPacket ( self . editline . GetText ())
.
Thank you 123klo but i already know this... I need to use the text from edit line as a part of the send chat packet
i thought of something like this:
Code:
net.Send.Chat.Packet("/n "+str(self.editline.GetText())
But it didnt work
Ah, okay i finally got it, so problem 1 solved
Code:
net.SendChatPacket("/n "+ self.editline.GetText())
Now the second problem, how to hide it on start and show it on keypress?
Similar Threads
[Python-Modul]EXP-Donator (kompatibel mit Python Loader)
11/23/2013 - Metin2 Hacks, Bots, Cheats, Exploits & Macros - 27 Replies
Moin,
da man mich danach gefragt hat und ich sowieso mal ein Beispiel für die Benutzung meines Python Loaders veröffentlichen wollte, habe ich die Gelegenheit genutzt und euch eben einen EXP-Spendebot geschrieben.
Man kann ihn einfach mit dem oben verlinkten Python Module Loader laden und ihn mit F5 aktivieren/deaktivieren.
Sobald ihr mehr als 99 Erfahrungspunkte habt (man kann nur in 100er Schritten spenden), werden alle Erfahrungspunkte an eure Gilde gespendet.
Wer Lust hat und...
[Python]Python Loader vs import
07/29/2013 - Metin2 Private Server - 2 Replies
when i tried to inject my bot with this
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "eigenartig/mainboard.py")
syserr shows me:
0728 16:55:05139 :: CEffectManager::RegisterEffect - LoadScript(d:/ymir work/effect/hit/percent_damage1.mse) Error
0728 16:55:05139 :: CInstanceBase::RegisterEffect(eEftType=264, c_szEftAttachBone=, c_szEftName=d:/ymir work/effect/hit/percent_damage1.mse, isCache=1) - Error
0728 16:55:05139 :: CEffectManager::RegisterEffect...
Help to make a python file works with python loader
03/03/2013 - Metin2 - 2 Replies
Hey epvp! I want make a very. Little hack works on pythonn loader can anybody help me please?
Metin2 - Python - Wie Python Hacks verschlüsseln und Server überprüfen (GF/PServe)
09/23/2012 - Metin2 - 2 Replies
Ich wollte fragen,
wie man Python Hacks am besten Verschlüsselt ?
und wie man feststellen kann ob man auf einem GF / Pserver spielt. ?
Python + Eric Python IDE installieren ?!
07/05/2011 - General Coding - 0 Replies
hat sich erledigt.
All times are GMT +2. The time now is 03:32 .