Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,633 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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