Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Compile Time expression expected? -> Help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
T-Revv




PostPosted: Tue Mar 06, 2007 12:46 pm   Post subject: Compile Time expression expected? -> Help

I am using a recent version of Turing. I am trying to initialize a variable with different Rand.Int's.... here is the code. when i run it is says "compile time expression expected"

Any help would be appreciated


var creature_gold : array 1 .. creatures of int := init (Rand.Int (0, 40), Rand.Int (0, 55), Rand.Int (0, 20),
Rand.Int (0, 44), Rand.Int (0, 28), Rand.Int (0, 60), Rand.Int (0, 30), Rand.Int (0, 6), Rand.Int (0, 45),
Rand.Int (0, 17), Rand.Int (0, 15), Rand.Int (0, 30), Rand.Int (0, 315), Rand.Int (0, 150), Rand.Int (0, 110),
Rand.Int (0, 8), Rand.Int (0, 30), Rand.Int (0, 15), Rand.Int (0, 10), Rand.Int (0, 42), Rand.Int (0, 20),
Rand.Int (0, 0), Rand.Int (0, 109), Rand.Int (0, 9), Rand.Int (0, 100), Rand.Int (0, 24), Rand.Int (0, 250),
Rand.Int (0, 400), Rand.Int (0, 86), Rand.Int (0, 28), Rand.Int (0, 20), Rand.Int (0, 20), Rand.Int (0, 87),
Rand.Int (0, 15), Rand.Int (0, 0), Rand.Int (0, 110), Rand.Int (0, 0), Rand.Int (0, 65), Rand.Int (0, 10),
Rand.Int (0, 0), Rand.Int (0, 10), Rand.Int (0, 0), Rand.Int (0, 27), Rand.Int (0, 30), Rand.Int (0, 12),
Rand.Int (0, 10), Rand.Int (0, 0), Rand.Int (0, 0))
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Tue Mar 06, 2007 1:00 pm   Post subject: Re: Compile Time expression expected? -> Help

has 'creatures' been intiated yet? My guess is that you have creatures declared, but not yet intiated.
T-Revv




PostPosted: Tue Mar 06, 2007 2:37 pm   Post subject: RE:Compile Time expression expected? -> Help

Actually i figured it out, no thanks to my teacher. Anyway, it turns out that you cant := init with a Rand.Int so i changed it so that it was an upper bound. then in my loop i made it so that it went like this:

purse+= Rand.Int (0, creature_gold (Ran))

purse - the total gold
creature_gold - the array with the different bounds.

Thanks for the help, i appreciate you trying to help.

-> Trevor

Titania FTW
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: