I just finished a rewrite of what appears to be an abandoned mod that automatically adds player prefix/suffix tags to
deployed/built objects. All the code has been reworked to utilize libraries and it is commented for users to understand.
There is an option called $runAtStartup that allows the player to force all owned objects to be renamed at startup
after installation. The problem is, they have to remember to set it to FALSE or it will run at every startup.
It isn't necessary to run it repeatedly at startup because new objects are automatically renamed. This is just a feature
to allow the mod to apply to existing empires when the mod is initially installed.
What is the best way to implement a "RunOnce" cue but also give the player the option to force it to "RunOnce" at
any time, if they want?
https://i.imgur.com/Lw1WlSI.jpeg
Best practices for a "RunOnce" type of CUE?
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
Best practices for a "RunOnce" type of CUE?
Last edited by Terre on Thu, 2. Jun 22, 19:08, edited 1 time in total.
Reason: Images posted directly to the forums should not be greater than 640x480 or 100kb, oversize image now linked
Reason: Images posted directly to the forums should not be greater than 640x480 or 100kb, oversize image now linked
Re: Best practices for a "RunOnce" type of CUE?
I haven't personally made any run once cues that i specifically want the user to be able to reset. The best method i know of would be to use sirnukes mod support api to create a little ui menu that allows the user to trigger a cue with the actions being in a library or something.
Barring that it basically is up to what you think the user is least likely to mess up. Maybe a condition of
<check_value value="false"/>
Then the user can change false to true to make it run.
Barring that it basically is up to what you think the user is least likely to mess up. Maybe a condition of
<check_value value="false"/>
Then the user can change false to true to make it run.
Re: Best practices for a "RunOnce" type of CUE?
Thanks. I hadn't considered sirnukes because I didn't want to take on too much of a learning curve than I have with the XML libraries. But your value check is how I do it right now,DeadAirRT wrote: ↑Sat, 4. Jun 22, 15:44I haven't personally made any run once cues that i specifically want the user to be able to reset. The best method i know of would be to use sirnukes mod support api to create a little ui menu that allows the user to trigger a cue with the actions being in a library or something.
Barring that it basically is up to what you think the user is least likely to mess up. Maybe a condition of
<check_value value="false"/>
Then the user can change false to true to make it run.
my problem is I wanted a fail-safe if the user forgets to switch it back.
I thougth of something like this:
<do_if value="runonce == 1">
</do_if>
<set_value name="runonce" exact="0">
But I'm not sure how to force the value to be saved and loaded on the next startup without declaring it prior to use and thereby wiping out the loaded value.
Re: Best practices for a "RunOnce" type of CUE?
If you think users are smart enough you could have them uncomment something.user1679 wrote: ↑Sun, 5. Jun 22, 03:03Thanks. I hadn't considered sirnukes because I didn't want to take on too much of a learning curve than I have with the XML libraries. But your value check is how I do it right now,DeadAirRT wrote: ↑Sat, 4. Jun 22, 15:44I haven't personally made any run once cues that i specifically want the user to be able to reset. The best method i know of would be to use sirnukes mod support api to create a little ui menu that allows the user to trigger a cue with the actions being in a library or something.
Barring that it basically is up to what you think the user is least likely to mess up. Maybe a condition of
<check_value value="false"/>
Then the user can change false to true to make it run.
my problem is I wanted a fail-safe if the user forgets to switch it back.
I thougth of something like this:
<do_if value="runonce == 1">
</do_if>
<set_value name="runonce" exact="0">
But I'm not sure how to force the value to be saved and loaded on the next startup without declaring it prior to use and thereby wiping out the loaded value.
Sirnukes stuff is done in xml and has really good documentation. It would likely be easier than most projects.