witches
Member
hello all, first time posting.
I'm running into issues when relaying ini values to the draw event of my menu object. And the strangest part is that it is only 4, 5, 6, and 9.
I have a menu system set where I directly write into the ini file and have that value set for the audio_group_set_gain and audio_master_gain functions.
The results are interesting... Heres some code:
step event:
scrAudioGain:
and Draw GUI:
heres some gifs of what it looks like:
this post wont let me upload the game gif so i linked an imgur album with both
imgur album: https://imgur.com/a/BBFsrf0
Any ideas on what could be going on? Any sort of help would be greatly appreciated.
I'm running into issues when relaying ini values to the draw event of my menu object. And the strangest part is that it is only 4, 5, 6, and 9.
I have a menu system set where I directly write into the ini file and have that value set for the audio_group_set_gain and audio_master_gain functions.
The results are interesting... Heres some code:
step event:
Code:
//-----Set Options
selections = [ "Back",
"Master",
"Music",
"Sound Effects"];
ini_open("options.ini");
var sfx_vol = ini_read_real("audio","sound",1.0);
var music_vol = ini_read_real("audio","music",1.0);
var master_vol = ini_read_real("audio","master",1.0);
ini_close();
//-----Set Option Values
panel_options = [ "",
string(master_vol*10),
string(music_vol*10),
string(sfx_vol*10)];
~~~
var select;
if key_left
{
switch(current_select)
{
case 1: select = "master";
break;
case 2: select = "music";
break;
case 3: select = "sound";
break;
}
scrAudioGain(select,-0.1);
menu_xspeed = -scroll;
}
if key_right
{
switch(current_select)
{
case 1: select = "master";
break;
case 2: select = "music";
break;
case 3: select = "sound";
break;
}
scrAudioGain(select,0.1);
menu_xspeed = scroll;
}
~~~
Code:
ini_open("options.ini");
var add = argument1;
//---Get ini Values
var sfx_vol = ini_read_real("audio","sound",1.0);
var music_vol = ini_read_real("audio","music",1.0);
var master_vol = ini_read_real("audio","master",1.0);
switch(argument0)
{
case "master": if (master_vol +add > 1) or (master_vol +add < 0) break;
audio_master_gain(master_vol+add);
ini_write_real("audio", argument0, master_vol+add);
break;
case "sound": if (sfx_vol +add > 1) or (sfx_vol +add < 0) break;
audio_group_set_gain(audio_sfx, sfx_vol+add, 0);
ini_write_real("audio", argument0, sfx_vol+add);
break;
case "music": if (music_vol +add > 1) or (music_vol +add < 0) break;
audio_group_set_gain(audio_music, music_vol+add, 0);
ini_write_real("audio", argument0, music_vol+add);
break;
}
ini_close();
Code:
for(var i=0; i < array_length_1d(selections); i++)
{
if (i == current_select) var co = 1;
else co = 0.4;
var w = c_white;
var t_pos_x = center_x + menu_xspeed,
t_pos_y = (y_start + menu_yspeed) + i*string_height(global.stringheight)+32,
t_buff = 32;
//--left
draw_set_halign(fa_right);
draw_text_color(t_pos_x -t_buff, t_pos_y, selections[i], w,w,w,w,co);
//--right
draw_set_halign(fa_left);
draw_text_color(t_pos_x +t_buff, t_pos_y, panel_options[i], w,w,w,w,co);
~~~
}
this post wont let me upload the game gif so i linked an imgur album with both
imgur album: https://imgur.com/a/BBFsrf0
Any ideas on what could be going on? Any sort of help would be greatly appreciated.