1. Hey! Guest! The 33rd GMC Jam will take place between May 23rd, 12:00 UTC (Friday noon) and May 27th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

Mac OSX The craziest bug ever or am I missing something!?

Discussion in 'Programming' started by knightshaft, Mar 13, 2019.

  1. knightshaft

    knightshaft Member

    Joined:
    May 3, 2018
    Posts:
    24
    I'm still mostly working in DND but I have an 'execute code' box with this:

    if point_in_rectangle(mouse_x, mouse_y, 950, 530, 980, 550 )
    {
    url_open("http://www.mysite.com");
    }

    It's the only thing in a 'left pressed' event, It works fine....but the code never works anywhere else.... EVER! If I want another click event I have to duplicate the object. If I want to do it in another project I have to import the object. This has lead to a bizarre discovery....

    When I import the object, it also import a completely unrelated sprite, if I delete the sprite, ALL the click events stop working!!!!
     
  2. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,514
    When you say doesn't work anywhere else do you mean in any other projects or do you mean in any other events? Or in other objects?

    Also, the left press event only works if the object has a sprite. You need to use global left press.
     
  3. knightshaft

    knightshaft Member

    Joined:
    May 3, 2018
    Posts:
    24
    other events AND other projects.

    That would explain why it doesn't work anywhere else but not why or how it's selected an unrelated sprite to make itself work.

    I think you have given me enough info to move forward. Cheers.
     
  4. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,514
    Might need to clear your project's cache too. The sprite pointers could be confused.
     
  5. Taddio

    Taddio Member

    Joined:
    Nov 16, 2018
    Posts:
    463
    Well, if you change sprites, the collision box will most likely change too, which could break your mouse_pressed code.
    Make sure you have a collision mask, I'm guessing that's just that.
    Also, if you copy and paste it in a new project, the room coordinates might not be where they were last project, if you messed with the size and all.
     
  6. knightshaft

    knightshaft Member

    Joined:
    May 3, 2018
    Posts:
    24
    After further inspection, this would seem to be an issue with sprites and the draw event. I'm working in DND, I was using the draw event to draw a rectangle to experiment with positioning, then using the coordinates in 'point_in_rectangle'. Then I deleted the draw event or disable the DND blocks. This would seem to be the root of the problem, disabling has no effect but deleting stops the click event working. If I assign a sprite to the object and it's big enough to reach the 'point_in_rectangle' coordinates it works again.

    However, after saying all this, I still have objects with click events and NO sprite or draw activity that work fine, and none of this explains why importing (into a new project) the original object that I used to test this, which had no sprite or draw event and worked, also imports an unrelated sprite.

    Anyhow, I can now deal with it and move on (to the next quirk of DND).
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice