Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Fekix on Sun 23/05/2004 12:57:04

Title: on_key_press in repeatedly_execute?
Post by: Fekix on Sun 23/05/2004 12:57:04
In my game, the player can set the Textspeed with "+" and "-" keys like in Lucas Arts Games. My Problem is that the player can't set the textspeed while a message is displayed with DisplaySpeech. I tried a solution with IsKeyPressed in repeatedly_execute_always but it didn't work :(

Does anyone know a solution for my problem?
Title: Re: on_key_press in repeatedly_execute?
Post by: Pumaman on Sun 23/05/2004 17:25:51
in what way didn't it work? IsKeyPressed in repeatedly_execute_always should work fine.
Title: Re: on_key_press in repeatedly_execute?
Post by: Fekix on Thu 27/05/2004 11:45:13
it just don't work.

Here's my code in repeatedly_execute_always:

function repeatedly_execute_always() {
  if (IsKeyPressed(47)==1) set_textspeed(0);
  else if (IsKeyPressed(93)==1) set_textspeed(1);
  if (IsGUIOn(9)==1) {
    if (timer==40) {GUIOff(9); timer=0; SetLabelText(4, 0, "Walk to");}
    else timer++;
    }
 
}


Here's my set_textspeed function:

function set_textspeed(int id) {
  if (id == 0) {
    SetSliderValue(9, 0, GetSliderValue(9, 0)-1);
    }
  else if (id == 1) {
    SetSliderValue(9, 0, GetSliderValue(9, 0)+1);
    }
  timer = 0;
  if (IsGUIOn(9)==0) GUIOn(9);
  game.text_speed = GetSliderValue(9,0)*6;
  StrFormat(buffer, "Textspeed - %d", GetSliderValue(9, 0));
  SetLabelText(4, 0, buffer);
  }


Until now i handled the "+" and "-" key in the on_key_press function.
Since I handled it in the repeatedly_execute_always function nothing happens if i press the keys
Title: Re: on_key_press in repeatedly_execute?
Post by: Scorpiorus on Fri 28/05/2004 11:10:55
Seems like the IsKeyPressed function doesn't react on +/- at all.
Title: Re: on_key_press in repeatedly_execute?
Post by: Fekix on Fri 28/05/2004 12:43:30
oh that's the problem. if i use other keys like "q" and "a" it works fine. When will this get fixed?
Title: Re: on_key_press in repeatedly_execute?
Post by: Pumaman on Sun 30/05/2004 18:47:47
I'll add it to my list.