Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3

Author Topic: Making history run fast forvard after retirement  (Read 3599 times)

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Making history run fast forvard after retirement
« Reply #15 on: May 18, 2017, 05:01:26 am »

Man, I keep thinking about other stuff, pretty sure I ran out now after adding week/year selection via fast cursor movement, and cleaning up some math/having it at least show the current date on non-updating screens before you exit out, I left that since the pause is handy sometimes:
Spoiler (click to show/hide)
« Last Edit: May 23, 2017, 01:06:43 pm by Max™ »
Logged

Waterline

  • Bay Watcher
    • View Profile
Re: Making history run fast forvard after retirement
« Reply #16 on: May 18, 2017, 07:43:44 am »

Pause is handy, indeed. I was away for 3 hours and my pocket world updated for 30 years (roughly). While I aimed at something about 70 years.

Also the 30 year time skip makes the game load painfully long. I hope it will load at all.

Yes, it did load after about 3-5 minutes. Only for the first time after time skip. After save/load it works flawlessly.
« Last Edit: May 18, 2017, 07:54:44 am by Waterline »
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Making history run fast forvard after retirement
« Reply #17 on: May 18, 2017, 09:21:33 am »

Good to know, I realized I could use the same trick to ease a process I do a lot when worldgen spamming where I go in and fiddle with the sites cap/pop cap/ending stuff using gm-editor:
Code: (worldgenedit.lua) [Select]
--Edit certain worldgen parameters while it is running.
local gui = require 'gui'
local widgets = require 'gui.widgets'
local wv = df.global.gview.view.child.child
local wd = df.global.world.world_data
local wg = df.global.world.worldgen.worldgen_parms
local stn
local stc
local pop
local eny

genedit=defclass(genedit,gui.Screen)
genedit.focus_path = 'worldgenedit'
function genedit:init()
    self:addviews{
        widgets.Label{
view_id="main",
frame = {t=18,l=0},
text={
{text="Exit: Enter/Esc        "},{id="prec", text="Site Num: "}, {id="curs", text=self:callback("getSites")},NEWLINE,
{text="Edit: Left/Right       "},{id="pres", text="Site Cap: "}, {id="caps", text=self:callback("getCaps")},NEWLINE,
{text="Edit: Fast(Left/Right) "},{id="pops", text="Pop Cap: "}, {id="popc", text=self:callback("getPops")},NEWLINE,
{text="Edit: Up/Down          "},{id="ends", text="End Year: "}, {id="endy", text=self:callback("getEny")},
}
}
}
end

function genedit:getSites()
if df.viewscreen_new_regionst:is_instance(wv) then
stn = wd.next_site_id-1
else
qerror("Should be used during worldgen.")
end
return stn
end

function genedit:getCaps()
if df.viewscreen_new_regionst:is_instance(wv) then
stc = wg.site_cap
else
qerror("Should be used during worldgen.")
end
return stc
end

function genedit:getPops()
if df.viewscreen_new_regionst:is_instance(wv) then
pop = wg.total_civ_population
else
qerror("Should be used during worldgen.")
end
return pop
end

function genedit:getEny()
if df.viewscreen_new_regionst:is_instance(wv) then
eny = wg.end_year
else
qerror("Should be used during worldgen.")
end
return eny
end

function genedit:onInput(keys)
if df.viewscreen_new_regionst:is_instance(wv) then
if keys.LEAVESCREEN or keys.SELECT then
        self:dismiss()
end
if keys.CURSOR_LEFT then
wg.site_cap = wg.site_cap-50
elseif keys.CURSOR_RIGHT then
wg.site_cap = wg.site_cap+50
elseif keys.CURSOR_LEFT_FAST then
wg.total_civ_population = wg.total_civ_population-500
elseif keys.CURSOR_RIGHT_FAST then
wg.total_civ_population = wg.total_civ_population+500
elseif keys.CURSOR_DOWN then
wg.end_year = wg.end_year-1
elseif keys.CURSOR_UP then
wg.end_year = wg.end_year+1
end
elseif not df.viewscreen_new_regionst:is_instance(wv) then
if keys then
self:dismiss()
qerror("Should be used during worldgen.")
end
end
self.super.onInput(self,keys)
end

function genedit:onRenderBody(dc)
self._native.parent:render()
end

genedit():show()
Logged

Waterline

  • Bay Watcher
    • View Profile
Re: Making history run fast forvard after retirement
« Reply #18 on: May 18, 2017, 11:16:02 am »

How about spawning a civilization here or there in the process? Or individual civilization pop/site cap?
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Making history run fast forvard after retirement
« Reply #19 on: May 18, 2017, 12:31:54 pm »

Can't add those without much more in-depth scripts, Rumrusher has been working on those with limited success.
Logged

Waterline

  • Bay Watcher
    • View Profile
Re: Making history run fast forvard after retirement
« Reply #20 on: May 19, 2017, 12:47:29 pm »

What about running a world-gen again on an existing world to make notable historical changes?

After all, even though decades pass by and some things happen, not all the interesting events occur, and after all it feels weird... Armies keep marching after their masters being dead for 30 years, for instance. Or corpses lying around forever.

If only it was possible to re-invoke the world-gen history machine. 
Logged

ArrowThunder

  • Bay Watcher
    • View Profile
Re: Making history run fast forvard after retirement
« Reply #21 on: May 19, 2017, 10:51:56 pm »

Wow this is cool! I had a problem with this bug:
http://www.bay12games.com/dwarves/mantisbt/view.php?id=10235
but this script may fix it. Will update here and on the bug page if the script solves.
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Making history run fast forvard after retirement
« Reply #22 on: May 20, 2017, 05:25:50 am »

Good to know, and I had no idea about the retire/update/get a year+2 weeks accidentally thing, fascinating.
What about running a world-gen again on an existing world to make notable historical changes?

After all, even though decades pass by and some things happen, not all the interesting events occur, and after all it feels weird... Armies keep marching after their masters being dead for 30 years, for instance. Or corpses lying around forever.

If only it was possible to re-invoke the world-gen history machine. 
No way to repack everything so it would work right, Toady said it would be great but it's a nightmare to even begin trying to figure out.
Logged

Waterline

  • Bay Watcher
    • View Profile
Re: Making history run fast forvard after retirement
« Reply #23 on: May 20, 2017, 08:39:08 am »

I see. Thanks for the information.
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Making history run fast forvard after retirement
« Reply #24 on: May 23, 2017, 01:10:24 pm »

Last change I swear!


Code: (updatefinish.lua) [Select]
--Alter the date which the updating region process finishes at.
local gui = require 'gui'
local widgets = require 'gui.widgets'
local vw = df.global.gview.view.child
local yr
local mn
local dy


updater=defclass(updater,gui.Screen)
updater.focus_path = 'updatefinish'
function updater:init()
    self:addviews{
        widgets.Label{
            view_id="mainLabel",
            frame = {xalign=0,yalign=0},
            text={
{id="cmd", text=" Left/Right: Day, Up/Down: Week, Fast: Month/3 Months, Enter/Esc: To "},
{id="yr", text=self:callback("getYear")},{text="/"}, {id="mn", text=self:callback("getMonth")},{text="/"}, {id="dy", text=self:callback("getDay")},{text="     "}}
  }
}
end

function updater:getYear()
if df.viewscreen_update_regionst:is_instance(vw) then
yr = vw.year
else
yr = df.global.cur_year
end
return yr
end

function updater:getMonth()
if df.viewscreen_update_regionst:is_instance(vw) then
if vw.year_tick>=33600 then
mn = math.floor(vw.year_tick/33600)+1
else
mn = 1
end
else
mn = math.floor(df.global.cur_year_tick/33600)+1
end
return mn
end

function updater:getDay()
if df.viewscreen_update_regionst:is_instance(vw) then
local mf = (mn-1)*28
local yf = math.floor(vw.year_tick/1200)
if vw.year_tick>=1200 then
dy = (yf-mf)+1
else
dy = 1
end
else
mf = (math.floor(df.global.cur_year_tick/33600))*28
yf = math.floor(df.global.cur_year_tick/1200)
dy = (yf-mf)+1
end
return dy
end

