Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 16,232 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[Solved] bug discover in key_lastpressed #385020
10/11/11 17:15
10/11/11 17:15
Joined: May 2008
Posts: 257
D
djfeeler Offline OP
Member
djfeeler  Offline OP
Member
D

Joined: May 2008
Posts: 257
Hello,

I have discover a bug avec key_laspressed with the code :

Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>

///////////////////////////////

TEXT* Txt_tape =
{
	pos_x = 10;
	pos_y = 10;
	layer =1;
	font = "Arial#14";
	flags=SHOW;
}

TEXT* Txt_scancode =
{
	pos_x = 10;
	pos_y = 25;
	layer =1;
	font = "Arial#14";
	flags=SHOW;
}

function main()
{
	STRING* my_str="Tapez une lettre : ";
	STRING* temp_str="";
	STRING* Scancode="";
	STRING* code="";
	
	(Txt_tape.pstring)[0] = my_str;
	while (key_any == 0) { wait(1); } // wait until a key is hit
	str_for_key(temp_str,key_lastpressed);
	str_cat(my_str,temp_str);
	str_cpy(Scancode,"Son scancode est : ");
	str_for_num(code,key_lastpressed);
	str_cat(Scancode,code);
	(Txt_scancode.pstring)[0] = Scancode;
}



When I press on f2 and f3 the scancode is the same 60. And when I press f2 a sound rings.

Djfeeler

Last edited by djfeeler; 10/12/11 08:23.
Re: bug discover in key_lastpressed [Re: djfeeler] #385022
10/11/11 18:12
10/11/11 18:12
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
When you include default.c it assigns functions to those keys, F2 save the game and and F3 loads the game.

If you press F2 it sets the variable key_lastpressed to 60 and saves this, so when you press F3 it loads its value from the file, thus again showing 60. The ring is beep() being called in the code.

If you want to remove this, either comment out #include <default.c> or in your main function set on_f2 = NULL after waiting 1 frame

Re: bug discover in key_lastpressed [Re: MrGuest] #385024
10/11/11 18:21
10/11/11 18:21
Joined: May 2008
Posts: 257
D
djfeeler Offline OP
Member
djfeeler  Offline OP
Member
D

Joined: May 2008
Posts: 257
I understood why it did not work. The bug is resolved.


Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1