GetRandomPercent

Post » Mon Mar 14, 2011 6:09 pm

Hi guys,

Ive had a script implemented as the result of a terminal menu item now for at least a year. It's worked fine. Up until now. I've not touched or gone anywhere near the terminal, so what could have changed to alter this or stop it from working?

Effectively...
float Rndmset Rndm to GetRandomPercentif flightpath == 0set flightpath to 1ShowMessage DEBUGrndmif Rndm < 5    ;do something etc...elseif Rndm < 10    ;do something else random etc.......endif


It basically checks to see if the called random variable is between anything fifth number (5, 10, 15, 20 etc) all the way upto 100 (being a percentage naturally).

The flightpath part is a global I've created which is part of a 3 step process. You first need to set some co-ordinates, then hit a button and finally turn a dial. I don't believe this affects it.

Now as I say, this has worked fine and I haven't modified anything within the body of script. Also, I've asked the script to show a message declaring the randomised Rndm variable once you're out of the terminal.

Sure enough, it shows the variable as having set to 0. Every time. I'm pulling my hair out now. Any ideas?
User avatar
Baylea Isaacs
 
Posts: 3436
Joined: Mon Dec 25, 2006 11:58 am

Post » Mon Mar 14, 2011 5:50 pm

Well, for the scrap of script you posted, the only thing I see is flightpath MUST equal 0 in order for the script to run.

You did not specify what block type you have this code in. I will guess its a MenuMode since you have to be in a terminal menu when its running.
User avatar
Tina Tupou
 
Posts: 3487
Joined: Fri Mar 09, 2007 4:37 pm

Post » Mon Mar 14, 2011 11:38 pm

Well, for the scrap of script you posted, the only thing I see is flightpath MUST equal 0 in order for the script to run.

You did not specify what block type you have this code in. I will guess its a MenuMode since you have to be in a terminal menu when its running.


Hey Willie, ta for replying. I think I resolved it in the end, I just created a global var instead of initialising one inside the result script of the terminal and make any obvious amendments to the script and it seems to be working.

Bit weird it wasn't in the first instance, ho hum, ta anyway :)
User avatar
ruCkii
 
Posts: 3360
Joined: Mon Mar 26, 2007 9:08 pm


Return to Fallout 3