on_key_press in repeatedly_execute?

Started by Fekix, Sun 23/05/2004 12:57:04

Previous topic - Next topic

Fekix

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?
Currently working on: My Little Real Life Adventure

Pumaman

in what way didn't it work? IsKeyPressed in repeatedly_execute_always should work fine.

Fekix

it just don't work.

Here's my code in repeatedly_execute_always:

Code: ags
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:

Code: ags
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
Currently working on: My Little Real Life Adventure

Scorpiorus

Seems like the IsKeyPressed function doesn't react on +/- at all.

Fekix

oh that's the problem. if i use other keys like "q" and "a" it works fine. When will this get fixed?
Currently working on: My Little Real Life Adventure

Pumaman


SMF spam blocked by CleanTalk