-
Running scripts without having to click on the 'Show Me How' button
Summary: Traditionally, the advice thread in EDA used to run the script had a Script line in it. Replace the Script keyword with the OnDisplay keyword to have the script run automatically, without having to click on the 'Show me how' button.
The full tutorial is posted here: http://www.twcenter.net/forums/showthread.php?t=169689
This thread is for discussion only.
-
Re: Eureka! Running scripts automatically!
And for reloading a saved game? :inquisitive:
-
Re: Eureka! Running scripts automatically!
Congratulations! This is probably the most exciting recent find I can think of! Should a mod move it to Scriptorium?
-
Re: Eureka! Running scripts automatically!
Quote:
Originally Posted by Monkwarrior
And for reloading a saved game? :inquisitive:
Quote:
Originally Posted by HouseOfHam
. . . and for loading a saved game, you only need to click on the advisor portrait and you're done.
<snip>
See the bolded mark of the OP.
-
Re: Eureka! Running scripts automatically!
But I don't understand how it is triggered when reloading.
An additional trigger is needed, isn't it?
What does on_display make? What's the difference with a "normal" advice thread?
Sorry, maybe I've missed something. :embarassed:
I used the system "campaign script -> background script" to launch it at the start of a campaign (this is not new for me), but I had to use a normal trigger (click on settlement for example) when reloading. I'd like to understand the difference.
-
Re: Eureka! Running scripts automatically!
You will still need to keep those triggers. But when loading a saved game, they'll only need need click on the advisor portrait and that's it.
The best way to see what it does is to try it. :)
-
Re: Eureka! Running scripts automatically!
EUREKAAA!
i find a way to get ride of those annoying script activation,using this incredible thing.
you make a trigger for the ADVICE like this:
Trigger my_script
WhenToTest FactionTurnStart
Condition FactionIsLocal
AdviceThread My_script_Thread
this way as you see there is a problem cause the script will be activated each time you start a turn...but :idea2:
in the script write:
suspend_unscripted_advice true
this way no more advice will be displayed.ANd
:yes: :yes: :yes: :yes: We you load a game you will have your script activated.
and if you reload,it will reativate again:smash:
Great work HouseOfHam:2thumbsup: :bounce:
-
Re: Eureka! Running scripts automatically!
Thanks. :)
Does that event trigger immediately as you load a saved game or do you have to hit 'End turn' first?
I'll give it a try tonight.
-
Re: Eureka! Running scripts automatically!
it can be that toghetr we have solved one of the greatest problems in the modding.Having the player to remember to activate the script.
the characterTurnStart event should trigger immediantly when you firstly start a campaign,but i think not when you load....GameReloaded seems the event we need to make the last step,but i think FactionTurnEnd would work anyway(but in this way the player must pass a turn to have thee script activated).Let me know.I'll try with GameReloaded and let you know ;)
-
Re: Eureka! Running scripts automatically!
ok maded some extra tests.
FactionTurnStart is useless there.and even gameReloaded seems a fake.
indeed we can get ride of this problem in this way,unless it won't work for all kind of scripts(in the fact it will work almost for all kind of script:2thumbsup: ),using the combination SettlementSelected,CharacterSelected,factionTurnEnd.
This way if the player touches anything in the strat map,it will activate the script.
the only drawback is that this method requires the advice_frequence to be set to high,unless someone discover how to make advices to appear anyway(there is a big set of attributes added to an advice.Maybe someone will do the trick.)
I'm gonna check right about now.Keep it up HouseOfHam.WE MUST DISCOVER THE SECRET
-
Re: Eureka! Running scripts automatically!
Yeah, I've never been able to detect the GameReloaded event, either. I don't think they ever implemented it.
Anyhow, the remaining problem is not so much what trigger(s) to use but how to get the script to run without having to click on the advisor portrait. If that's not a concern, whatever triggers people used in their mod will still work just fine.
-
Re: Eureka! Running scripts automatically!
After an afternoon spent doing tests,here it's my conclusions:
i used those advice and triggers
;------------------------------------------
AdviceThread Help_Game_Options_Scroll_Thread
GameArea Campaign
Item Help_Game_Options_Scroll_Text_01
Verbosity 0
Priority 2
MaxRepeats 0
RepeatInterval 1
Threshold 1
Attitude Excited
Presentation Default
Title Help_Game_Options_Scroll_Text_01_Title
On_display scripts\show_me\script.txt
Text Help_Game_Options_Scroll_Text_01_Text1
Trigger 3699_City_Construction_Build_temple_of_trade_pantheon_britons_Next_Trigger
WhenToTest SettlementSelected
AdviceThread Help_Game_Options_Scroll_Thread 1
Trigger 3699_City_Construction_Build_temple_of_trade_pantheon_britons_Next_Trigger
WhenToTest CharacterSelected
AdviceThread Help_Game_Options_Scroll_Thread 1
note that the line "Attitude Excited" force RTW to automaticcally open the advice(so you don't have to click on it).then you must write "suspend_unscripted_advice true" on your script
the two drawback are:
1)it doesn't start unless you select something on the map(factionturnend is completely useless).
2)you have to select the advice frequency to low to get it to work.
a big leap for our scripters.but still not perfection.This damn RTW has only one thing done well:THE BUGS:furious3:
-
Re: Eureka! Running scripts automatically!
i have reaad just now.i solved that problem :2thumbsup:.please tell me if you find something new.;)
-
Re: Eureka! Running scripts automatically!
Good to know about Attitude Excited. Does that only work if advisor is set to something other than "No advice"?
Why did you use Priority 2?
-
Re: Eureka! Running scripts automatically!
it's a matter of setting.those ones with higher priority seems to be considered first(so if you have to advices that should pop out in the same moment,the engine will show first the one with higher priority ) and also that one is used in deciding which advices are to be shown or not when you change the "advice frequency" setting.Some of them will never pop out if you select an addvice priority of "high".writing priority 2 will ensure that advice is displayed also when you select "low".but seems to do nothing against the "noone" advice frequency option :( ...
-
Re: Eureka! Running scripts automatically!
No reason you couldn't use more than 1 thread. 1st for people who have advisor set to "no advice" - to start it by clicking on the advisor portrait, and 2nd to start it automatically for people who have advisor set to "low" or higher.
-
Re: Eureka! Running scripts automatically!
yes i already use this way.I didn't post it cause it was a known solution ;)
-
Re: Eureka! Running scripts automatically!
ok maded some extra tests and i have you have to forgive me...
atitude excited seems not to work.In the fact,it worked because i set the advisor in the "only speech" mode...It seems the only real solution right about now.Hope you find something bettter ;)
-
Re: Eureka! Running scripts automatically!
Great discovery HouseOfHam, :2thumbsup:
I have tested it, writting "On_display" in stead of "Script" in the advice line, and it is working fine in our mod.
The scripts are still not automatically lauched, since they need the player to click the advisor's portrait, but it is a BIG step to make the scripts easier to be activated for the players.
I wonder how did you found this "On_display" command, because maybe it exists another commnad that directly executes the script (without clicking on the advisor portrait), like it happens with the descr_strat final line.
I have always missed some kind of guide about the export_descr_advice.txt file, and I think it is a good moment to start researching every possible command/atribute used in the declaration of advices.
I'll join to your efforts to try to find some way to open the advisor portrait automatically. But I use "Attitude Excited" in all my scripts and this is not the solution.
I have also tested with:
-Suppressible
-Uninhibitable
-Verbosity
-Priority
-Attitude
I wonder if somebody knows any other possible value for "Presentation Default"?
Quote:
Yeah, I've never been able to detect the GameReloaded event, either. I don't think they ever implemented it.
We use this even to relaunch the scripts in lotr-tw and it does work. It is triggered so quickly that it does not allow you to launch the advisor with this event, but you can use it as condition to know when the game has been reloaded, and then use the usual events (like characterselected...) to trigger the advisor.
Quote:
atitude excited seems not to work.In the fact,it worked because i set the advisor in the "only speech" mode...It seems the only real solution right about now.Hope you find something bettter ;)
Patrizius, then the scripts are launched completely automatically (without human intervention) when you select "only speech mode"?
-
Re: Eureka! Running scripts automatically!
I was looking through the .exe to see what text strings I could find and came across a section that had a bunch of advice thread keywords and mixed in with them was On_display. It looked a lot like a javascript event handler, so I thought it was promising. Then, I searched export_descr_advice.txt and found it in 2 places in BI where it was used. I put it into TIC and with a little testing and tweaking got it to work.
There is another keyword there which I haven't looked at yet, UseInTutorial
In general, just looking at what error messages are coded in the exe can give a pretty good indication of what the limitations are or what it expects.
-
Re: Eureka! Running scripts automatically!
Quote:
Patrizius, then the scripts are launched completely automatically (without human intervention) when you select "only speech mode"?
yes:2thumbsup:
but we need to find something better for me.I'm also going to test.in three we may reach some results ;)
-
Re: Eureka! Running scripts automatically!
Wow, very smart, I don't know which discovery I like more: on_display is one of the best improvements in scripting that I have seen in long time,
but the possiblity to view all the attributes allowed by the .exe... this is incredibly useful too.
Regretably, it seems the only possible value for presentation is "default".
I'll test now the "only speech mode", good one Patrizius.
-
Re: Eureka! Running scripts automatically!
-
Re: Eureka! Running scripts automatically!
great discover of course and thanks ;)
-
Re: Eureka! Running scripts automatically!
Good work. Keep going and you may even convince me that scripts might be worth considering.... :yes:
-
Re: Eureka! Running scripts automatically!
good to hear this ;) dol_guldur
-
Re: Eureka! Running scripts automatically!
Quote:
Originally Posted by Dol Guldur
Good work. Keep going and you may even convince me that scripts might be worth considering.... :yes:
Hah, RTW without scripts = stone age. :logic:
-
Re: Eureka! Running scripts automatically!
Quote:
Originally Posted by HouseOfHam
Hah, RTW without scripts = stone age. :logic:
i agree with you.but scripts make us :dizzy2:
-
Re: Eureka! Running scripts automatically!
Quote:
Originally Posted by Bardo
The scripts are still not automatically lauched, since they need the player to click the advisor's portrait, but it is a BIG step to make the scripts easier to be activated for the players.
When starting a new campaign, it should be launched automatically, if you followed my directions exactly.
Quote:
Originally Posted by Bardo
I have also tested with:
-Suppressible
-Uninhibitable
-Verbosity
-Priority
-Attitude
I've also looked into what the Parameter values are used for, but AFAICT the functionality they offer is redundant if you already use a background script.
Quote:
Originally Posted by Bardo
We use this even to relaunch the scripts in lotr-tw and it does work. It is triggered so quickly that it does not allow you to launch the advisor with this event, but you can use it as condition to know when the game has been reloaded, and then use the usual events (like characterselected...) to trigger the advisor.
Some mods have a problem where the script does not work correctly if you reload a saved game or start a new campaign without completely restarting the program. Perhaps, it could be used to fix that problem and terminate the previous version of the script.
-
Re: Eureka! Running scripts automatically!
Although I did not use scripts in GAFM, Aradan did work on the advice thread for me. It triggers when certain ancs are lost or when certain characters (or rather their traits) are killed.
He can probably tell you more about that, but I did notice that sometimes the advisor did not always show. I think - and I noticed this with perfect spy too - that when you quit the game using alt+f4 (as most modders will to save time) it can interfere with it. I also noticed that having the automatic settlement government option checked interfered with perfect spy too.
There's an option in the actual game to "reset" the advisor but I never could work out what that actually changed if you used it ;)
Although I'm probably somewhat known for promoting and recommending modfoldering, I actually resisted it when it was first revealed and succesfully implemented because it had seming loop holes in it. These were quickly overcome by researchers and I then used (and improved) it to where it is today. I still see loop holes in scripting which is why I do not support it - or at least its heavy use (and I think FATW is the better for it imho) - but (as I implied before) your work here is overcoming some of those loop holes for me so kudos to you all :laugh4:
I of course realize that some mods - many mods perhaps - need certain things to happen (historical accuracy and so forth) and so scripting is important. I am actually looking into a script at present to overcome an issue that no one else seems to have addressed (which is really quite strange seeing as it is a huge gap in the gameplay) but I may ask a little help from some of you soon on the matter as it ties in with this thread :)