Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 868 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
lorikob361, LucasJoshua, Baklazhan, Hanky27, firatv
19054 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 | chip programmers | 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