PDA

View Full Version : Is there a way to "compose" scripts?



Varsuuk
August 9th, 2020, 19:09
I am using list_text windows and have added on the named instance a <script> that adds a method for sorting which works hand in hand with the list_text.lua code in CoreRPG.

I'd like to customize behavior where clicking (onClickRelease) does not add an entry if the window is empty. I can do this by adding a replacement onClickRelease (or so I guess, haven't done) to my sorting lua source file but that doesn't make a lot of sense. I can generalize the sort method to be code for "my list_text" but I would prefer to use the "normal" one and just add my code as needed.

But you cannot have 2 <script> under a use of list_text. Any other tricky ways? Like have lua source for sorting, one for removing the auto add and then have a lua file that simply composes them into one file via something like C includes. This way, I can decide which overrides I want then include them (without COPYING them) in a lua source which I attach to the control?

I don't think its built in, but figured ask. Simple solution is to copy all of CoreRPG's list_text, make my change create a new template using this and the sort and voila. But wanted to think ahead in case had to do this more and want to avoid a lot of copying (and inevitable sync issues to CoreRPG)

superteddy57
August 11th, 2020, 18:27
I have found the easiest way was just copying the lua and making my own template to force it to use my changes. I am currently not aware of a way for it to function as you have presented here.