GM:S 1.4 "Set Sprite Color Blend" inverted?

Discussion in 'Legacy GameMaker Community Tech Support' started by Karoline Dianne, Oct 16, 2019.

  1. Karoline Dianne

    Karoline Dianne Member

    Joined:
    Oct 16, 2019
    Posts:
    6
    I just re-installed my GM:S 1.4 license to try my hand again, and I immediately noticed something profoundly wrong. Absolutely every instance of the 'Set Sprite Color Blend' Drag&Drop function being used was backwards. Anything set to be blue was instead blended red. Anything set to red was instead blended blue. Anything set to cyan became yellow, and so on. I can't seem to find any cause for this, any setting or option anywhere. It's completely arbitrary as far as I can tell.

    I noticed it first when I opened an old project that uses black & white minimalistic sprites for everything and color-blends as appropriate. It worked perfectly fine in the past, but now everything's backwards. I then started a new project to test it again, just making a white circle object that cycles between color blends on an alarm timer, and it's the same issue. In all instances, the color blend chosen in the 'Set Sprite Color Blend' box is inverted.

    I'm at an absolute loss as to why this is happening and how to fix it, other than the ridiculous option of 'just choose the backwards color'. Does anyone have any idea what's going on here? Why on earth would this be happening and how can I fix it?
     
  2. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,792
    You can fix it by manually reversing the colour's endianness. I've written about it before.
    Code:
    ///CorrectColour(col)
    if (os_browser == browser_not_a_browser) {
      return (argument0 & $FF) << 16 | ((argument0 >> 8) & $FF) << 8 | (argument0 >> 16);
    } else {
      return argument0;
    }
    
    I don't think you're going to get support using drag-and-drop actions, simply because virtually no responders use it and the libraries can't be patched when stuff goes wrong. In your case, you would have to get around it using the Set Variable action with image_blend as the variable.
     
  3. Karoline Dianne

    Karoline Dianne Member

    Joined:
    Oct 16, 2019
    Posts:
    6
    I'm not entirely sure I understand what you mean here. Where do I put that code you posted? And do you mean I simply cannot use the "Set Sprite Color Blend" D&D option anymore? At all?
     
  4. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,792
    You put that code in a script called CorrectColour, then wrap that around any colour that is being mishandled by the receiving function. Example:
    Code:
    image_blend = CorrectColour(c_yellow);
    This also means you can't just use "Set Sprite Color Blend" anymore, because the way that action sets the colour blend cannot be changed. It has to be worked around some other way, such as with GML or with the Set Variable action as I described. With 1.4 well past sunset, there's nothing anyone can do at this point other than to mitigate its effects, however widespread.
     
  5. Karoline Dianne

    Karoline Dianne Member

    Joined:
    Oct 16, 2019
    Posts:
    6
    Unfortunately this doesn't work. It gives a fatal error.

    ___________________________________________
    ############################################################################################
    FATAL ERROR in
    action number 1
    of Create Event
    for object BaseBullet:

    Variable BaseBullet.C_Blue(100002, -2147483648) not set before reading it.
    at gml_Object_BaseBullet_CreateEvent_1 (line 1) - Image_Blend = CorrectColor(C_Blue)
    ############################################################################################
    --------------------------------------------------------------------------------------------
    stack frame is
    gml_Object_BaseBullet_CreateEvent_1 (line 1)
    called from - gml_Object_Player_Key_Z_1 (line 12) - action_create_object_motion( BaseBullet, 0, -10, 16, 90 + Control.BulletSpread - random(Control.BulletSpread * 2) );
     
  6. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,880
    C_Blue is not the same as c_blue.

    The colour constants are all lowercase.
     
  7. Karoline Dianne

    Karoline Dianne Member

    Joined:
    Oct 16, 2019
    Posts:
    6
    Well that's definitely not going to make me want to spoon my eye out with an icecream scoop.

    In any case that gets rid of the error but the object isn't getting tinted/blended at all. It's just white.
     
  8. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,880
    You have the same issue as before.

    Image_Blend is not the same as image_blend - all GMS functions are lower case.
    By not using the right case you are creating an instance variable called Image_Blend and assigning the result of CorrectColor to it.
     
  9. Karoline Dianne

    Karoline Dianne Member

    Joined:
    Oct 16, 2019
    Posts:
    6
    Wow. Good lord, this 'capital letters are forbidden' thing is so painful it should be considered actual torture. Like, an actual crime.

    But I've got the color applying now. One problem, though... 'c_blue' still makes it red, so we're back to square one.

    How convenient that YoyoGames has not only rendered my old legacy licenses 100% impossible to ever install again, effectively robbing me of all my old projects and progress forever, but now I can't even use the GM:S license I bought, because their last update before making it unsupported irreparably broke it.
     
  10. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,880
    Capital letters aren't forbidden, you just need to use the function names in the right case - this is the same with all languages and engines.

    For example hello, Hello and heLLo are all different variables due to the difference in case, but if you just remember that GML all functions are lower case then you'll be fine.

    I can't help you with the colour thing as I've never used DnD so don't know how that works or what code it uses behind the DnD blocks, but if it's similar to regular GML then some of the functions use BGR instead of RGB and need to have the values swapped which is what Frosty described to you.

    Did you follow his advice or are you still trying to use Set Sprite Color Blend?

    For your licences, if you login to your YYG Account and on the left menu click: Gamemaker > Products then the heading for GameMaker: Studio 1.4 all your licences should be listed there. Simply logging into the GMS 1.4 IDE with that account will allow you to export to any of the export licences you own shown on that page.

    All my 1.4 licences are listed there and work fine in 1.4.9999.
     
    Last edited: Oct 17, 2019
    Juju likes this.
  11. Karoline Dianne

    Karoline Dianne Member

    Joined:
    Oct 16, 2019
    Posts:
    6
    [​IMG]

    I'm using Set Variable instead, and c_blue is still coming out as red.

    And when I say my legacy licenses can't be installed anymore, I mean pre-studio. GM 7 and such. That's what all my old projects are in, and it's impossible to ever work on them again.

    But more importantly, if issues like this can't be fixed, there's no point in me even trying to pick up Gamemaker again. It's beyond frustrating that at every turn, YoyoGames seems to be pulling the rug from under my feet and actively preventing me from ever picking up my old projects.
     
  12. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,880
    That sounds like switching RGB<>BGR isn't needed, have you tried just setting the colour using just c_blue in lower case, without using Frosty's script?

    I'm not sure what research you have done or whether you are just reading posts by other users who have done no research and taking it as gospel, but you can import your games made in older versions (GM7/GM8) into Studio 1.4 - and then from 1.4 into GMS2 if you wanted to.

    Check this article out for details of the process: https://help.yoyogames.com/hc/en-us/articles/216753648-Porting-GM7-And-GM8-Games-To-GameMaker-Studio

    I'm not sure how recently you bought your 1.4 licence, but they aren't actually available for sale and haven't been for a long time now as 1.4 is sunsetted and will no longer get any updates or bug fixes past 1.4.9999 which is the last version released.

    If you want to get into GMS as your engine of choice I would highly recommend buying GMS2 with a Creators Licence which is $39 for a 12mth licence on either Windows or Mac (not both!) and isn't so expensive as to break the bank but gives you a full year of being able to use it and export your games to whichever platform you chose upon purchase.

    There is also a GMS2 30 day trial that you could try which has all features except exporting, so you could actually try putting your older projects through the import process above and then from 1.4 into 2.x to get them into GMS2 and see how they look.

    You will probably need to fix / change a few things along the way to get them working perfectly, but it's far from having the rug pulled from under your feet and preventing you from working on your old projects.

    In fact I'd say the complete opposite in that the lengths they have gone to to keep backward compatibility between versions going so far back has been above and beyond what would be expected and has actually hindered the progression of the engine going forward in some regards.
     
    Last edited: Oct 17, 2019
  13. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,792
    If setting image_blend to CorrectColor(c_blue) gives red instead, then that tells me image_blend on its own is NOT the one affected by red-blue reversal, it's the Set Sprite Blend Color action that's affected. Just get rid of CorrectColor for this particular usage and you'll be fine. My solution is only for places where this bug manifests.

    Also, it should be possible to ask for the 8.1 installer at the help desk if you have a license. The last time I checked, this is what YoYo recommended to schools using 8.1 but not willing to move on.
     
  14. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,822
    It seems like there is some inconsistency regarding which functionality uses which color format (BGR vs. RGB). I'm not sure why this is the case. It's possible that some internal color format was changed but D&D (or just this one action in particular) was left out for some reason. Therefore, the only helpful advice I can give here is to phase out the functionality that's broken and replace it with functionality that works as expected. As you've noticed, setting image_blend uses the correct color order (as it breaks when using the workaround) and therefore does not require any workarounds, but has the exact same effect. This does present some manual effort which unfortunately can not be fixed with a few clicks... but it's the best alternative I can offer.

    Please note that YoYo Games has no say in regards to users being unable to activate GM 7 licenses as it uses the Softwrap DRM, which went out of business. 8.1 can still be registered as long as you have your license key and the installer, which, as far as I'm aware, is still being provided to customers who contact the helpdesk with their license key.
    This of course doesn't change anything for end users... but GM Studio, at least 1.x, is capable of importing old source files under File -> Import Project. Unless your game heavily relies on deprecated functionality such as execute_string, it shouldn't be too much hassle to get it running in a new(er(-ish)) version of GM.
     
  15. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    4,139
    This breaking change was introduced in 1.4.9999, if I remember correctly... try downloading and using e.g. 1.4.1773 instead and image_blend should work properly again. (The download links are removed from the patch notes, but if you manually type out the URL they still work)
     

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