Sign in to follow this  
Guest Matholomew

random numbers in xml

Recommended Posts

Eagerly awaiting the upcoming Hitchhiker's Guide to the Galaxy movie, ive decided to try to model the Heart of Gold (the spaceship in the movie/books). I want to make a gauge to simulate the ship's infinite improbibility drive. this drive system works on creating the most imbrobable events possible, namely a ship existing simultaneously in every point of the universe. This also causes some very strange side effects (missles turning into a whale and a bowl of petunias, infinite numbers of monkeys working out a script for hamlet, ect.) I need to know if and how an xml gauge can change a planes lattitude and longitude to a user-entered value and if xml can generate random numbers. The movie should prove to be very hilarious, so go and see it.

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Have you been eating the cheese you found at the back of the cooker? :-lol

Share this post


Link to post
Share on other sites

Absolutely.Seriously, can you employ random numbers? How?"Welcome" the voice said, "to the Starship Heart of Gold"The voice continued "Please do not be alarmed" it said, "by anything you see or hear around you. You are bound to feel some initial ill eeffects as you have been rescued from certain death at an improbability level of two to the power of two hundred and seventy-six thousand to one against- possibly much higher. We are now cruising at a level of two to the power of twenty-five thousand to one against and falling, and we will be restoring normality just as soon as we are sure what is normal anyway. Thank you. Two to the power of twenty thousand to one against and falling."The voice cut out.Ford and Arthur were in a small luminous pink cubicle... Arthur looked up."Ford!" he said, "there's an infinite number of monkeys outside who want to talk to us about this script for Hamlet they've worked out."-The Hitchhikers Guide to the Galaxy chapter 9

Share this post


Link to post
Share on other sites

Don't think that XML can generate random numbers, but C can generate pseudo-random ones, as mgh alludes to in his post. The attached makes use of the rand() function in C and passes a number of values to a series of L:Variables.You might look at slew mode if you want to move a user aircraft very quickly. Do keep in mind that with FS, you are limited to this particular Galactic overpass - you might look at Orbiter if you actually want to get to the restaurent in time for dessert.Doug

Share this post


Link to post
Share on other sites

In another forum, i managed to find a way to generate amlmost random numbers by means of multiplying unrelated variables together. the example i was given by Paco Sanchez was zulu seconds/60 * latitude seconds/60 * egt/max egt * airspeed/max airspeed * = number between 0 and 1as for movement, ive decided that slewing will probably be my best bet. perhaps i could even have the user enter desired lat and longitude and be able to derive a heading and distance from that. for bizzare improbable events, i might cut out a few non-apparent systems, maybe write an effect for a falling whale...come to think of it, efeects are probably the way to go. (Niagra falls materializes in front of you, ect... the possibilities are astounding)Thanks, its nice to know im not the only Douglas Adams fan here.

Share this post


Link to post
Share on other sites

The movie is everything i hoped it would be and then some. me and my friends went there with our towels. we got some strange looks going in, and people were jeallous when we came out. I really liked how they did the heart of gold and its infinite improbability drive.Now, to make it work in FS...Can youA) call up effects from xml gauges?:( display a large bitmap that obscures the plane from an effect?C) calculate a course from current lat/lon to a user entered lat/lon (the equation would be arctan((currentlat-destinationlat)/(currentlon-destinationlon )) and then slew there for the correct distance (sqrt((currlon-destlon)^2+(currlat-destlat)^2)) and stop slewing upon arrival?D)if not, can it be done w/ C?E) slow down the rotation for the propn_blurred parts?F) do all of the above within a reasonable time frame without undo stress and loss of sleep?this looks possible in theory, (minus F, of course). the way i plan for it to work is the user will enter destination lat and lon into a window in a manner simmilar to that found in most autopilots. upon pressing the big go button, it will pop up text that says "please do not push this button again". if this warning goes unheeded, the view will switch to a spot view, the gauge will trigger an effect file that pulls up a series random pics and displays them over the aircraft, effectively blocking the view of te craft and giving the illudion that the ship has transformed into a rubber duck, then a chair, followed by a ghostly iimage of Douglas Adam's head (the late author of the books, and writer of most of the movies script. the heart transforms into his head just before the end credits). the sim will enter slew, calculate course, change heading accordingly, start a wormhole-esque effect, and go as fast as slew can (around mach 9 i beleive) in that direction. upon arrival, the worm hole will cut out and slew will be dropped. the view will switch to VC. a few random effects will appear in the pilots feild of view (insert falling sperm whale here) and the gauge will cut out and all will be hoopy. Will this work? the answer is probably somewhere along the lines of 42.go watch the hitchhikers movie, reguardless of whether you have already.a good hitchhiker always knows where their towel is.

Share this post


Link to post
Share on other sites

Dear Sir,the attachment to Your post from April 27th 2005 (cit.: "The attached makes use of the rand() function in C and passes a number of values to a series of L:Variables.") is not longer available. Please, would You post it again.Thanks a LotServus from ViennaErnestus

Share this post


Link to post
Share on other sites

NOOO!!! DON'T see the movie! It abselutley sucks! They added all that Hollywood **** to it! I agree, the book is amazing, but once you try to add Hollywood to an original book, things don't work out. Also, the fact that Douglas Adams worte about 5 books and Hollywood tried to squeeze it all into one makes it even worse. I can't argue about how cool the ships looked and all the special effects look though, just a really lame storyline edit.Oh, the Heart of Gold- Great idea! Are you going to do the smaller sub-ship too? I really like that one. And how about a mechanicaly-depressed Marvin walking around? And You could even have those doors that talk open up and say something when you pan near them! If you need any help, tell me! I can G-max pretty well.EDIT- Oh, so you saw it alreay? Huh. Well, I guess noone can resist. Hey, I "dropped" my towel around here. Since I am in possesition of some soap, can you primitive earth-forms mail me another replacement towel? :(

Share this post


Link to post
Share on other sites

Dear Sir,sorry, but sometimes I seem to be more than a little bit tumb.I built Your 'random_number_gau' for test-use in a panel like this: - "gaugeXX=dsd_random_number!random_number, 0,766,1,1,2" -.As I understand, this should produce two variables: "(L:dsd_random_00,enum)" and "(L:dsd_random_01,enum)"I tried to display these variables in a XML-gauge using the syntax %((L:dsd_random_01,enum) )%!1.6f!, but nothing happens. The displayed Value ist 0.000000 all time.May I ask for advice, what I am doing wrong.Many thanks in advance.Servus from ViennaErnestus

Share this post


Link to post
Share on other sites

Did you try (L:dsd_random_00,number) and (L:dsd_random_01,number)?I did all the tests using the 'number' type, rather than the 'enum' type.Doug

Share this post


Link to post
Share on other sites

Dear Sir,once more again.It seems that the zip-file You uploaded to the forum on 31th August 2005 (above #24190) got a little bit mixed up. The enclosed readme states, that there should be two sub-gauges, 'dsd_random_number!random_number' and 'dsd_random_number!single_instance', and each should create up to 100 L:Vars ('dsd_random_XX' and 'dsd_single_random_XX', ranging from _00 to _99). But after a very lot of trial (and error :-smooch ) and even looking in the gauge with a hex-editor (sorry), I got only the 'dsd_random_number!random_number' to work (the 'dsd_random_number!single_instance' seems not to be available) and the former produces only one L:Var '(L:dsd_xml_random,number)'.This is for Your information! Of course, I would appreciate it to get the gauge with the two sub-instances, but I'm very grateful :-yellow1 for the version I already got.Servus from ViennaErnestus:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this