Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / mousex() and mousey() problems

Author
Message
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 25th Sep 2015 21:45
Sometimes these 2 commands seems not to return the correct values, and make for example errors when moving the cursor on a menu (such as highlighting different options even if the cursor is on 1 only)

What breaks these 2 commands? I had a majore problem before and I solved it by registering 2 variables at the start of the loop instead of checking them for each text field, but that still happens when I click a specific button, the code works fine so the problem is still the bug on these 2 commands.
Green Gandalf
VIP Member
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Akhranox, Skyrim, Civ6.
Posted: 25th Sep 2015 22:48
Quote: "What breaks these 2 commands? "


Using them more than once in the same sync cycle. Always read them into a variable first then. if you need them again in the same cycle, just use the variable. I always play safe and try to do that with all user input as some things get cleared when read.

Quote: "the code works fine so the problem is still the bug on these 2 commands."


Convince me.



Powered by Free Banners
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 26th Sep 2015 01:46
The bug is a bit different than the one when you use a lot of times the mousex() and mousey() calls.

I can actually click anywhere and the position is correct, but for some reason on the quit menu both "yes" and "no" are highlighted.

The coordinates are correct because when I go there when I open the game, or when I come back from playing the game, they works, it only happens when I go back from the multiplayer page.
Green Gandalf
VIP Member
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Akhranox, Skyrim, Civ6.
Posted: 26th Sep 2015 19:35
Perhaps it's a coding error in the way you've handled the highlighting? It doesn't sound like a mousex()/mousey() issue at all.



Powered by Free Banners
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 26th Sep 2015 22:07
The coding it's fine because the main menu it's the 1st thing you see when you open the game, and it works, even if you play and go back again, the only button that bugs it it's the back button from the multiplayer menu, but I don't see anything wrong in the code, the bug is similar when I had the common mousex() bug, so must be something bugging these 2 commands. Maybe the goto command it's bugged? I use it to change type of menu from main to multiplayer, when the back button is called it goto the main menu cycle
Green Gandalf
VIP Member
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Akhranox, Skyrim, Civ6.
Posted: 27th Sep 2015 12:04
Quote: "but I don't see anything wrong in the code,"


That's often the problem.

Have you tried printing values of various things to the screen so you can check for yourself where things have gone wrong. Could be something simple like a misspelt variable name or a variable that should be global but isn't.

Quote: "so must be something bugging these 2 commands"


I doubt it. But it is possible. I'd do what I suggested above first.



Powered by Free Banners
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 27th Sep 2015 19:43
I have removed the goto thing and made the multiplayer menu part of the main menu do-loop cycle, this seems to have fixed the problem
Green Gandalf
VIP Member
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Akhranox, Skyrim, Civ6.
Posted: 29th Sep 2015 14:32 Edited at: 29th Sep 2015 14:34
Quote: "this seems to have fixed the problem"


Sounds good.


Powered by Free Banners

Login to post a reply

Server time is: 2018-12-14 18:53:13
Your offset time is: 2018-12-14 18:53:13