Gamestudio Links
Zorro Links
Newest Posts
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
1 registered members (AbrahamR), 717 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
function wont add on button click #234125
11/01/08 04:22
11/01/08 04:22
Joined: Apr 2004
Posts: 77
USA
Cactus Offline OP
Junior Member
Cactus  Offline OP
Junior Member

Joined: Apr 2004
Posts: 77
USA
Ok my program works like this, when you click on the button it runs a function that adds 1 to my variable, but for some reason it wont add. My variables value wont change.
Any help would just be great thx.
Heres my code:


function button_14()

{
quiz_score_var += 1; // My Variable
str_cpy(correct_str, "Correct!!!");
snd_play (correct_snd,100,0);

wait(300);
str_cpy (correct_str, " ");
}


BMAP background_bmp = "background.bmp";



PANEL background_pan =
{
pos_x = 0;
pos_y = 0;
layer = 0;
bmap = background_bmp;
button (500, 134, "button_3.bmp", "button_3_over.bmp", "button_3_over.bmp", button_3,NULL, NULL);
button (600, 134, "button_8.bmp", "button_8_over.bmp", "button_8_over.bmp", button_3,NULL, NULL);
button (700, 134, "button_14.bmp", "button_14_over.bmp", "button_14_over.bmp", button_14,NULL, NULL); // MY Button
flags = OVERLAY | VISIBLE;
}


if you need more info just tell me and i will add it.

Last edited by Cactus; 11/01/08 04:29.

HI
Re: function wont add on button click [Re: Cactus] #234129
11/01/08 08:00
11/01/08 08:00
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
How and where did you define quiz_score_var? How did you check the variable won't be increased?


Always learn from history, to be sure you make the same mistakes again...
Re: function wont add on button click [Re: Uhrwerk] #234237
11/01/08 19:21
11/01/08 19:21
Joined: Apr 2004
Posts: 77
USA
Cactus Offline OP
Junior Member
Cactus  Offline OP
Junior Member

Joined: Apr 2004
Posts: 77
USA
I defined it at the top and like this: var quiz_score_var = 0;
I know the variable is no increased because in my function main there is this code:
if (quiz_score_var > 5)

{
level_load (western_str);

}

And the level will not load unless I set quiz_score_var's intitial value to 6.

Last edited by Cactus; 11/01/08 19:25.

HI

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