Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 196 197 [198] 199 200 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1453720 times)

Andux

  • Bay Watcher
  • [PREFSTRING:semicolons]
    • View Profile
    • Andux's DFWiki page
Re: DFHack 0.34.11 r2
« Reply #2955 on: February 05, 2013, 03:41:06 am »

These are roughly human values.  Ideally this would check the max age of the creature in question, but I don't know how to do that yet if it's possible.
Code: [Select]
local unitcaste = df.creature_raw.find(value.race).caste[value.caste]
local menopause_age = math.random((unitcaste.misc.maxage_min / 2), (unitcaste.misc.maxage_max / 2))
Or something like that.
Logged
(Do not sign anything.) -- Fell, Planescape: Torment

MADMAN · Save Tools · WTF Tools · Generated Raws Extractor · Tweak for 0.31–34.xx

danaris

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2956 on: February 05, 2013, 08:17:04 am »

I've got a unix executable file called dfhack-run, looks like. Is the script in hack/scripts?

No. There should also be a Unix executable file called simply dfhack.

If you are missing that, you need to redownload a new copy.
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2957 on: February 05, 2013, 08:24:20 am »

These are roughly human values.  Ideally this would check the max age of the creature in question, but I don't know how to do that yet if it's possible.
Code: [Select]
local unitcaste = df.creature_raw.find(value.race).caste[value.caste]
local menopause_age = math.random((unitcaste.misc.maxage_min / 2), (unitcaste.misc.maxage_max / 2))
Or something like that.

Ah hah, thanks, that is a much better solution.  I'll work that into my script and test it later today.
Logged
Through pain, I find wisdom.

ag

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2958 on: February 05, 2013, 10:22:42 am »

The actual menopause age and child cap are randomly decided per mother, with the RNG seeded based on her unit id.

Messing with the global random generator state is not a good idea...
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2959 on: February 05, 2013, 10:27:25 am »

The actual menopause age and child cap are randomly decided per mother, with the RNG seeded based on her unit id.

Messing with the global random generator state is not a good idea...

Oh?  Why is that?  I'm only calling math.randomseed inside the Lua script.  Does this have repercussions outside of the Lua interface?  I assumed that it had an isolated RNG, but if it's affecting the state of DF's RNG then I can see the potential issue.  If so I can just find a way to calculate a pseudo random number based on the unit id I suppose.
« Last Edit: February 05, 2013, 10:30:00 am by Telgin »
Logged
Through pain, I find wisdom.

ag

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2960 on: February 05, 2013, 10:41:06 am »

I assumed that it had an isolated RNG, but if it's affecting the state of DF's RNG then I can see the potential issue.

It so happens that Toady uses his own RNG; however that lua api works on top of the global RNG in the standard C library, so it will affect anything that uses that, including any other lua scripts.
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2961 on: February 05, 2013, 10:45:25 am »

I have a few rng written in lua (correctness not guaranteed)  if anyone needs.

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2962 on: February 05, 2013, 10:48:30 am »

Right then, time to find a very simple RNG generator to embed in the script.  Or some other simple way to generate random looking values that are consistent for a unit.

I have a few rng written in lua (correctness not guaranteed)  if anyone needs.

If it's fairly simple and generates anything approaching random looking numbers I'm interested.
Logged
Through pain, I find wisdom.

ag

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2963 on: February 05, 2013, 10:51:31 am »

Note also that since afaik the math behind the standard C rng is not standardized in any way, implementing a custom one is the only way to get guaranteed consistent behavior between different operating systems and compilers. This is probably one of the reasons Toady did that - consistent random numbers are critical for worldgen.
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2964 on: February 05, 2013, 11:01:45 am »

Right then, time to find a very simple RNG generator to embed in the script.  Or some other simple way to generate random looking values that are consistent for a unit.

I have a few rng written in lua (correctness not guaranteed)  if anyone needs.

If it's fairly simple and generates anything approaching random looking numbers I'm interested.
https://github.com/warmist/OpusArcania/blob/master/random.lua
Enjoy.
Edit: Usage
Code: [Select]
local rand=Mersenne(myseed) -- or xorShift(seed)
local value=rand:get(min,max)
--and
local deck={0,1,2,3,4,5,6}
value=rand:pick(deck)
« Last Edit: February 05, 2013, 11:04:57 am by Warmist »
Logged

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2965 on: February 05, 2013, 03:09:20 pm »

Ever since I started using DFHack, people report appearance of "granite" with a sand icon and a weight of 1 urist in food stockpile. Some time later it's gone.

I guess some plugin from DFHack causes it for some workaround, do you know what coud it be?

Here: http://dffd.wimbli.com/file.php?id=7374

On F2 hotkey there's a food stockpile full of "granite", when you unpause it disappears.
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

WillowLuman

  • Bay Watcher
  • They/Them Life is weird
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2966 on: February 05, 2013, 03:15:39 pm »

I've got a unix executable file called dfhack-run, looks like. Is the script in hack/scripts?

No. There should also be a Unix executable file called simply dfhack.

If you are missing that, you need to redownload a new copy.

Got that too. But how to open up its code? I feel as if I'm missing something obvious.
Logged
Dwarf Souls: Prepare to Mine
Keep Me Safe - A Girl and Her Computer (Illustrated Game)
Darkest Garden - Illustrated game. - What mysteries lie in the abandoned dark?

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2967 on: February 05, 2013, 03:28:39 pm »

I've got a unix executable file called dfhack-run, looks like. Is the script in hack/scripts?

No. There should also be a Unix executable file called simply dfhack.

If you are missing that, you need to redownload a new copy.

Got that too. But how to open up its code? I feel as if I'm missing something obvious.
Try opening with text editor. It should be a script. Not sure how it works on Mac but in ubuntu it asked you if you want to edit or run it. Also you could just open text editor and file->open, navigate to it and open.

danaris

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2968 on: February 05, 2013, 03:45:25 pm »

I've got a unix executable file called dfhack-run, looks like. Is the script in hack/scripts?

No. There should also be a Unix executable file called simply dfhack.

If you are missing that, you need to redownload a new copy.

Got that too. But how to open up its code? I feel as if I'm missing something obvious.

You can open it up with TextEdit, in any of the various ways one opens Mac documents with non-default applications. (The simplest I can describe being to open up TextEdit, then drag the file onto its Dock icon.)
Logged

WillowLuman

  • Bay Watcher
  • They/Them Life is weird
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2969 on: February 05, 2013, 03:51:04 pm »

Huh, TextEdit wasn't working before, but it is now. Thanks!

EDIT: And now I know for sure that Dfhack does not work on my ancient 10.5.8 system. Just wanted to test it.
« Last Edit: February 05, 2013, 03:54:13 pm by HugoLuman »
Logged
Dwarf Souls: Prepare to Mine
Keep Me Safe - A Girl and Her Computer (Illustrated Game)
Darkest Garden - Illustrated game. - What mysteries lie in the abandoned dark?
Pages: 1 ... 196 197 [198] 199 200 ... 373