function updater:onInput(keys)
if df.viewscreen_update_regionst:is_instance(vw) then
if keys.LEAVESCREEN or keys.SELECT then
        self:dismiss()
end
if keys.CURSOR_RIGHT then
if vw.year_tick>=402000 then
vw.year = vw.year+1
vw.year_tick = 0
else
vw.year_tick = vw.year_tick+1200
end
elseif keys.CURSOR_RIGHT_FAST then
if vw.year_tick>=369600 then
vw.year = vw.year+1
vw.year_tick = 0
else
vw.year_tick = vw.year_tick+33600
end
elseif keys.CURSOR_LEFT then
if vw.year_tick<=1200 then
vw.year = vw.year-1
vw.year_tick = 402000
else
vw.year_tick = vw.year_tick-1200
end
elseif keys.CURSOR_LEFT_FAST then
if vw.year_tick<=33600 then
vw.year = vw.year-1
vw.year_tick = 369600
else
vw.year_tick = vw.year_tick-33600
end
elseif keys.CURSOR_UP then
if vw.year_tick<=8400 then
vw.year = vw.year-1
vw.year_tick = vw.year_tick+394800
else
vw.year_tick = vw.year_tick-8400
end
elseif keys.CURSOR_UP_FAST then
if vw.year_tick<=100800 then
vw.year = vw.year-1
vw.year_tick = vw.year_tick+302400
else
vw.year_tick = vw.year_tick-100800
end
elseif keys.CURSOR_DOWN then
if vw.year_tick>=394800 then
vw.year = vw.year+1
vw.year_tick = vw.year_tick-394800
else
vw.year_tick = vw.year_tick+8400
end
elseif keys.CURSOR_DOWN_FAST then
if vw.year_tick>=302400 then
vw.year = vw.year+1
vw.year_tick = vw.year_tick-302400
else
vw.year_tick = vw.year_tick+100800
end
end
elseif not df.viewscreen_update_regionst:is_instance(vw) then
if keys then
self:dismiss()
qerror("This has to be used on the updating region screen!")
end
end
self.super.onInput(self,keys)
end

function updater:onRenderBody(dc)
self._native.parent:render()
end

updater():show()
Logged

Waterline

  • Bay Watcher
    • View Profile
Re: Making history run fast forvard after retirement
« Reply #25 on: May 24, 2017, 01:39:17 pm »

Thanks.
Also, you shall submit it to DFhack, it is so legit.
Logged

Dunamisdeos

  • Bay Watcher
  • Duggin was the hero we needed.
    • View Profile
Re: Making history run fast forvard after retirement
« Reply #26 on: May 24, 2017, 01:49:56 pm »

Thanks.
Also, you shall submit it to DFhack, it is so legit.

I second this suggestion! This is super awesome enough to put in DfHack IMO.
Logged
FACT I: Post note art is best art.
FACT II: Dunamisdeos is a forum-certified wordsmith.
FACT III: "All life begins with Post-it notes and ends with Post-it notes. This is the truth! This is my belief!...At least for now."
FACT IV: SPEECHO THE TRUSTWORM IS YOUR FRIEND or BEHOLD: THE FRUIT ENGINE 3.0

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Making history run fast forvard after retirement
« Reply #27 on: May 24, 2017, 01:56:43 pm »

Yeah, I gotta get my scripts bumped out there, this, questport, and something else I made are worth a pull request I think.
Logged

Waterline

  • Bay Watcher
    • View Profile
Re: Making history run fast forvard after retirement
« Reply #28 on: May 28, 2017, 08:53:18 am »

Link me some more interesting adventure scripts if you have those.
Or ones that might affect adventure.
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Making history run fast forvard after retirement
« Reply #29 on: May 28, 2017, 12:48:34 pm »

I'm proudest of questport (puts you where the cursor on your quest log is, bing-bang-boom) though updatefinish was pretty damn satisfying,. and the rest are pretty much what it says on the tin, though artibash was a result of thinking the critical hit effects Roses was doing were cool, so I set up a way to artifake a fake artifact and artibash shit across the screen with it.

https://github.com/maxthyme/maxthyme-scripts
Logged
Pages: 1 [2] 3