Random Numbers and Random Tests: Can they work together? [SOLVED]


#1

EDIT: I have some puzzles that require the player to write down the correct characteres on the prompt, but there is no way for the random test to pass through them, is there?


I might be working under a wrong assumption here, but as far as I know, you can’t use random generated numbers during a random test.

So, every time I need to test my game using the RT, I just have to remove the chunks of code that are related to random numbers completely. Is that really the best way to do it?

I mean, isn’t there a way to make it so that my random generated events can be tested via the RT as well? I’m predicting some trouble when sending in the game, since one of the criteria is to pass the RT a couple of times… Which I can only do if I remove the random generator.

Here is an example of how I use random numbers:

*label eventPicker
*rand randomEvent 1 5

*if ((randomEvent = 1) and (eventHappened1))
 *goto eventPicker

*if ((randomEvent = 1) and (eventHappened1 = false))
 *goto_scene rs1

 
*if ((randomEvent = 2) and (eventHappened2))
 *goto eventPicker

*if ((randomEvent = 2) and (eventHappened2 = false))
 *goto_scene rs2

 
*if ((randomEvent = 3) and (eventHappened3))
 *goto eventPicker

*if ((randomEvent = 3) and (eventHappened3 = false))
 *goto_Scene rs3


*if ((randomEvent = 4) and (eventHappened4))
 *goto eventPicker

*if ((randomEvent = 4) and (eventHappened4 = false))
 *goto_Scene rs4

*if ((randomEvent = 5) and (eventHappened5))
 *goto eventPicker

*if ((randomEvent = 5) and (eventHappened5 = false))
 *goto_scene rs4

And it works fine, but if I keep this chunk of code on the game when I start the Random Test, he just keeps generating the random numbers forever. :joy:

edit: the problem with random numbers was just a typo :joy: :joy: :joy: :joy:


#2

There’s no actual problem with using *rand, for either of the automated tests. The only potential problem lies in properly verifying that every possible random situation has been thoroughly tested - e.g. if by chance it never generates a ‘4’ during testing, it will never properly test the scene called ‘rs4’, etc. But that is the only reason, to my knowledge, why CoG recommend being very cautious with how (or how much) you use the *rand command, especially for a first attempt.

P.S. I think you may have an error in the example code above: I believe the final scene should be rs5.


#3

Indeed that is an error. Can this be the origin of all my troubles? :astonished:

I’m going to check it now. Thanks for the help.

Edit: it is working fine now. Can’t believe the problem was something as simple as that.

I was also mistaking this problem with another one that I have: *input_text

I have some puzzles that require the player to write down the correct characteres on the prompt, but there is no way for the random test to pass through them, is there?

I’m going to update the title of the topic to see if anyone might know a workaround to this.

Again, thanks for the help.


#4

*if choice_randomtest is what you’ll want. Always true if running random test, always false if not. That said it doesn’t really give you information on how the game is actually played. As a side note, I believe the standard generated text for *input_text with random test is “blah blah”.


#5

Thank you so much for that. It was actually a thing I had read on the guides at the site but I never paid much attention to HOW I could use it.

By using the *if choice_randomtest to select if the game should go towards the interaction that requires the correct *input_text or skip it, I was able to work around the problem. Now the randomtest is working perfectly.