Jump to content

[PY] Doubt about "class BigBoardControl"


Recommended Posts

Hello, I'm testing the class "BigBoardControl"

Code:
 

	class BigBoardControl(ui.Bar):

		FONT_WIDTH	= 18
		FONT_HEIGHT	= 18
		LINE_WIDTH  = 500
		LINE_HEIGHT	= FONT_HEIGHT + 5
		STEP_HEIGHT = LINE_HEIGHT * 2
		LINE_CHANGE_LIMIT_WIDTH = 450
		BIG_TEXTBAR_MAX_HIGHT = 1000

		FRAME_IMAGE_FILE_NAME_LIST = [
			"season1/interface/oxevent/frame_new_0.sub",
			"season1/interface/oxevent/frame_new_1.sub",
		]

		FRAME_IMAGE_STEP = 256

		FRAME_BASE_X = -20
		FRAME_BASE_Y = -12

		def __init__(self):
			ui.Bar.__init__(self)

			self.AddFlag("not_pick")
			self.tipList = []
			self.curPos = 0
			self.dstPos = 0
			self.nextScrollTime = 0
			self.scrollstop = 0
			self.pretexsize = 0
			self.nexttextsize = 0
			self.changeline = 0
			self.addtipListcount = 0

			self.SetPosition(0, 150)
			self.SetSize(512, 55)
			self.SetColor(grp.GenerateColor(0.0, 0.0, 0.0, 0.5))
			self.SetWindowHorizontalAlignCenter()

			self.__CreateTextBar()
			self.__LoadFrameImages()


		def __LoadFrameImages(self):
			x = self.FRAME_BASE_X
			y = self.FRAME_BASE_Y
			self.imgList = []
			for imgFileName in self.FRAME_IMAGE_FILE_NAME_LIST:
				self.imgList.append(self.__LoadImage(x, y, imgFileName))

		def __LoadImage(self, x, y, fileName):
			img = ui.ImageBox()
			img.SetParent(self)
			img.AddFlag("not_pick")
			img.LoadImage(fileName)
			img.SetPosition(x, y)
			img.Show()
			return img

		def __del__(self):
			self.tipList = []
			self.textBar.ClearBar()
			self.Hide()
			ui.Bar.__del__(self)

		def __CreateTextBar(self):

			x, y = self.GetGlobalPosition()

			self.textBar = BigTextBar(self.LINE_WIDTH, self.BIG_TEXTBAR_MAX_HIGHT, self.FONT_HEIGHT)
			self.textBar.SetParent(self)
			self.textBar.SetPosition(6, 8)
			self.textBar.SetTextColor(242, 231, 193)
			self.textBar.SetClipRect(0, y+8, wndMgr.GetScreenWidth(), y+8+self.STEP_HEIGHT)
			self.textBar.Show()

		def __CleanOldTip(self):
			self.tipList = []
			self.textBar.ClearBar()
			self.Hide()

		def __RefreshBoard(self):

			self.textBar.ClearBar()
			preaddtipListcount = self.addtipListcount
			self.addtipListcount = 0

			index = 0
			for text in self.tipList:
				(text_width, text_height) = self.textBar.GetTextExtent(text)
				if index == 0:
					self.textBar.TextOut((500-text_width)/2, index*self.LINE_HEIGHT, " ")
					index += 1
					self.addtipListcount += 1

				if index == (len(self.tipList) - (len(self.tipList) - self.pretexsize))+1 and not self.pretexsize == 0:

					self.textBar.TextOut((500-text_width)/2, index*self.LINE_HEIGHT, " ")
					index += 1
					self.textBar.TextOut((500-text_width)/2, index*self.LINE_HEIGHT, " ")
					index += 1
					self.addtipListcount += 2

				self.textBar.TextOut((500-text_width)/2, index*self.LINE_HEIGHT, text)
				index += 1

			if self.tipList:
				index += 1
				self.addtipListcount += 1
				self.textBar.TextOut((500-text_width)/2, index*self.LINE_HEIGHT, " ")

		def SetTip(self, text):

			if not app.IsVisibleNotice():
				return	

			if text == "#start" or text == "#end" or text == "#send":
				pass
			else:
				self.__AppendText(text)

			if text == "#start" or text == "#send":

				if text == "#send" and self.pretexsize == 0:
					text = "#end"

				self.__RefreshBoard()

				if text == "#start":
					self.STEP_HEIGHT = (self.LINE_HEIGHT * (len(self.tipList) + self.addtipListcount))
					self.pretexsize = len(self.tipList)

					x, y = self.GetGlobalPosition()
					self.textBar.SetClipRect(0, y+8, wndMgr.GetScreenWidth(), y+8+self.STEP_HEIGHT)
					self.SetSize(512, 10 + (self.LINE_HEIGHT * (len(self.tipList) + self.addtipListcount))+10)
					self.imgList[1].SetPosition(self.FRAME_BASE_X, self.STEP_HEIGHT + 10)

					self.scrollstop = 0
					self.changeline = 1

				if text == "#send":
					self.scrollstop = 1
					self.nexttextsize = len(self.tipList) - self.pretexsize

				if not self.IsShow():
					self.curPos = -self.STEP_HEIGHT
					self.dstPos = -self.STEP_HEIGHT
					self.textBar.SetPosition(3, 8 - self.curPos)
					self.Show()

			if text == "#end":
				self.curPos = -self.STEP_HEIGHT
				self.dstPos = -self.STEP_HEIGHT
				self.textBar.SetPosition(3, 8 - self.curPos)
				self.textcount = 0
				self.changeline = 0
				self.pretexsize = 0
				self.nexttextsize = 0
				self.addtipListcount = 0
				self.__CleanOldTip()



