GMS 2 Why do the steam commands don't work on me?

Dwighty4000

Member
No matter what Steam command I execute in the code. the function block is always ignored later when I run the game on steam!
My Steam achievements are online on steam see screenshots:
0of4 archivments.jpg steamworks archivments.PNG
Code:
       if (!steam_get_achievement("find_the_exit"))
       {
           steam_set_achievement("find_the_exit");
       }
And here is the function block that should pause the game in the upper area, when the steamoverlay is on.
And the lower part should run the game again when the steam overlay is closed again.
But why isn't a single steam command executed in my game when I use the game on steam?
Have I left out anything important that goes with the use of steam commands?
Because the functions within these function blocks I tested them all with "key down" events and they worked perfectly. but if the steam command decides when and when not to execute the code, nothing will happen!
Neither "!steam_get_achievement" or "steam_is_overlay_activated()" ...
P.S. in the create-event: "steamoverlayactive" is set to "false"...

Code:
#region Steamoverlay-Aktivieren
if (steam_is_overlay_activated())
{
   /// @description pause machen test
   {
       obj_pausenblack.visible = true;
  
       if (instance_exists(obj_Player_Kneipe))
       instance_deactivate_all(obj_Player_Kneipe && obj_room_block_up && obj_room_block_down && obj_room_block_left && obj_room_block_right);
  
       if (instance_exists(obj_Player_kneipenstrasse))
       instance_deactivate_all(obj_Player_kneipenstrasse && obj_room_block_up && obj_room_block_down && obj_room_block_left && obj_room_block_right);
  
       if (instance_exists(obj_player_aufwachraum))
       instance_deactivate_all(obj_player_aufwachraum && obj_room_block_up && obj_room_block_down && obj_room_block_left && obj_room_block_right);
  
       if (instance_exists(obj_player_escaperun_v2))
       instance_deactivate_all(obj_player_escaperun_v2 && obj_room_block_up && obj_room_block_down && obj_room_block_left && obj_room_block_right);
  
       if (instance_exists(obj_player_exitgate))
       instance_deactivate_all(obj_player_exitgate && obj_room_block_up && obj_room_block_down && obj_room_block_left && obj_room_block_right);
  
       if (instance_exists(obj_player_outside))
       instance_deactivate_all(obj_player_outside && obj_room_block_up && obj_room_block_down && obj_room_block_left && obj_room_block_right);
  
       audio_pause_all();
   }
   steamoverlayaktiv = true;
}
#endregion
#region Steamoverlay-Deaktivieren
if (!steam_is_overlay_activated() && steamoverlayaktiv == true)
{
   steamoverlayaktiv = false;
   /// @description pause stoppen test
   {
       instance_activate_all();
       audio_resume_all();
       #region yandere-verfolgung_TRUE
       if (global.yandereaktiv == true)
       {
           //Die Yandere wurde im "resume all" aktiviert und hier muss man nur sicher gehen das,
           //wenn die andere doch off war, die sakka nicht weiter spielt!
           audio_pause_sound(snd_Playlist1);
           audio_pause_sound(snd_Playlist2);
           audio_pause_sound(snd_Playlist3);
           audio_pause_sound(snd_Playlist4);
       }
       #endregion
       #region yandere-verfolgung_FALSE
       if (global.yandereaktiv == false && global.currenplaylist == 1)
       {
           //Die Richtige sound muss nicht resumt werden, weil alles resumt wird bei dem "all" und hier nur die wo nicht spielen sollen
           //rausgepickt und pausiert werden!
           audio_pause_sound(snd_Playlist2);
           audio_pause_sound(snd_Playlist3);
           audio_pause_sound(snd_Playlist4);
           audio_pause_sound(sakka);
       }
       if (global.yandereaktiv == false && global.currenplaylist == 2)
       {
           audio_pause_sound(snd_Playlist1);
           audio_pause_sound(snd_Playlist3);
           audio_pause_sound(snd_Playlist4);
           audio_pause_sound(sakka);
       }
       if (global.yandereaktiv == false && global.currenplaylist == 3)
       {
           audio_pause_sound(snd_Playlist1);
           audio_pause_sound(snd_Playlist2);
           audio_pause_sound(snd_Playlist4);
           audio_pause_sound(sakka);
       }
       if (global.yandereaktiv == false && global.currenplaylist == 4)
       {
           audio_pause_sound(snd_Playlist1);
           audio_pause_sound(snd_Playlist2);
           audio_pause_sound(snd_Playlist3);
           audio_pause_sound(sakka);
       }
       #endregion
  
       obj_pausenblack.visible = false;
   }
}
#endregion
 

Attachments

Dwighty4000

Member
when i have issue with Steam, i've found the solution here (last post):

https://forum.yoyogames.com/index.php?threads/steam-achievements-api.1022/#post-235751
I have no idea what a Steam App ID is, I know only a Steamworks_sdk folder where you must link with GMS2.
And the rest of it doesn't work even though I've adjusted it to match the one who used the yellow font:
Code:
if steam_initialised()
{
   if steam_stats_ready() && steam_is_overlay_enabled() && global.steam_api == false
   {
       global.steam_api = true;
      
       // SIGNAL SOUND -
       audio_play_sound(snd_safetymode_beep, 120, false);
   }
}
If I start the game on steam, the sound will never played and no archivment will still executed:
Code:
       if(global.steam_api == true)
       {
           if !steam_get_achievement("find_the_exit") steam_set_achievement("find_the_exit")
       }
