Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 14 15 [16] 17 18 ... 24

Author Topic: Roses' Script, System, and Utilities Collection (07/06/2021)  (Read 91409 times)

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (10/15/2017)
« Reply #225 on: October 15, 2017, 08:06:37 pm »

Alright, so first release in a while. The github has been updated. All scripts in the repository should be working and updated to 43.05. That being said I'm sure there will be some problem I didn't foresee, also in process of updating they won't be backwards compatible. The detailed unit viewer is also working even if you don't use the Class System, although the spacing is still a little strange. The journal hasn't been updated to include the links, but it does work for all the in game information, just takes some more time to find what you might need.

There will be more updates coming soon, as I work on individual scripts and create new ones.
Logged

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (10/15/2017)
« Reply #226 on: November 27, 2017, 02:46:17 pm »

In preparation for DFHack moving to the new DF version I have been going through my scripts/systems and the run_test script to make sure everything is working correctly and apparently my most recent git push broke a couple things, I have sensed fixed most of them, and added script tests for the previously missing scripts. I just need to add tests to the remaining untested systems and then I will do another push.

Also, I have started working on a couple new scripts and additions to previous scripts;

1. unit/attack - Currently this script creates an attack action with various user inputs. However this limits it to just working for basic attacks (i.e. an attack between two units right next to eachother). But what about creating an attack spell that you want to hit further away (e.g. Flame Whip)? So I am adding the ability to trigger the attack at range. Unfortunately there is nothing built-in to DF to handle this, so it involves a lot of DFHack chicanery, but I think I have a method that will work.

2. item/animate - This is a tricky one. I've always thought it would be cool if you could animate a certain item/object. However, to make this work correctly you would need to make a creature corresponding to each item/material combo, making it unrealistic. Instead I have created a "template" creature with 25 castes (note that the 25 is because I assumed you would never have more than 25 different item/material combos animated at the same time, if you think you will have more/less you can add/remove the extra castes). When you run the animate script it will find one of the castes that is not being used and modify the caste raws to mimic the item that is being animated. This involves changing names, materials, attacks (if applicable), etc... For those of you wondering why it has to be so complicated, when you change a castes raws you change all units tied to that caste, so you can't just use on creature/caste for all your animations.

