![]()
LAST EDITED ON Oct-31-03 AT 07:28 AM (EST) by Wulf_9 (moderator)
RandomizationA tricky topic, very little is known about it by many people and therefore it's very little used. Allows simple randomization of routes without having to use BRR. I am not trying to 'compete' with BRR or anything, but I just wish to post a little info about this little known topic).The $RND command will return a random number between two given integers.For example$RND(1;8) will output a random number between 1 and 8.The $RND command can be dropped into a CSV file. For example, you may have a yard on your route. You could use the $RND command to set up a train on one of the tracks..freeobj $RND(2;9);6,If 2 to 9 are the yard tracks and freeobject 6 is the train. A random number between 2 and 9 will be generated by BVE and used where the $RND command is, therefore it selects which track to place the train on.You can also go a lot further, such as the following. Freeobjects 171 to 180 are single people and this will place them on a platform :-.freeobj 2;$RND(171;180);$RND(3;5);0.6;$RND(1;25),Another variant :-$RND(20;24),.freeobj 2;$RND(171;180);$RND(3;5);0.6;$RND(1;25),Will place one of the people objects at a random distance both along the route and to the left.Back on the train object example. Some trains are in different sections, each 25m long.Say we have track 0 our running track, and tracks 1, 2 and 3 which are yard tracks. Freeobject 1 is a locomotive, freeobject 2 is an MGR wagon. We can use the $RND command to pick a random track to place the train on. However if we use a different command for each object, you might get a loco on track 1, wagon on track 2, another wagon on track 3 etc. Therefore you need to generate one random number and then have the object placement statements reading from the one generated random number. To do this you use another of the $ commands, even less known than $RND, it is $SUB.Before the With Track statement, insert the following$SUB(0)=$RND(1;3)This means that the variable 0 is now a random number between 1 and 3. So when you come to your train you reference the variable as a track number100,.freeobj $SUB(0);1,
125,.freeobj $SUB(0);2,
etcAll the statements look for variable 0 when finding where to place it, look in the variable 0 section and the variable is the random number, the same random number is used for them all.Hope this is of some use!--
Tom Beevers
http://brj.rr.nu
Printer-friendly page | Edit | Reply | Reply With Quote | Top
RE: CSV Randomisation - Info / Tutorial post, Wulf_9, Oct-30-03, 01:16 PM, (1) RE: CSV Randomisation - Info / Tutorial post, tof63, Oct-30-03, 04:00 PM, (2) RE: CSV Randomisation - Info / Tutorial post, TomBeevers2000, Oct-30-03, 04:15 PM, (3) RE: CSV Randomisation - Info / Tutorial post, bassv, Oct-30-03, 05:01 PM, (4) RE: CSV Randomisation - Info / Tutorial post, Anthony_B, Oct-30-03, 07:22 PM, (5) RE: CSV Randomisation - Info / Tutorial post, bassv, Oct-31-03, 10:32 AM, (10) RE: CSV Randomisation - Info / Tutorial post, Stooopid_person, Oct-31-03, 01:43 AM, (6) RE: CSV Randomisation - Info / Tutorial post, TomBeevers2000, Oct-31-03, 03:30 AM, (7) RE: CSV Randomisation - Info / Tutorial post, Routemaster J, Oct-31-03, 03:56 AM, (8) RE: CSV Randomisation - Info / Tutorial post, Wulf_9, Oct-31-03, 07:27 AM, (9)
Conferences | Topics | Previous Topic | Next Topic