Gamestudio Links
Zorro Links
Newest Posts
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 (Ayumi), 662 guests, and 3 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
how do you display variable to a panel #354257
01/17/11 10:24
01/17/11 10:24
Joined: Aug 2008
Posts: 81
J
jpxtreme Offline OP
Junior Member
jpxtreme  Offline OP
Junior Member
J

Joined: Aug 2008
Posts: 81
i know this is a very basic question but I cannot seem to figure it out.

I have a panel in which I want to display the value of my variable viol_cntr. This variable counts how many violations the player has made through touching or going to an object.

I've tried to solve it using digits but the value won't increment to 1 it directly goes to 9. Maybe I've done it wrong please help me figure it out. Thanks!

PANEL* violations =
{
digits (210, 100, 1, *, 1, viol_cntr);
flags = VISIBLE;
}

function hit_event()
{
set(damageproperty,VISIBLE);
wait(-3);
reset(damageproperty,VISIBLE);
viol_cntr += 1;
}

action viol_damageprop()
{
my.emask |= ENABLE_IMPACT;
my.event = hit_event;
}

Re: how do you display variable to a panel [Re: jpxtreme] #354259
01/17/11 10:42
01/17/11 10:42
Joined: Apr 2005
Posts: 274
austria
Ascalon Offline
Member
Ascalon  Offline
Member

Joined: Apr 2005
Posts: 274
austria
you need to set viol_cntr as a global variable

var viol_cntr;

that should work


my webside : www.ascalon.jimdo.de
Re: how do you display variable to a panel [Re: Ascalon] #354262
01/17/11 11:42
01/17/11 11:42
Joined: Aug 2008
Posts: 81
J
jpxtreme Offline OP
Junior Member
jpxtreme  Offline OP
Junior Member
J

Joined: Aug 2008
Posts: 81
i already set it to var viol_cntr = 0;

but when i hit the object it won't add plus 1 instead it directly goes to 9. i don't know why is this happening.

Re: how do you display variable to a panel [Re: jpxtreme] #354280
01/17/11 13:18
01/17/11 13:18
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
It does not go to 9 directly, it probably goes way beyond 9. You only display a one digit number in your panel, change the definition as follows:

PANEL* violations =
{
digits (210, 100, 3, *, 1, viol_cntr);
flags = VISIBLE;
}

You will need to change the event function, too, because it is called at least once per frame when the player touches the object.

function hit_event()
{
my.event = NULL;
set(damageproperty,VISIBLE);
wait(-3);
reset(damageproperty,VISIBLE);
viol_cntr += 1;
my.event = hit_event;
}


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: how do you display variable to a panel [Re: Superku] #354284
01/17/11 13:31
01/17/11 13:31
Joined: Aug 2008
Posts: 81
J
jpxtreme Offline OP
Junior Member
jpxtreme  Offline OP
Junior Member
J

Joined: Aug 2008
Posts: 81
yehey! you solved my problem superku. thank you so much! how can i ever thank you. hope you'll be there for my future problems. thanks again!


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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