Gamestudio Links
Zorro Links
Newest Posts
How to Choose a Free Cataract Surgery Centre in Delhi?
by lokkalyansamiti. 09/15/26 08:27
Blind Zorro Window
by Martin_HH. 09/13/26 13:20
Parent/child object
by 3run. 09/11/26 06:21
ZorroGPT
by TipmyPip. 09/09/26 14:35
[MED] Import from FBX (2010) missing!!!
by USER0328. 09/03/26 18:03
Purchase A8 full licence version
by ukgamer. 08/30/26 14:27
Retrieve optimize() variables order (edited)
by NorbertSz. 08/25/26 13:24
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (shuhari, TipmyPip), 2,415 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
lokkalyansamiti, rahulbuilds, speedx, liop, Bauer097
19235 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
problem with random and integers #150009
08/24/07 11:03
08/24/07 11:03
Joined: Aug 2004
Posts: 19
New Hampshire, USA
GregM Offline OP
Newbie
GregM  Offline OP
Newbie

Joined: Aug 2004
Posts: 19
New Hampshire, USA
I am getting a syntax error in lite-c when I use this command:


i = int(random(3));

"i" is a var. I lookeded in the manual and this appears to be a valid command but "int" doesn't seem to be recognized.

I am including the proper libraries (I think)
#include <acknex.h>
#include <default.c>

Has anyone else had this problem or can you tell me what I am missing?

Thanks.

Re: problem with random and integers [Re: GregM] #150010
08/24/07 11:08
08/24/07 11:08
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Look into afuncs.h:
Quote:

EXT var F(integer)(var);




Try this:
Code:
i = integer(random(3));



Re: problem with random and integers [Re: HeelX] #150011
08/25/07 12:35
08/25/07 12:35
Joined: Aug 2004
Posts: 19
New Hampshire, USA
GregM Offline OP
Newbie
GregM  Offline OP
Newbie

Joined: Aug 2004
Posts: 19
New Hampshire, USA
Thank you. This works. The manual has an example that uses "int" to force the random function to be an integer.

Re: problem with random and integers [Re: GregM] #150012
08/25/07 13:47
08/25/07 13:47
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
The given example is C-Script, not Lite-C. int is a data type in Lite-C, not a function. To avoid confusion with the datatype C-Script int() was renamed to integer() in Lite-C.


Always learn from history, to be sure you make the same mistakes again...

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

Gamestudio download | 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