I made:

	def Test(self):
		self.BINARY_SetBigControlMessage("message1")
		self.BINARY_SetBigControlMessage("message1")
		self.BINARY_SetBigControlMessage("#send")

However, the code does not pause, it goes straight as soon as it shows the message, does anyone have any idea how this code works correctly?

Originally, it shows the message, stops at the message and then continues.

Thanks.

 

Quote

@EDITED:
Works, I just removed the line:
self.BINARY_SetBigControlMessage("#send")

 

Edited by Seryov
fixed
Link to comment
Share on other sites

  • Honorable Member

As far as I know this class controlled by the OX event timers. The base of it is on the server and the processor is inside the binary.

b56d8b529d.png

 

7592e5e1ef.png

 

ps.: of course it can be handled from python too.

 

Edit: Here is a small example via quest how it works:

quest devtest begin
	state start begin
		when login begin
			big_control_notice("Question.[ENTER]What should I ask from you,[ENTER]if you just want to win?[ENTER]O: Nothing, X:gimmemoney[ENTER]You have 10 seconds to answer.")
			--[[
			--Without multiline token([ENTER]) handling:
			big_control_notice("Question.")
			big_control_notice("What should I ask from you,")
			big_control_notice("if you just want to win?")
			big_control_notice("O: Nothing, X:gimmemoney")
			big_control_notice("You have 10 seconds to answer.")
			--]]
			big_control_notice("#start")
			timer("hihihaha", 10)
		end
		when hihihaha.timer begin
			big_control_notice("The right answer is:[ENTER]None of these.[ENTER]Thanks for being a part, Bye!")
			big_control_notice("#send")
			timer("makethestoryend", 5)
		end
		when makethestoryend.timer begin
			big_control_notice("#end")
		end
	end
end

 

99d129ca45.gif

 

Last word: After the second message the animation is a bit weirder than the first two. So for sure they made this for the ox, and didn't test it well enough.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1
Link to comment
Share on other sites

17 hours ago, xP3NG3Rx said:

As far as I know this class controlled by the OX event timers. The base of it is on the server and the processor is inside the binary.

b56d8b529d.png

 

7592e5e1ef.png

 

ps.: of course it can be handled from python too.


Thank you so much xP3NG3Rx!!!

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.