Jump to content

Is it possible to introduce some "randomness" in this way?


old_wombat

Recommended Posts

OK, this is my "wish item", is it feasible / doable, and with what effort?

 

I have a "pool" of perhaps half a dozen, eventually maybe many more, BGL files that all cover the same geographic location. Perhaps but not necessarily they all reside in a Scenery_Pool folder.

 

So of course only one is active at a time. What I would roolly roolly like to be able to do, is that perhaps daily, perhaps weekly, perhaps everytime I start up FS, the current BGL for that location is changed, at random.

 

Perhaps but not necessarily moving that BGL out of the appropriate already activated Scenery folder and into the Scenery_Pool folder, and another one is selected either at random or on a rotating basis and moved it. Is this possible? Doable? Easy? Difficult? Either within FS or XP.

Steve from Murwilllumbah.
Link to comment
Share on other sites

For both FS9 and FSX the sim ALWAYS 'LOOKS' into the default AddOn Scenery/Scenery folder. First you make a seperate folder (name it 'AddOn Scenery_OW') and put your 'Scenery' folders under that (which you must 'activate', of course). That leaves the default folder open (empty). Then you make different folders for the individual scenery (the 'pool'). When you want to change scenery you delete the bgl's in default 'Scenery' folder and COPY the bgl's, etc, of the scenery you want 'today'. Start up sim and you will have that specific scenery until you change it.

 

So you would delete what is in default 'Scenery' folder (clean it out) and then COPY the 'next' scenery bgl's, etc, you want (and nothing else).

 

But there might be a way (*.bat) to do it with code. This is the 'manual DIY' way.

Chuck B

i7 2600K @ 3.4 Ghz (Turbo-Boost to 3.877 Ghz), Asus P8H67 Pro, Super Talent 8 Gb DDR3/1333 Dual Channel, XFX Radeon R7-360B 2Gb DDR5, Corsair 650 W PSU, Dell 23 in (2048x1152), Windows7 Pro 64 bit, MS Sidewinder Precision 2 Joy, Logitech K-360 wireless KB & Mouse, Targus PAUK10U USB Keypad for Throttle (F1 to F4)/Spoiler/Tailhook/Wing Fold/Pitch Trim/Parking Brake/Snap to 2D Panel/View Change. Installed on 250 Gb (D:). FS9 and FSX Acceleration (locked at 30 FPS).
Link to comment
Share on other sites

I used to do something similar to randomize my splash screen with a batch file. In your case you could put all your .bgl candidates into a Scenery_Pool storage folder and give them all filenames like this:

 

random.bgl.0

random.bgl.1

random.bgl.2

random.bgl.3

random.bgl.4

random.bgl.5

 

 

You can generate a random number between 0 and 5 with a DOS command:

 

set /a random_bgl=%RANDOM% % 5

 

...or if you want a random number between 0 and 20:

 

set /a random_bgl=%RANDOM% % 20

 

 

You can test this with a dummy batch file that doesn't actually do anything except print out the random number on screen, copy the code below to notepad and save it as vampire.bat (not vampire.bat.txt) then double click it. Note that the % symbol between %RANDOM% and 5 needs to be doubled up when running the command from a batch file:

 

@echo off
set /a random_bgl=%RANDOM% %% 5
echo.
echo.
echo     The random number generated was: %random_bgl%
echo.
echo.
pause

 

 

So then assuming the storage folder scenario above you can put it to use like this, every time you double click the batch file it will select one of the randomly named .bgls from the storage folder and copy it into your active scenery folder as "charlie_brown.bgl":

 

@echo off
set /a random_bgl=%RANDOM% %% 5
copy "C:\Temp\Scenery_Pool\random.bgl.%random_bgl%" "C:\Microsoft Games\Flight Simulator 9\Addon Scenery\Random Scenery\Scenery\charlie_brown.bgl"

 

 

 

If you wanted to get fancy you could have the batch file also start the sim after copying the .bgl:

 

@echo off
set /a random_bgl=%RANDOM% %% 5
copy "C:\Temp\Scenery_Pool\random.bgl.%random_bgl%" "C:\Microsoft Games\Flight Simulator 9\Addon Scenery\Random Scenery\Scenery\charlie_brown.bgl"
"C:\Microsoft Games\Flight Simulator 9\FS9.EXE"

 

 

...or if you wanted to get even fancier you can load a specific flight after copying the .bgl:

 

@echo off
set /a random_bgl=%RANDOM% %% 5
copy "C:\Temp\Scenery_Pool\random.bgl.%random_bgl%" "C:\Microsoft Games\Flight Simulator 9\Addon Scenery\Random Scenery\Scenery\charlie_brown.bgl"
"C:\Microsoft Games\Flight Simulator 9\FS9.EXE" /FLT:"C:\Users\Jim\Documents\Flight Simulator Files\Previous flight.FLT"

 

You'll of course need to adjust all your paths and filenames to match what you have on your own system.

 

Jim

Link to comment
Share on other sites

Egad! It has been long and long since I did any .bat file work! I used to love those things.

 

I would wager that there is a way to write up an XML file that could be set to run in the EXE.XML file, of FSX at least, that would do pretty much the same as the batch file you showed. Delete the old .bgl file, randomize 0-5, or whatever number of bgl's there are, then copy that file into the scenery folder sa needed to be utilized by the game. Probably even make it count the number of .bgl files, then set it's own randomizer to that number, so if/when you add a new one, it adjusts it'self automatically for it.

 

I am not an XML programmer by any stretch of the imagination, but i'll look and see what I can figger out...for what it'll be worth.

Pat☺

[sIGPIC][/sIGPIC]

Had a thought...then there was the smell of something burning, and sparks, and then a big fire, and then the lights went out! I guess I better not do that again!

Sgt, USMC, 10 years proud service, Inactive reserve now :D

Link to comment
Share on other sites

I haven't a clue. YET.

But I have a LOT of "how-to" information, and I will see what I can find. It may well not be possible at all, but hey it can't hurt to try and finger out a way :D

 

XML files seem awfully versatile. ya nevah know!

 

Pat☺

[sIGPIC][/sIGPIC]

Had a thought...then there was the smell of something burning, and sparks, and then a big fire, and then the lights went out! I guess I better not do that again!

Sgt, USMC, 10 years proud service, Inactive reserve now :D

Link to comment
Share on other sites

You can make a gauge in XML, that would need to be loaded by a panel.cfg which means the sim would have to be running, so swapping a .bgl wouldn't have any effect until the sim restarted anyway. Further there is no file handling functionality whatsoever in XML gauges, there are a number of sim variables you can access and use for elaborate calculations to make gauges do all sorts of cool things but copying files is not one of them.

 

I posted 3 lines of code that does what the OP wants to do, what's wrong with that, and why the "Egad!"?

Link to comment
Share on other sites

I posted 3 lines of code that does what the OP wants to do, what's wrong with that, and why the "Egad!"?

That's cool :) I just EGADed because it's been so long since I did any batch file work, is all :) Just expressing suprise at how long it's been. I am glad it's still alive and well.

And yes, that .bat would do the job perfectly. I was just thinking maybe there could be a way to have the EXE.XML file do it for you when you fire up FS, but I don't think FS9 has that functionality, so it's a moot point anyway.

I meant no belittlement of doing what the OP wants with a batch file. I was just thinking more easier/automatic, was all. :)

Pat☺

[sIGPIC][/sIGPIC]

Had a thought...then there was the smell of something burning, and sparks, and then a big fire, and then the lights went out! I guess I better not do that again!

Sgt, USMC, 10 years proud service, Inactive reserve now :D

Link to comment
Share on other sites

I was just thinking maybe there could be a way to have the EXE.XML file do it for you when you fire up FS

 

