View previous topic :: View next topic |
Author |
Message |
BobTheBob How do I cheat? Reputation: 0
Joined: 03 Jan 2017 Posts: 7
|
Posted: Sun Jan 08, 2017 7:42 am Post subject: Labels are not drawn accurate |
|
|
Hi,
I use a lua script which sets the position of a label on a form based on the position of the player in the game.
The problem is that the label isnt drawn accurately in the form.
I cant link the picture directly so here is a link:
fotos-hochladen.net/uploads/label0epf42yo3v.png
The red square-label in the middle is the current position of the player.
When I walk around the position of the label is changed but there are always those small lines which stay there.
Its very hard for me to explain but I guess you see what I mean
Did I make any mistake or is there a solution? Or do I have to code the GUI in c++ for example to make this work?
Thanks for help
(Sorry if this is in the wrong sub forum. I wasnt sure whether this is more Lua or CE related)
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Sun Jan 08, 2017 8:25 am Post subject: |
|
|
are you sure it's a label and not a cancas you draw on?
anyhow, call formname.repaint() after a move
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
BobTheBob How do I cheat? Reputation: 0
Joined: 03 Jan 2017 Posts: 7
|
Posted: Sun Jan 08, 2017 10:48 am Post subject: |
|
|
Dark Byte wrote: | are you sure it's a label and not a cancas you draw on? |
Im not sure what you mean. I just move the label around on the form.
Dark Byte wrote: | anyhow, call formname.repaint() after a move |
Thanks, it works but now I have another problem.
The window freezes after a few (~10-20) seconds. Neither the label which should be moved nor any other labels can change any more.
When I delete the following 2 lines it doesnt freeze.
Quote: |
playerLabel.setLeft( math.floor( playerX) )
playerLabel.setTop( math.floor( playerY) ) |
playerLabel is the label I want to move and playerX and playerY are the address values (float) of the player coordinates.
There is no error massage. Somehow I still can call functions of the script. For example even though the window is frozen, a double click still calls a function as it should be. Im completely confused right now ^^
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Mon Jan 09, 2017 11:10 am Post subject: |
|
|
are you using threads? If so, call the gui related code inside a synchronize(function)
calling gui controls from threads without sync will cause issues
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
BobTheBob How do I cheat? Reputation: 0
Joined: 03 Jan 2017 Posts: 7
|
Posted: Thu Jan 12, 2017 9:51 am Post subject: |
|
|
Thanks again for your help !
It is working now.
edit:
I just leave this here in case somebody finds this and has the same problem...
So as I said my script changes the position of a label every few miliseconds in another thread. The strange thing was that first the label wasnt drawn accurate and i called form.repaint() to fix it which first seemed to work fine. But then I realized that the window freezed after a few seconds.
As DarkByte suggested I called synchronize(function) of the function which changes the label but it still didnt work and the window freezed.
After i deleted the "form.repaint()" somehow it works awesome.
I guess the first problem (that the label wasnt drawn accurate) was caused of a ciritcal read/write section which happens in multiple threads if you dont use synchronize.
I hope this helps somebody ... xD
|
|
Back to top |
|
|
|