3. tile/geomancy - This script will read the tile material at a specified location, and perform a specific command depending on that tiles material. I am still ironing out exactly how the user will specify what commands to trigger on what tile materials, but other than that it is a pretty straight forward script. (Thank to Milo Christianson's work on finding tile material with lua)

4, action-trigger - This will be an extension of the current modtools/item-trigger (with a couple non-item required extras). Currently item-trigger allows for triggering scripts on equipping/unequipping an item or striking with one. What this script will do is allow script triggering on any action (dodge, parry, block, attack, move, etc...), You will be able to specify that the effect occurs only when a certain item is equipped/used, only if a certain creature performs the action, only if a certain syndrome class is present on the unit, or some combination there of. Now you will be able to make a shield that, if blocked with, will send the attacker flying backwards.

I've also been working on adding more options to the Enhanced System, namely for buildings. Currently it allows for creating multi-story buildings, buildings with walls and roofs, outside/inside only (currently this feature is also available straight from DFHack), building only near water/magma, building only on specific materials, requiring both water and magma, and specifying certain criteria are met before building (e.g. >X population/kills/deaths/wealth/etc..., other buildings being built, other buildings not being built, and more). What I am adding to it is allowing buildings some more automation and features for the buildings themselves (e.g. buildings that trigger scripts every X ticks, buildings that provide/consume power, which is already possible with DFHack, buildings that trigger a script if a unit walks by, and more). Note, for those of you unfamiliar with my "Systems" all of this is achieved by reading in external files, which I have decided to create in the DF raw format, that the user provides. I will provide a couple of examples, but largely these are just systems (get it!) that a modder can use to provide extra features.

Also, I have decided to put my Expedition System on hold until I get a good grasp on what the new version of DF can do in terms of raids and such.
Logged

Amostubal

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (10/15/2017)
« Reply #227 on: November 27, 2017, 07:33:31 pm »

I found an issue in flow/source.lua

basically if you ever remove any source or sink in any way... you destroy the table length.  so your process of selecting a key for the table causes a critical failure where the removed key reduces the table length by one... so here's the math.

source 1 is created, key is "0", because the table length is 0.
source 2 is created, key is "1", because the table length is 1 ("0").
source 1 is removed, so key "0" disappears completely.
source 3 is created, key is "1", because the table length is 1 ("1"). <- critical error.
after this point any source created is just going to rewrite key "1" repeatedly until the entire table is deleted.

the error is due to how persist-table works when a key is set to nil... it completely removes the key making it no longer available to the table length.

my fix was to change the key to a system that doesn't rely on the table length at all.  so all the parts that say:
number tostring(#liquidTable._children)
I replaced with:
number = tostring(df.global.cur_year).."."..tostring(df.global.cur_year_tick)..".0"..tostring(x)..tostring(y)..tostring(z)

to be exact there is like 5 of those lines in the script and since this new format didn't require reliance on the table choice (flow or liquid) I just replaced the first instance that occurs before all of it, and removed the other 4.

basically even if someone sets up a reaction to make multiple calls to source in the same tick... they most likely wouldn't use the same X.Y.Z So this has the wonderful effect of creating keys that look like this:
5.30972.095.069.0172.0 <-I like how for some reason x,y,z had a .0 after them making the location read 095, 069, 0172 thats why I add the ".0"
a completely unique non repeatable key creation, as soon as the next game tick occurs, that key generation is completely gone.  I considered doing a random between 0 and 1,000,000,000,000,000,000,000,000 but I figured it would eventually find a way to repeat.

there is other errors in the script also, besides that.

like here in line 52:
 if not args.removeAll or not args.removeAllSource or not args.removeAllSink then

so what you was wanting was that if any of those args are true to not do the next code block. the problem is the logic doesn't work that way. the line is seeking a true answer to do the following block so say you had args.removeAll and not the others:
if not (true) or not (false) or not (false) then
...
if false or true or true then <-  this is true by lua logic so the line does the next code block, which is not what you wanted the line to do.

replacement line 52:
 if not ( args.removeAll or args.removeAllSource or args.removeAllSink ) then

not ( true or false or false ) = not ( true ) = false <- which is the result you wanted.

I also wrote a report list that spit out the liquidTable info int DFHack specifically for figuring out what was going on.

If you want I can send over to your github the fixes I made to that script.
« Last Edit: December 08, 2017, 09:45:12 pm by Amostubal »
Logged
Legendary Dwarf Fortress
Legendary Discord Group
"...peering into the darkness behind the curtains, evokes visions of pixies being chased by dragons while eating cupcakes made of coral iced with liquid fire while their hearts burn out with unknown plant substances..." - a quote from the diaries of Amostubal

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (10/15/2017)
« Reply #228 on: November 27, 2017, 07:39:28 pm »

I found an issue in flow/source.lua

snipped

Great to know, I guess my test of the script would never have found that since all I do is try to place them, check that they were placed, then try and remove them and check that they were removed, don't think I ever tried adding again after one was removed. I'll make this change. Thank you very much
Logged

Amostubal

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (10/15/2017)
« Reply #229 on: November 27, 2017, 07:58:18 pm »

I found an issue in flow/source.lua

snipped

Great to know, I guess my test of the script would never have found that since all I do is try to place them, check that they were placed, then try and remove them and check that they were removed, don't think I ever tried adding again after one was removed. I'll make this change. Thank you very much

not a problem, I never really noticed it before and have used this script hundreds of thousands of times through reactions in MDF and MMDF and never noticed this weirdness.  Generally I used it exactly as you stated, turning some sources on then turning them off... most times turning all of them off long before trying to turn another on.

If it wasn't for me messing with a copy of this script that I'm modifying for other purposes ... I wouldn't have noticed this at all, but I was playing with turning on and off several things do to the nature of modifying when I started noticing that certain sinks and sources would suddenly disappear.

it was really interesting, because my sources are being placed in channels that drop 2z into a pool that is being used to test sinks that has an overflow exit tunnel to one side on the in between z level.  all this to test a few workshops and additional stuff.

So when I turned one off mid way through and then turned another one on... and then a third stopped, I thought I had set bad reaction triggers, something that has happened before. that wasn't it. that led me to investigate the source and sink functions, and the update functions and then finally give up and write a report option into source to print the liquidTable into something legible.   Its funny how we think something is true and it isn't true and we suddenly have our mind blown.
Logged
Legendary Dwarf Fortress
Legendary Discord Group
"...peering into the darkness behind the curtains, evokes visions of pixies being chased by dragons while eating cupcakes made of coral iced with liquid fire while their hearts burn out with unknown plant substances..." - a quote from the diaries of Amostubal

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (10/15/2017)
« Reply #230 on: December 05, 2017, 01:21:52 pm »

For some reason I just noticed your last line of your previous message. If you are familiar with Git and want to submit a pull request that would be great! Would save me having to go through the same fixes
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: Roses' Script, System, and Utilities Collection (10/15/2017)
« Reply #231 on: December 08, 2017, 08:42:10 pm »

Good to see you are still around. :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Amostubal

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (10/15/2017)
« Reply #232 on: December 08, 2017, 09:55:57 pm »

For some reason I just noticed your last line of your previous message. If you are familiar with Git and want to submit a pull request that would be great! Would save me having to go through the same fixes

sorry I missed this line, I'll look into this week... since I did the changes in my own version of the code, I'll have to remake it in the original roses script.

I used it to make a pipe-dreams hack script system that's in my newest pack.  basically I used your liquid sinks/sources on one side, with the other side maintaining lists of pipes and machines on the network, and how they connect.  Currently its working fairly well and I plan to separate it out and release it as a module once the next dfHack is stable and I've tested it on it.
Logged
Legendary Dwarf Fortress
Legendary Discord Group
"...peering into the darkness behind the curtains, evokes visions of pixies being chased by dragons while eating cupcakes made of coral iced with liquid fire while their hearts burn out with unknown plant substances..." - a quote from the diaries of Amostubal

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (10/15/2017)
« Reply #233 on: December 09, 2017, 04:51:59 pm »

If it's a big hassle you don't need to worry about it. I think you gave me enough information to make it pretty quick (I know it can be difficult to navigate some of my stuff)
Logged

Amostubal

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (10/15/2017)
« Reply #234 on: December 10, 2017, 11:16:06 am »

If it's a big hassle you don't need to worry about it. I think you gave me enough information to make it pretty quick (I know it can be difficult to navigate some of my stuff)

I believe I sent it, but I wasn't on my test computer, so I didn't test it, there may be typos, regretfully.
Logged
Legendary Dwarf Fortress
Legendary Discord Group
"...peering into the darkness behind the curtains, evokes visions of pixies being chased by dragons while eating cupcakes made of coral iced with liquid fire while their hearts burn out with unknown plant substances..." - a quote from the diaries of Amostubal

Urist Sonuvagimli

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (10/15/2017)
« Reply #235 on: December 11, 2017, 02:33:30 am »

One of the curses of DF adventurer mode is inability to manually create titles (earned after 5 significant kills). Is there such a functionality in this plugin?
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: Roses' Script, System, and Utilities Collection (10/15/2017)
« Reply #236 on: December 15, 2017, 03:54:51 pm »

Just wanted to let you know that the building subtype-change script still works in dfhack-alpha for 44.02 without any issues. :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (10/15/2017)
« Reply #237 on: December 18, 2017, 12:44:09 pm »

Just wanted to let you know that the building subtype-change script still works in dfhack-alpha for 44.02 without any issues. :)

That's good to know. I'm guessing that pretty much all my scripts will work with the 44.02 alpha, but I was going to wait until after the holidays to actually confirm that. If there are any changes that need to be made to make it compatible I will probably move the current master branch into a 43 version  branch and continue 44 work in the master branch.
Logged

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (10/15/2017)
« Reply #238 on: December 19, 2017, 02:33:03 pm »

So since I will be going to the land of slow internet and no people for the holidays I will have a lot of time to do other stuff. One thing I really want to do is get working on this mod I keep mentioning (for those that don't know I have a D&D-esque world I have created that I play with my friends that I have been meaning to translate to DF for years, and is actually the reason I started all of my scripts and systems since they were needed to properly translate it), but I will also have time for scripting.

Now I have a list of things I want to get done, but since it's the holidays and all, I thought I would ask people if there was any scripts they have been wanting but might not have the time/knowledge necessary to create it and I will add it to my to do list.

One of the curses of DF adventurer mode is inability to manually create titles (earned after 5 significant kills). Is there such a functionality in this plugin?
Sorry for the late reply. I'm actually not sure about that, I've never really played adventure mode, so I don't even know how most of my scripts would fair, let alone how the title information is stored. But, as per my above message, I will look into it over the holidays and have a script for you in the new year that lets you create titles
Logged

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (10/15/2017)
« Reply #239 on: December 29, 2017, 08:42:40 pm »

Getting some decent work done on my various scripts/systems. I have now made it easier to create your own "magical" items. For example;

A shield that increases your shield skill by 5 and everytime you block with it there is a 50% chance that the attacker will get flung away from you
Code: [Select]
[ITEM:FORCE_SHIELD]
 [ON_EQUIP]
  [SKILL_CHANGE:SHIELD:5]
 [ON_BLOCK]
  [CHANCE:50]
  [SCRIPT:unit/propel -unitSource ATTACKER_ID -unitTarget DEFENDER_ID -velocity [ 25 25 0 ] -mode relative]

Our a cloak that gives you a speed boost each time you dodge
Code: [Select]
[ITEM:CLOAK_OF_SPEED]
 [ON_DODGE]
  [CHANCE:100]
  [DEFENDER_SYNDROME_ADD:SPEED_UP]

These would go in a seperate file that is read by the game at start up and can either be automatically applied to certain items in the game (i.e. if you had a shield with FORCE_SHIELD as it's ID in your raws, then the game would automatically apply the effects to those shields, or be manually applied via the command line (or reactions/interactions/syndromes/etc...)

The above are examples of items with magical properties, but you can also create materials with magical properties. The system is basically the same except instead of having a magical shield item you could create a magical material that if you made a shield out of it, any time you blocked with that shield something would happen. Or if you made a sword out of it something else would happen.
Logged
Pages: 1 ... 14 15 [16] 17 18 ... 24