Well the exe.xml is for loading executables (.exe) so if you had an executable programmed to select a random .bgl and copy it into the scenery folder that could work I guess but first you'd have to have the special .exe programmed to do the dirty work, and once it copied the .bgl you'd still have to restart the sim or reload the scenery anyway to see the effect. You really need something to do the job before starting the sim.

 

Since you can write a command into the batch file to also start the sim after copying the .bgl it really takes no more effort to double click the batch file and start the sim that way than it does to double click the FS9 icon on the desktop. Also the /FLT: switch lets you load straight to a flight without the menus and "fly now" button.

Link to comment
Share on other sites

Jim,

That was a cool batch file. Just what the OP needs, I do believe. You hit the hammer right on the nail (?).

 

A batch file is a 'Windows' type. Whereas any 'xml' would be a Flight Sim type. I will choose a Windows program over any FltSim program anyday. But some people will opt to 'force' it when all they really need is a 'bigger hammer'. The batch file method is that 'bigger hammer'. Case closed.

Chuck B

i7 2600K @ 3.4 Ghz (Turbo-Boost to 3.877 Ghz), Asus P8H67 Pro, Super Talent 8 Gb DDR3/1333 Dual Channel, XFX Radeon R7-360B 2Gb DDR5, Corsair 650 W PSU, Dell 23 in (2048x1152), Windows7 Pro 64 bit, MS Sidewinder Precision 2 Joy, Logitech K-360 wireless KB & Mouse, Targus PAUK10U USB Keypad for Throttle (F1 to F4)/Spoiler/Tailhook/Wing Fold/Pitch Trim/Parking Brake/Snap to 2D Panel/View Change. Installed on 250 Gb (D:). FS9 and FSX Acceleration (locked at 30 FPS).
Link to comment
Share on other sites

Jim Robinson, long time no hear, thank you for your excellent reply. I will give this a go.

 

I did this sort of stuff for 30+ years in Unix, but with Windows/DOS I simply couldn't be bothered learning. But now that I've seen what you've done I can figure out the details and do a bit more with it. Thanx again.

Steve from Murwilllumbah.
Link to comment
Share on other sites

You're welcome Steve. I need to correct an error though, to generate a random number between 0 and 5 inclusive you need to use:

 

set /a random_bgl=%RANDOM% %% 6

 

...otherwise "5" will never come up and you'll never see that particular .bgl make it's way into the scenery folder. Sorry about that.

Link to comment
Share on other sites

Back when I had to give up the actual .bat file programming, DOS 3.1 had just come out, and we had to put A-N-Y with stick-on letters across the space bars of all the work computers so the Mangement and Flight Directors (Who were all retired AF Officers, BTW) could figure out which was the ANY key.

Haven't touched a batch file since then. I just didn't have the time.

You're correct. The .bat is the way to go in this case, no question. I am glad there are still those out there doing such things.

Learn something new every day if I am not really careful! :D

Pat☺

[sIGPIC][/sIGPIC]

Had a thought...then there was the smell of something burning, and sparks, and then a big fire, and then the lights went out! I guess I better not do that again!

Sgt, USMC, 10 years proud service, Inactive reserve now :D

Link to comment
Share on other sites

Back when I had to give up the actual .bat file programming, DOS 3.1 had just come out, and we had to put A-N-Y with stick-on letters across the space bars of all the work computers so the Mangement and Flight Directors (Who were all retired AF Officers, BTW) could figure out which was the ANY key.

 

Lol, I've heard of people having trouble finding the "any key", you can give them specific instructions though with:

 

echo     Press space bar to continue...
pause >nul

 

...or advance automatically without user input:

 

>nul timeout /t 5

 

(pauses 5 seconds so user can read the screen then proceeds to the next command, not sure that one works on WinXP or earlier?)

Link to comment
Share on other sites

Jim, regarding the Any key, many years ago an Australian Air Force officer told me this great gag:

 

Q: What's the difference between a computer an a [insert any demographic you wish to disparage]?

A: You only have to punch information into a computer once.

 

"Press any key to continue. Press any other key to cancel".

Steve from Murwilllumbah.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...