And this is in the create event of object in the mainmenu who is executed at the first time if the game starts:
Code:
global.steam_api = false;
 

Flaick

Member
Steam App ID is required for linking your game to Steam functions. You have to put it into game options, but i think you have already done it if your game is on Steam store.

So try to follow the last suggestion: "put it on a loop that will keep checking until it comes back as true. Now the achievements unlock when needed.".

Make a function that runs this code and call it Steam_enable():
Code:
if steam_initialised()
{
   if steam_stats_ready() && steam_is_overlay_enabled() && global.steam_api == false
   {
       global.steam_api = true;
     
   }
}
Then when you wanna set you achievement do this:
Code:
Steam_enable();
if(global.steam_api == true) {
          if !steam_get_achievement("find_the_exit") steam_set_achievement("find_the_exit")
}
 

Dwighty4000

Member
Steam App ID is required for linking your game to Steam functions. You have to put it into game options, but i think you have already done it if your game is on Steam store.

So try to follow the last suggestion: "put it on a loop that will keep checking until it comes back as true. Now the achievements unlock when needed.".

Make a function that runs this code and call it Steam_enable():
Code:
if steam_initialised()
{
   if steam_stats_ready() && steam_is_overlay_enabled() && global.steam_api == false
   {
       global.steam_api = true;
   
   }
}
Then when you wanna set you achievement do this:
Code:
Steam_enable();
if(global.steam_api == true) {
          if !steam_get_achievement("find_the_exit") steam_set_achievement("find_the_exit")
}
Your: "Steam_enable();" is marked in a blue color in my code...
is "Steam_enable();" a script that I don't have or what is this?
 
Last edited:

Flaick

Member
Yes, i've wrote above. You have to right a custom function called Steam_enable() and put this code inside:

Code:
if steam_initialised()
{
   if steam_stats_ready() && steam_is_overlay_enabled() && global.steam_api == false
   {
       global.steam_api = true;
   
   }
}
 

Dwighty4000

Member
Yes, i've wrote above. You have to right a custom function called Steam_enable() and put this code inside:

Code:
if steam_initialised()
{
   if steam_stats_ready() && steam_is_overlay_enabled() && global.steam_api == false
   {
       global.steam_api = true;
  
   }
}
OK I have implemented it now and will upload the build to steam to check the functionality on steam.
I don't know currently it should work or not so please be on call in the next days here...
But at the moment the servers were down?
You are now leaving again, but is it safe to initialize it in this state of steam?
Because the ic halles didn't get it right and then the newcomers just don't go because of the current problem of the steamserver ...?
 

Dwighty4000

Member
Yes, i've wrote above. You have to right a custom function called Steam_enable() and put this code inside:

Code:
if steam_initialised()
{
   if steam_stats_ready() && steam_is_overlay_enabled() && global.steam_api == false
   {
       global.steam_api = true;
  
   }
}
So I've applied it now and it still doesn't work.
 

Flaick

Member
Are you sure the achievement hasn't already been awarded for that account? In which case nothing will happen.

Just to be sure, also check the Steam App ID you've putted into Option->Main. It must be the same ID into Steam dashboard of your game.


Those are the scripts i used for Steam achievements:

Steam_enable();
Code:
global.steam_api = false;
if steam_initialised() {
    var stat = steam_stats_ready() ;
    var over = steam_is_overlay_enabled();
   if stat && over {
      global.steam_api = true;
    
   }
}
...And scr_steam_set_achievement();
Code:
Steam_enable();

var ach = argument0;
if global.steam_api && !steam_get_achievement(ach) {
    steam_set_achievement(ach);
  
}
I use them NOT into Step/Draw events but only one call when i need to set achievements.
 
Last edited:

Dwighty4000

Member
Are you sure the achievement hasn't already been awarded for that account? In which case nothing will happen.

Just to be sure, also check the Steam App ID you've putted into Option->Main. It must be the same ID into Steam dashboard of your game.


Those are the scripts i used for Steam achievements:

Steam_enable();
Code:
global.steam_api = false;
if steam_initialised() {
    var stat = steam_stats_ready() ;
    var over = steam_is_overlay_enabled();
   if stat && over {
      global.steam_api = true;
 
   }
}
...And scr_steam_set_achievement();
Code:
Steam_enable();

var ach = argument0;
if global.steam_api && !steam_get_achievement(ach) {
    steam_set_achievement(ach);
 
}
I use them NOT into Step/Draw events but only one call when i need to set achievements.
I have now entered the ID that you see on steam in the url when you have called up a game on steam:
https://store.steampowered.com/app/1172950/Yandere_Escape/
in this case: "1172950", right?
And I have also entered my Steam Developer name in the area: "Author" if that doesn't hurt ...
And what is this: "enable source control"?
because "enable source control" was deactivated by me and there was a "0" additionally in the Steam ID place...
 
Last edited:

Dwighty4000

Member

Dwighty4000

Member
So now is more clear. Your game Steam settings are not correct. I follow this guide per GMS2 and Steam, check it:
https://medium.com/@wlycdgr/tutorial-how-to-build-your-gamemaker-studio-2-game-to-steam-1693926f3bf7

Maybe some of those steps you've already done. Enable source control is used for code versioning, ignore it.
but I have a short extern question :
do you know, how do I can write a Announcements in steam? so if you click on the game where is making a update and click on: "update news", you get to the update Announcement feed of the current game and can see all the update news...
But it is on me completely empty and I can't Announcement users with, what is all new in my updates...
How can I write my own changelogs to Announcement my community of the news?
 
Top