it's independent of the framerate, just every 100th of a second.jkgp2x posted on Mar 31 2006 at 06:35 PM said:i have somewhat of a timer in place. i set the fps to 100 and used the timer[0] function and it appears to give me 1/100 of second. how would i go about making it time in milliseconds instead of every 10 milliseconds.
jkgp2x posted on Apr 3 2006 at 06:58 PM said:ok im still having trouble with this. i made a program to make song steps in real time but when i run it back trough my game there are problems. when i clearly press a 2 buttons at different times it produces 2 objects on the screen at the same time. could someone take a look at my song maker sourcecode and tell me how to fix this.
program songmaker;
global
keys[20]=0;
buttons[500]=1;
timings[500]=0;
keyindex=0;
index=0;
push=1;
keydown=1;
keyleft=1;
keyright=1;
song;
string keyinput="bitches.ogg";
pause=1;
begin
set_mode(320,240,8);
set_fps(100,0);
titlescreen();
end
process titlescreen();
begin
song=load_song(keyinput);
load_fpg("new1.fpg");
put_screen("new1.fpg",1);
while(not(key(_alt)))
frame;
end
leveledit();
end
process leveledit()
begin
play_song(song,0);
timer[0]=0;
while(not(key(_space)))
if(not(key(_down)))keydown=1;end
if(not(key(_right)))keyright=1;end
if(not(key(_left)))keyleft=1;end
if(keyright==1)
if(key(_right))
keyright=0;
timings[index]=(timer[0]-109);
buttons[index]=3;
index++;
frame;
end
end
if(keyleft==1)
if(key(_left))
keyleft=0;
timings[index]=(timer[0]-109);
buttons[index]=1;
index++;
frame;
end
end
if(keydown==1)
if(key(_down))
keydown=0;
timings[index]=(timer[0]-109);
buttons[index]=2;
index++;
frame;
end
end
frame;
end
save("song.tim",timings);
save("song.but",buttons);
end
nope, that's just some code to detect a key just once, so he won't get 10 keypresses everytime he presses the keyGoity posted on Apr 3 2006 at 08:34 PM said:jkgp2x posted on Apr 3 2006 at 06:58 PM said:ok im still having trouble with this. i made a program to make song steps in real time but when i run it back trough my game there are problems. when i clearly press a 2 buttons at different times it produces 2 objects on the screen at the same time. could someone take a look at my song maker sourcecode and tell me how to fix this.
program songmaker;
global
keys[20]=0;
buttons[500]=1;
timings[500]=0;
keyindex=0;
index=0;
push=1;
keydown=1;
keyleft=1;
keyright=1;
song;
string keyinput="bitches.ogg";
pause=1;
begin
set_mode(320,240,8);
set_fps(100,0);
titlescreen();
end
process titlescreen();
begin
song=load_song(keyinput);
load_fpg("new1.fpg");
put_screen("new1.fpg",1);
while(not(key(_alt)))
frame;
end
leveledit();
end
process leveledit()
begin
play_song(song,0);
timer[0]=0;
while(not(key(_space)))
if(not(key(_down)))keydown=1;end
if(not(key(_right)))keyright=1;end
if(not(key(_left)))keyleft=1;end
if(keyright==1)
if(key(_right))
keyright=0;
timings[index]=(timer[0]-109);
buttons[index]=3;
index++;
frame;
end
end
if(keyleft==1)
if(key(_left))
keyleft=0;
timings[index]=(timer[0]-109);
buttons[index]=1;
index++;
frame;
end
end
if(keydown==1)
if(key(_down))
keydown=0;
timings[index]=(timer[0]-109);
buttons[index]=2;
index++;
frame;
end
end
frame;
end
save("song.tim",timings);
save("song.but",buttons);
end
hmm... I think I understand the problem, try using one variable for all buttons, like, If(Not Key(_Left) And Not Key(_Right)....)
key=1; End
If(Key(_Left) and key)
key=0;
....
and so on and so forth
process leveledit()
private
down_pressed=false;
left_pressed=false;
right_pressed=false;
begin
play_song(song,0);
timer[0]=0;
while(!(key(_space)))
if(!(key(_down))) down_pressed=false; end;
if(!(key(_right))) right_pressed=false; end;
if(!(key(_left))) left_pressed=false; end;
if(key(_right) and !right_pressed)
timings[index]=(timer[0]-109);
buttons[index]=3;
index++;
right_pressed=true;
//frame; *dunno why this is here :P
end;
if(key(_left) and !left_pressed)
timings[index]=(timer[0]-109);
buttons[index]=1;
index++;
left_pressed=true;
//frame; *~
end;
if(key(_down) and !down_pressed)
timings[index]=(timer[0]-109);
buttons[index]=2;
index++;
down_pressed=true;
//frame; *~
end;
frame; //this frame should be enough
end;
save("song.tim",timings);
save("song.but",buttons);
end;
Goity posted on Apr 3 2006 at 09:34 PM said:hmm... I think I understand the problem, try using one variable for all buttons, like, If(Not Key(_Left) And Not Key(_Right)....)
key=1; End
If(Key(_Left) and key)
key=0;
....
and so on and so forth
IF ( (key(_LEFT)) && (!key(_UP)) && (!key(_DOWN)) )
//code for moving left and ignoring up and down when left is pressed...
END