|
Post by Rodak on Jun 27, 2005 8:53:19 GMT -5
I was playing my own demo out of pure RPGMasochism, and found my Frenchman repeating himself (for those who don't know, in battle he yells random insults at the enemy).
This turned out to be the system "randomly" generating the same number three time in a row.
But it got me thinking. I made three variables called Last Taunt, 2 Taunts Ago, and 3 Taunts Ago. Then placed them in my Tauntings script as follows:
Data:Variable [Tauntings] = 0 ? 9
Script Branch: Condition: Variable: [Tauntings]=[Last Taunt] --Call Script: [Tauntings] --Force Script End Script: Condition End
Script Branch: Condition: Variable: [Tauntings]=[2 Taunts Ago] --Call Script: [Tauntings] --Force Script End Script: Condition End
Script Branch: Condition: Variable: [Tauntings]=[3 Taunts Ago] --Call Script: [Tauntings] --Force Script End Script: Condition End
Script Branch: Sort: Variable [Tauntings]
--Apply If Number = 0 --{First Taunt Scripts} --Script Branch: To End
...{Stuff for Taunts 1 - 8}...
--Apply If Number = 9 --{Tenth Taunt Scripts} --Script Branch: To End
Script Branch End
Data: Variable: [Three Taunts Ago] = [Two Taunts Ago] + 0 Data: Variable: [Two Taunts Ago] = [Last Taunt Taunt] + 0 Data: Variable: [Last Taunt] = [Tauntings] + 0
So... Does this look like it will keep him from repeating himself for at least 4 turns, or am I missing something obvious again?
Testing it could take a long time because he does not always repeat himself. Any advice would be appreciated.
Peace.
<><><><><><><><><><> EDIT: <><><><><><><><><><>
Would nested repeat loops be better than the self-referential script calling and script end forcing?
|
|
|
Post by NASH7777 on Jun 27, 2005 12:54:35 GMT -5
Yes go with the repeat condition rather than the call script. Cause techniclly it could freeze the game if the random number generated 10 times in a row is of only 4 number variations which is possible.
Forced repeat make random number if old number ~to top if 2nd old number ~to top if 3rd old number ~to top if 4th old number ~to top repeat end
|
|
|
Post by Rodak on Jun 27, 2005 13:23:11 GMT -5
Forced repeat make random number if old number ~to top if 2nd old number ~to top if 3rd old number ~to top if 4th old number ~to top repeat end Can that be done? As I recall the "To Top" command does funny things if not used in a Sort branch, and the only way to compare a value to a stored variable is with a Condition branch. Where would "To Top" go in a case like that... Or should I just re-sort the same variable just for this loop? I'll try a few things after work tonight... Thanks! Peace.
|
|
|
Post by NASH7777 on Jun 27, 2005 13:41:57 GMT -5
Sorry I I kinda rough posted it here's a little more of what it looks like
Forced repeat ~Blah=0?25 ~SB: Blah=oldblah ~~to top ~SB: End ~SB: Blah=oldblah2 ~~to top ~SB: End ~SB: Blah=oldblah3 ~~to top ~SB: End ~SB: Blah=oldblah4 ~~to top ~SB: End Repeat Branch end
|
|
|
Post by vespuleth on Jun 28, 2005 14:26:59 GMT -5
if you use 'to top' in a repeat, it goes to the first line of the repeat.
|
|
|
Post by Rodak on Jun 29, 2005 7:26:48 GMT -5
Thanks Ves, but I was wondering about the use of "To Top" in a "Script Branch : Condition" thingy.
If the Condition is in a repeat loop it may be ok, I have not tried because my house is having electrical problems (main circuit breaker tripping every 10 minutes!) and am preoccupied (I'm at work now... taking a half day and meeting an electrician this afternoon).
I hope to be back at it tonight!
Peace.
<>+=<> EDIT: <>+=<>
HOORAY for Electricians! They're expensive, but the power works now.
I guess I'll go test that idea out now...
Peace.
|
|
|
Post by Rodak on Jul 4, 2005 9:06:02 GMT -5
OK, I finally got around to testing this. The "To Top" appears to be useless when placed within a Script Branch: Condition even if that "SBC" is contained within a Repeat loop or a Sort Branch. Unless I am arranging my script like an idiot (again). I tried my idea first (ego and all, don't you know). That's the one in the first post of this thread with the "Self-Referential" script calling and the "Forced Script Ending" crappe. I made it print out 100 random values and noticed many duplicates and even 4 repeats in a row.
So I tried Nash's suggestion. Here's what I did to test the concept (including the same trick used to display the numbers):
Script Branch: Repeat: [Temp Variable 8] =/= {not equal to} 100 __Data: Variable: [Temp Variable 9] = 0 ? 9 ____Script Branch: Sort: Variable: [Temp Variable 9] ______Script Branch: Condition: [Temp Variable 9] = [Last Try] __________Script Branch: To Top ________Script: Condition End ______Script Branch: Condition: [Temp Variable 9] = [2 Tries Ago] __________Script Branch: To Top ________Script: Condition End ______Script Branch: Condition: [Temp Variable 9] = [3 Tries Ago] __________Script Branch: To Top ________Script: Condition End ____Script: Branch End ____Text: Message "" {No entry; Uncheck "close window" box} ____Text: Content: Variable: Display: [Temp Variable 9] ____Data: Variable: [Temp Variable 8] = [Temp Variable 8] + 1 ____Data: Variable: [3 Tries Ago] = [2 Tries Ago] + 0 ____Data: Variable: [2 Tries Ago] = [Last Try] + 0 ____Data: Variable: [Last Try] = [Temp Variable 9] + 0 Script: Branch End Text: Message "MOO!" {Check "close window" box}
This also produced lists of numbers with repetitions.
I tried pasting the randomization command within each "Condition" (before the "To Top" command) to generate a new value, with no luck
I am sure that it has something to do with the placement of the randomization or the placement of the sort (or even the placement /order of the substitution of variables at the end... but that looks to be in order), but I can not seem to create a script that will produce a list with zero repetitions (let alone a list with no repeats for at least 4 numbers). At least neither version freezes the game when it repeats the same number 3 or 4 times as was feared.
Perhaps someone better at scripting can help me out with this one?
As always, my thanks for any help with this problem go out to all who try to help.
Peace.
<>+=<>+=<> EDIT: <>+=<>+=<>
AH-MOOOOO! uhh...
I mean.... I figured it out (I like vacations).
"To Top" is NOT useless as stated above. I was just overscripting again. The "Sort" command is not needed at all and was the cause of the problem.
Here's what worked (and I'll post it in the database too because it gave me trouble, and it is a very useful concept for making random things appearing more random).
Script Branch: Repeat: [Temp Variable 8] =/= {not equal to} 100 __Data: Variable: [Temp Variable 9] = 0 ? 9 ____Script Branch: Condition: [Temp Variable 9] = [Last Try] ________Script Branch: To Top ______Script: Condition End ____Script Branch: Condition: [Temp Variable 9] = [2 Tries Ago] ________Script Branch: To Top ______Script: Condition End ____Script Branch: Condition: [Temp Variable 9] = [3 Tries Ago] ________Script Branch: To Top ______Script: Condition End __Text: Message "" {No entry; Uncheck "close window" box} __Text: Content: Variable: Display: [Temp Variable 9] __Data: Variable: [Temp Variable 8] = [Temp Variable 8] + 1 __Data: Variable: [3 Tries Ago] = [2 Tries Ago] + 0 __Data: Variable: [2 Tries Ago] = [Last Try] + 0 __Data: Variable: [Last Try] = [Temp Variable 9] + 0 Script: Branch End Text: Message "MOO!" {Check "close window" box} ____Data: Variable: [Temp Variable 8] = 0 + 0 {for repeat uses}
This gave consistent strings with no repeats for at least 4 numbers.
In all fairness I gotta admit that this is exactly what Nash suggested. I just made the mistake of putting it in an existing script (with the naughty "Sort" command present) instead of doing it from scratch.
Peace.
|
|
|
Post by vespuleth on Jul 8, 2005 0:50:28 GMT -5
if that hadnt worked, you could try nested repeats...
|
|