2 registered members (Akow, 1 invisible),
1,423
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
variable up to 99 only?
#85860
08/14/06 07:18
08/14/06 07:18
|
Joined: Jun 2006
Posts: 86 Asia
xboy360
OP
Junior Member
|
OP
Junior Member
Joined: Jun 2006
Posts: 86
Asia
|
Hiyaaa all, I made a variable to store my money. var money; every time my taxi gets a passenger, it adds 8 to the money. if(taxi gets passenger) { money += 8; } I got so many until the money variable wont add 8 to itself anymore. It jsut displays 99. What is this? I read in the manual tha a variable can hold up to six digits? Thank you for your help. /////////////////////
Happy Birthday!
|
|
|
Re: variable up to 99 only?
[Re: xboy360]
#85861
08/14/06 07:23
08/14/06 07:23
|
Joined: May 2005
Posts: 819 U.S.
Why_Do_I_Die
Warned
|
Warned
Joined: May 2005
Posts: 819
U.S.
|
you can hold a ton , the problem is prolly the digits on your pannel , digits x, y, format, font, factor, var; , the format gives the maximum number of digits , check what you have on there , if its something like 2 , just change it to 6 or smoething , i have mine at 10 i think , works fine.
|
|
|
Re: variable up to 99 only?
[Re: Why_Do_I_Die]
#85862
08/14/06 08:03
08/14/06 08:03
|
Joined: Jun 2006
Posts: 86 Asia
xboy360
OP
Junior Member
|
OP
Junior Member
Joined: Jun 2006
Posts: 86
Asia
|
I know! yay. I put there 5 but nooo, it still doesnt work. still, thanks.
Happy Birthday!
|
|
|
Re: variable up to 99 only?
[Re: xboy360]
#85863
08/14/06 09:44
08/14/06 09:44
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
Senior Expert
|
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
For integers, you can safely get up to 7 significant figures (to 16,777,215 anyway). The trick is to have everything as a multiple of 1/8 then have the multiplier factor in your digits definition set to 8. That is, rather than adding 8, you'd add 1. Rather than 10, you'd add 1.25. For fractional values, it's a bit trickier but still possible. My 2D game uses this sort of thing (as a work around to the short range of the var). As to your issue, your digits element should look something like this:
digits = x, y, 7, font, 1, money;
Just set the X and Y positions, and the font.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: variable up to 99 only?
[Re: ulillillia]
#85864
08/14/06 14:11
08/14/06 14:11
|
Joined: Jun 2004
Posts: 2,234 Wisconsin USA
FoxHound
Expert
|
Expert
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
|
Please show us your script of your panel.
Also check to see if you put a limit on money, such as "clamp" or "min(max"
To test this press "tab" and then put "money += 100;" or "money -= 200;"
--------------------- There is no signature here.
QUIT LOOKING FOR ONE!
|
|
|
Re: variable up to 99 only?
[Re: FoxHound]
#85865
08/15/06 03:44
08/15/06 03:44
|
Joined: Jun 2006
Posts: 86 Asia
xboy360
OP
Junior Member
|
OP
Junior Member
Joined: Jun 2006
Posts: 86
Asia
|
YAhhaaYY! It works! My game is almost finished!! Thank you very much!! Only one problem left: Overtaking AI. 8 days to go before deadline. WAAH!
Happy Birthday!
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|