I have made a little bot, it gives to the biologist the items, this works if the server has "Professional Biolog System". Anyway i made the bot check if the system is there, and if it has not, it will tell you!
Still need to figure out how to make the onupload depend the time_remainig of the biologist, any idea will be welcomed!
Code:
Show Spoiler
Still need to figure out how to make the onupload depend the time_remainig of the biologist, any idea will be welcomed!
Code:
Python Source Code
- import uiprofessionalbiolog, ui, app, chat, net
- bioState=0
- class VisualPart(ui.ScriptWindow):
- def __init__(self):
- ui.ScriptWindow.__init__(self)
- self.Board = ui.BoardWithTitleBar()
- self.Board.SetTitleName('Enzor Auto Biog bot')
- self.Board.SetSize(180, 150)
- self.Board.SetCenterPosition()
- self.Board.SetCloseEvent(self.Cls)
- self.Board.AddFlag('movable')
- self.Board.Show()
- self.comp = Component()
- self.BioBtn = self.comp.ToggleButton(self.Board, 'Auto Bio', 'Automatically gives items', 50, 70, self.bioOff, self.bioOn, 'd:/ymir work/ui/public/Large_button_01.sub', 'd:/ymir work/ui/public/Large_button_02.sub','d:/ymir work/ui/public/Large_button_03.sub')
- def ShowBack(self):
- global IsShowing
- IsShowing=1
- self.Board.Show()
- def Cls(self):
- global IsShowing
- IsShowing=0
- self.Board.Hide()
- def bioOn(self):
- global bioState
- bioState=1
- chat.AppendChat(7, 'AutoBiog activated')
- def bioOff(self):
- global bioState
- bioState=0
- chat.AppendChat(7, 'AutoBiog desactivated')
- 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 HideButton(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.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 F8Func():
- global IsShowing
- if app.IsPressed(app.DIK_F8) and IsShowing==0:
- IsShowing=1
- starter.ShowBack()
- elif app.IsPressed(app.DIK_F7) and IsShowing==1:
- IsShowing=0
- starter.Cls()
- pass
- def OnUpdate(self):
- lastTime = max(0, self.endTime - time.clock())
- if 0 == lastTime:
- self.Close()
- self.eventTimeOver()
- else:
- return
- def autoBiog():
- global bioState
- if bioState==1:
- if app.ENABLE_BIOLOG_SYSTEM:
- t=int(uiprofessionalbiolog.BIOLOG_BINARY_LOADED["time"][0]) #En segundos
- time_remaining = t - app.GetGlobalTimeStamp() #En segundos
- if time_remaining <= 0:
- net.SendChatPacket("/biolog")
- elif time_remaining >0:
- pass
- else:
- pass
- hf8 = ui.Window()
- hf8.OnUpdate = F8Func
- hf8.Show()
- ab = ui.Window()
- ab.OnUpdate = autoBiog
- ab.Show()
- starter = VisualPart()
- starter.Show()
- chat.AppendChat(7,"Press F7 to close and F8 to open the system.")
Post was edited 1 time, last by “Marshall” ().