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
4 registered members (AndrewAMD, Baklazhan, Ayumi, Hanky27), 1,387 guests, and 2 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
Counting problem. #183505
02/12/08 15:33
02/12/08 15:33
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
Imagine i have a variable
var infinite increase ;

So, having a variablev that is showing a value from 0 to infinite number.. each time frame. lets call it infinite increase


and i want to make id = infinite increase
(That id will then be show on the screen- not very important)

but when the id is 50, i want it to be zero, and start counting from there according to the infinite increase .. so that id, will range from zero to 50, and each time it gets 50 , it starts from zero again.

i tryed to do somethink lke this:

var id = infinite increase ;

if(id=50){id-=50;} but this works for once only
if(id=100){id-=100;} but this works for once only
(...) i need a formula.

thanks.

Re: Counting problem. [Re: MMike] #183506
02/12/08 21:54
02/12/08 21:54
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
id = infinite_increase % 50;

...try this. not sure if it's what you meant?


xXxGuitar511
- Programmer
Re: Counting problem. [Re: xXxGuitar511] #183507
02/12/08 22:04
02/12/08 22:04
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
each time my var gets >50 .. it will start coutting (increasing if infinite var increases...) , but not from 50..51..52,,. ++ but from zero again.. 0..1..2

% is a division part right?

Re: Counting problem. [Re: MMike] #183508
02/12/08 22:08
02/12/08 22:08
Joined: Feb 2008
Posts: 21
J
jonkuhl Offline
Newbie
jonkuhl  Offline
Newbie
J

Joined: Feb 2008
Posts: 21
Code:
  
while(1) //I dunno if you'll need a condition in here
{
if(infinate_increase < 50)
{
infinate_increase += 1;
}
else
{
infinate_increase = 0;
}
wait(1);
}




The % method might also work as well.

Re: Counting problem. [Re: xXxGuitar511] #183509
02/13/08 15:00
02/13/08 15:00
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
Quote:

id = infinite_increase % 50;

...try this. not sure if it's what you meant?



Excellent... that really worked.. uff.

Well the manual is not very clear with that % operation..


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