Position Cursor To Field Issue

Have any questions or problems in making your game, subscribing and/or using our software? Post here.
Forum rules
Make sure you are using the newest version. This can be downloaded at the top of the site via the "downloads" link.

Use a very good subject. "Problem" or "Help" are unacceptable titles.

Use the search feature before posting a question, as the answer is probably already here.

Subscript out of range error 9: This is a generic error, and we'll need way more information than that to figure out the problem. If you get this, strongly consider following the instructions of submitting your project through the Submit Bug feature within the editor.
User avatar
Mage42
Member
 
Joined: Mon Sep 11, 2017 2:10 am

Position Cursor To Field Issue

Postby Mage42 » Sat Oct 07, 2017 8:13 am

I know how position cursor works and what it does but i can't figure out how to take into concideration the screen resoultion. When i maximise my game window the cursor no longer positions over the field i set, instead it positions to the left well away from the field.

I'm using Field("Equip Button").X and Field("Equip Button").Y to position the the cursor to that field. Do i need to add some mathmatical formula into or at the end of this to always position at the fields X and Y regardless of how big the game window is? If i do what formula?

Thanks.

User avatar
noeneto123
001 Support
 
Joined: Sat Apr 16, 2011 11:39 am
Location: Brazil

Re: Position Cursor To Field Issue

Postby noeneto123 » Sun Oct 08, 2017 12:13 pm

You could use Screen.X and Screen.Y proportions to position cursor. [Screen.X / 2] means the middle X of screen as [Screen.Y / 2] means the middle Y. Whatever size it is!

User avatar
Mage42
Member
 
Joined: Mon Sep 11, 2017 2:10 am

Re: Position Cursor To Field Issue

Postby Mage42 » Fri Oct 13, 2017 5:00 pm

I'm trying to position the cursor to a fields X and Y. It works fine until you fullscreen the game or maximise the window which then causes the cursor to position miles away from the field.

I tried using the /2 but makes things worse and stops working completely. Here's the values i used for the position cursor event;

Field("Equip Button").X /2 and Field("Equip Button").Y/2 also i used the same values before but without the /2 and still nothing.


Edit: Can anyone help me with this please? It's been an ongoing topic for a little over a month now. It seems to be a very easy thing to fix for someone with experience... for me not so much...

User avatar
Mr.Numbers
001 Support
 
Joined: Wed Feb 28, 2007 1:50 am
Location: Alberta, Canada

Re: Position Cursor To Field Issue

Postby Mr.Numbers » Sun Oct 15, 2017 5:08 am

There really currently is no easy one-way-works-all method to doing this, since the way 001 handles field placement.. Is a little weird. First of all, when you resize the window and the field has no resizing option, X=0 isn't on the left of the screen, but rather, somewhere on the left depending on the default resolution. This is manageable, and the formula for figuring out the X/Y position should be something like this probably (Untested):
Field_Actual_X_Position = (Screen_Size_X / 2) + (Field_X_Position - Default_Window_X_Size)
Field_Actual_Y_Position = (Screen_Size_Y / 2) + (Field_Y_Position - Default_Window_Y_Size)

However, if you enable ANY edging options it really changes things considerably. For instance, if you have LEFT edging (And only left) turned on, to get the Y position you would use the above method, but for the X you would simply need to use the 001 X position use-value. Basically, each edging option requires a different solution to complicate matters.

Technically there is a bug with the X/Y position use-values, since they don't actually give the calculated X/Y positions, OR the X/Y positions of edging-enabled stuff. Not sure how easy it would be to fix for Mike, he would need to provide more on that.
Image
I AM THE ALL MIGHTY SCRIPTING MASTER
Please do not PM me with Engine 001 related questions, rather post on the forums. ;)

User avatar
Mage42
Member
 
Joined: Mon Sep 11, 2017 2:10 am

Re: Position Cursor To Field Issue

Postby Mage42 » Mon Oct 16, 2017 4:50 pm

I'll give what you said a shot and see what i can come up with. Thank you.


Return to Technical Support Questions

Who is online

Users browsing this forum: No registered users

cron