Author Topic: Non random behaviour in Random-Of  (Read 1864 times)

0 Members and 1 Guest are viewing this topic.

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Non random behaviour in Random-Of
No idea what's causing this but I'm using the random-of argument in a mission and the last argument in the list appears to be getting picked much less than the others.

I put together a quick mission and it only picked the number 5 once in over 4 minutes of me running it (twice).

I then edited the mission so that the randomly picked argument was invalidated and the test mission started to work. I can't do this in the real mission as I want the random-of option to possibly pick the same argument more than once.


While I'm on about the new conditionals. How hard would an add-argument action operator be? I haven't got any current use for it but I'm sure I could think of some the second I had one. Especially if I could add the value of a string variable to the list of arguments :D


Anyway as always I'm including the test mission to make it easier for whoever takes a look at this. (You might want to try the mission before you look at it in FRED though). :D
« Last Edit: July 10, 2005, 10:00:56 am by 340 »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Non random behaviour in Random-Of
BTW this isn't exactly urgent cause I simply included the last argument twice and for now things are working (although if I forget to remove it once the problem is fixed it will screw up the mission by making the last argument twice as likely to appear).

Anyway if someone else can reproduce the error I'll mantis it.
« Last Edit: July 11, 2005, 05:17:09 am by 340 »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Non random behaviour in Random-Of
*grumble grumble*

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Non random behaviour in Random-Of
Try the mission. It will make you feel better about it :D

I didn't want you getting annoyed with me cause I keep spotting bugs in the marvelous new SEXPs you keep making for me so I made it a little um. different from my average bug report missions :D

Oh and turn on voice synth if you haven't already. It's worth it :)
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Kosh

  • A year behind what's funny
  • 210
Non random behaviour in Random-Of
This is what I got when I tried that mission:





Is this what you had in mind? :p
"The reason for this is that the original Fortran got so convoluted and extensive (10's of millions of lines of code) that no-one can actually figure out how it works, there's a massive project going on to decode the original Fortran and write a more modern system, but until then, the UK communication network is actually relying heavily on 35 year old Fortran that nobody understands." - Flipside

Brain I/O error
Replace and press any key

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Non random behaviour in Random-Of
Looks like the hud replacement SEXPs are working just fine....

Wait a minute. I never coded those... :nervous: :p
-C

 

Offline FireCrack

  • 210
  • meh...
Non random behaviour in Random-Of
:wtf:
actualy, mabye not.
"When ink and pen in hands of men Inscribe your form, bipedal P They draw an altar on which God has slaughtered all stability, no eyes could ever soak in all the places you anoint, and yet to see you all at once we only need the point. Flirting with infinity, your geometric progeny that fit inside you oh so tight with triangles that feel so right."
3.141592653589793238462643383279502884197169399375105820974944 59230781640628620899862803482534211706...
"Your ever-constant homily says flaw is discipline, the patron saint of imperfection frees us from our sin. And if our transcendental lift shall find a final floor, then Man will know the death of God where wonder was before."

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Non random behaviour in Random-Of
Quote
Originally posted by Kosh
Is this what you had in mind? :p


Ummmm. No. What build were you using? It worked fine in Taylor's latest.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Kosh

  • A year behind what's funny
  • 210
Non random behaviour in Random-Of
Not the right one appearently. Just tried it with Taylors latest and I didn't get that wierd stuff.


It seemed to stay between 2 and 5. But it liked the numbers 2 and 5 the most.
"The reason for this is that the original Fortran got so convoluted and extensive (10's of millions of lines of code) that no-one can actually figure out how it works, there's a massive project going on to decode the original Fortran and write a more modern system, but until then, the UK communication network is actually relying heavily on 35 year old Fortran that nobody understands." - Flipside

Brain I/O error
Replace and press any key

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Non random behaviour in Random-Of
Erm.

It looks like you're misunderstanding what random-of is supposed to do.  More worryingly, it looks like I didn't get it quite right. :sigh:

Random-of is supposed to select a random argument only once.  In other words the first time the event is evaluated it selects an argument, which it then uses for every subsequent evaluation of the sexp.

What you should be getting is "Two.... Two... Two... Two..." etc. when you run the mission, but if you restart it you might get "Four... Four... Four... Four..." etc.  This is the same as the behavior of the "rand" sexp.

It shouldn't be hard to add a "random-multiple-of" sexp to pick a random argument every time you evaluate the sexp, but fixing the existing bug will be a bit harder.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Non random behaviour in Random-Of
I'd rather have the random-multiple-of SEXP to be honest. If I needed to keep the selection I'd save it in a string variable. (In fact that's exactly what I've said to do in several examples I've given using the SEXP). For the vast majority of things I had planned using the random-of SEXP  I was planning to save the argument for later use anyway so that wouldn't be too much of a problem.

I can't see how random-of could work with every-time anyway. If the event gets flushed before every use then there's no way I can see for it to remember what was picked the previous time is there? (I assume that's why you're saying that it's hard to fix).

I'll have to give it a try with when-argument and see what it does there.

You may be able to get away with simply replacing random-of with random-multiple-of if it proves hard to fix anyway. Sadly only a handful of FREDders are using the new conditionals at the moment so as long as we make sure that Sesq, TP and the the others are aware of the change you may be able to get away with not having to spend ages fixing it.
« Last Edit: July 12, 2005, 03:57:19 am by 340 »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Non random behaviour in Random-Of
Quote
Originally posted by karajorma
I can't see how random-of could work with every-time anyway. If the event gets flushed before every use then there's no way I can see for it to remember what was picked the previous time is there? (I assume that's why you're saying that it's hard to fix).

I'll have to give it a try with when-argument and see what it does there.
Hmm, that might actually be the problem.  Can you try that and tell me what happens?

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Non random behaviour in Random-Of
Tried it. I got exactly the same thing actually.

 The fact I used every-time-argument can't be the only problem as it wouldn't explain why Bosch never sang about 5 bottles.

Nor would it explain why invalidating arguments makes the event suddenly start working properly.

I simply thought it might simply be an additional problem but it appears as though the problem lies elsewhere.

As always here's the mission
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]