Author Topic: Random_Seed and Patch_Random_Seed  (Read 752 times)

Offline Duality

  • Planewalker
  • *****
  • Posts: 147
Random_Seed and Patch_Random_Seed
« on: March 28, 2006, 01:54:46 PM »
I'm using weidu-mac 1.90

First off, whats the difference? Under patch_random_seed, the weidu readme says "see random_seed". That's not terribly helpful, especially since random_seed doesn't mention patch_random_seed.

My first problem is that what I assume to be the syntax (I couldn't find but one example) for RANDOM_SEED doesn't work.

RANDOM_SEED 1
doesn't work, but

PATCH_RANDOM_SEED 1
does. What am I missing?

The readme also says that if RANDOM_SEED was given an invalid int, it would seed itself. But I only get "cannot convert to an INT" when I put anything else in there. (I tried 1.4, hi and "hi", all gave the same error)

My other problem is how to make the psuedo-random generator a little more random. Each time I run the script, I get the same results.

For instance:
   SET "hp_boost" = RANDOM(35 45)
   WRITE_SHORT 0x24 ("%current%" + "%hp_boost%")
   WRITE_SHORT 0x26 ("%max%" + "%hp_boost%")


I ran this four times, and each time Abazigal gained 31 hp's (the script also modifies a number of other stats, and they too were all the same). This applies to at least five or so of the other 4,000 creatures the script modified. (I didn't check all of them, I'm not that insane)
I assume this means that weidu doesn't automatically seed random() when it runs?
Is there a way to generate relatively random numbers each time the script runs?

Thanks  ;D
« Last Edit: March 28, 2006, 01:58:40 PM by Duality »
"I'll try being nicer if you try being smarter."

"There is a certain freedom in being totally screwed. It means that nothing you do is going to make it any worse."

"Eagles may soar, but weasels don't get sucked into jet engines."

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: Random_Seed and Patch_Random_Seed
« Reply #1 on: March 29, 2006, 05:20:40 AM »
Sigh, double sigh, triple sigh. The (weimeric) code is higly different from what described.

RANDOM_SEED accepts a string, so, to do a self init, you should use RANDOM_SEED this_is_not_an_int, while PATCH_RANDOM_SEED accepts a patch_exp and cannot self init.

This will be fixed in v192 to behave like what is described in the readme.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline Duality

  • Planewalker
  • *****
  • Posts: 147
Re: Random_Seed and Patch_Random_Seed
« Reply #2 on: March 29, 2006, 04:44:34 PM »
Yay! I got it. Thanks  ;D
"I'll try being nicer if you try being smarter."

"There is a certain freedom in being totally screwed. It means that nothing you do is going to make it any worse."

"Eagles may soar, but weasels don't get sucked into jet engines."

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: