Making Dialog: How do I load random girls without repeating until I've used them all? (1 Viewer)

ZRI

Avid Affiliate
Joined
Nov 1, 2017
I want to make a dialog where HIM is being visited by a group of lovely ladies. I've got a list of maybe 10 HER-only partial charcodes, to be loaded randomly when I press a button. I'd like to make sure they're not repeated until I've used them all.
How do I do this?
 

edgelord 3000

Content Creator
Joined
Jan 16, 2018
Come to think of it, my solution is slightly wrong. In it, if line D has been played, it will play the general line regardless if the other lines have been played. So line D would have to check if A has been played to make it will loop around until it finds a line that hasn't been played. But at that point, when all lines have been played, it will loop forever and possibly crash the game. So it needs to check that beforehand, I reckon.

Code:
pulled_up:"[pulled_up*( varAplayed == 1 ) && ( varBplayed == 1 ) && ( varCplayed == 1 ) && ( varDplayed == 1 )*_INSTANT]"
pulled_up0_INSTANT:"[pulled_up_A*varAplayed*]"
pulled_up0_INSTANT:"[pulled_up_B*varBplayed*]"
pulled_up0_INSTANT:"[pulled_up_C*varCplayed*]"
pulled_up0_INSTANT:"[pulled_up_D*varDplayed*]"
pulled_up_A0_INSTANT:"Line A"{"set":{"varAplayed":1}}
pulled_up_A1_INSTANT:"[pulled_up_B*varBplayed*_INSTANT]"
pulled_up_B0_INSTANT:"Line B"{"set":{"varBplayed":1}}
pulled_up_B1_INSTANT:"[pulled_up_C*varCplayed*_INSTANT]"
pulled_up_C0_INSTANT:"Line C"{"set":{"varCplayed":1}}
pulled_up_C1_INSTANT:"[pulled_up_D*varDplayed*_INSTANT]"
pulled_up_D0_INSTANT:"Line D"{"set":{"varDplayed":1}}
pulled_up_D1_INSTANT:"[pulled_up_A*varAplayed*_INSTANT]"
pulled_up1_INSTANT:"[general]"

So messy. But it should work. Also, I added the _INSTANT tag to speed things up, executing this many lines would probably have taken a while if not.

edit: there's also this thread on the subject, which you can try if you get it. I know I don't.
 
Last edited:

edgelord 3000

Content Creator
Joined
Jan 16, 2018
Pim_gd's explanation was what I was struggling with. But I think I actually got it now after some rereads.
Basically, you have x number of variables, each set to a name (or charcode, or whatever), called variable_1 to variable_x. You then get a random number between 1 and x using da.random, resulting in y. You call variable_y which does whatever you need it to do, then switch the values of variable_y with variable_x, before you subtract 1 from x, leaving the previous variable_y (now variable_x+1) out of the pool. Repeat until done.

Did I get it right? I guess you could also copy y to a completely different set of variables if you want to so you could call upon variables you know has been used. "Hey, NAME_Y is back for more!", sort of.
 

Rudgar

Content Creator
Joined
Nov 18, 2016
Pim_gd's explanation was what I was struggling with. But I think I actually got it now after some rereads.
Basically, you have x number of variables, each set to a name (or charcode, or whatever), called variable_1 to variable_x. You then get a random number between 1 and x using da.random, resulting in y. You call variable_y which does whatever you need it to do, then switch the values of variable_y with variable_x, before you subtract 1 from x, leaving the previous variable_y (now variable_x+1) out of the pool. Repeat until done.


Did I get it right?
Perfectly right, perfectly explained!
.... almost :wink: There's only one single little bit left for me to nitpick:
[...] leaving the previous variable_y (now variable_x+1)
The previous variable_y will become "now" variable_x (without "+1"!) because former variable_x took the place of former variable_y - they both just change places, more or less. So no "+1" needed anywhere :cool:

Again: beside this, you completely got it and explained it perfectly - I myself couldn't have explained it better. :smile:

Respectfully, Rudgar
 

edgelord 3000

Content Creator
Joined
Jan 16, 2018
Nice. I tried making a dialogue to help out OP (and myself, if I want to use it later), but it doesn't seem to work. Logically, every name should be used an equal amount of times (give or take one), right? But in this dialogue, it doesn't, and I don't see why not. Any ideas?
 

Attachments

random name.txt
2.5 KB · Views: 98

ZRI

Avid Affiliate
Joined
Nov 1, 2017
I completely forgot about this thread :/
I'm an idiot, basically asked you folks for a shuffled linked list in SDT. I'm going to start thinking about this again, and see if I can come up with anything.

Here is my most recent attempt, if anyone is still interested.
 

Attachments

ZRI001.txt
5.6 KB · Views: 94

Last edited:

Users who are viewing this thread

Top


Are you 18 or older?

This website requires you to be 18 years of age or older. Please verify your age to view the content, or click Exit to leave.