Page 1 of 2 12 LastLast
Results 1 to 30 of 53

Thread: Eureka! Running scripts automatically!

  1. #1

    Default 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.
    Last edited by HouseOfHam; 06-23-2008 at 20:40.
    RTR VII Developer

  2. #2
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Eureka! Running scripts automatically!

    And for reloading a saved game?

  3. #3
    Death and Glory TW modder Member Flying Pig's Avatar
    Join Date
    Dec 2007
    Location
    Looking for a place to land...
    Posts
    313

    Default 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?
    Last edited by Flying Pig; 05-28-2008 at 12:21.
    Death And Glory TW Needs You - Sign Up Now! All it takes is one PM!

    Ὦ ξεῖν', ἀγγέλλειν Λακεδαιμονίοις ὅτι τῇδε
    κείμεθα, τοῖς κείνων ῥήμασι πειθόμενοι.

    Ō zein', angellein Lakedaimoniois hoti tēide
    keimetha tois keinōn rhēmasi peithomenoi.

    Go, thou that passeth, to the Spartans tell
    That as per their orders, here we fell.

  4. #4
    Anything that isn't 'member' Member Squid's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    596

    Default Re: Eureka! Running scripts automatically!

    Quote Originally Posted by Monkwarrior
    And for reloading a saved game?
    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.

    -Trait/Ancillary/Building Editor

    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the universe." -----Albert Einstein

  5. #5
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default 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.

    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.

  6. #6

    Default 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. :)
    Last edited by HouseOfHam; 05-28-2008 at 20:56.
    RTR VII Developer

  7. #7
    Indiana Jones of Modding! Member Patrizius's Avatar
    Join Date
    Oct 2007
    Posts
    103

    Default 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

    in the script write:
    suspend_unscripted_advice true

    this way no more advice will be displayed.ANd

    We you load a game you will have your script activated.
    and if you reload,it will reativate again

    Great work HouseOfHam
    Ideator,Scripter and Team Leader of RES BELLICAE modding project.Come visit us on http://www.twcenter.net/forums/forumdisplay.php?f=603

  8. #8

    Default 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.
    RTR VII Developer

  9. #9
    Indiana Jones of Modding! Member Patrizius's Avatar
    Join Date
    Oct 2007
    Posts
    103

    Default 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 ;)
    Ideator,Scripter and Team Leader of RES BELLICAE modding project.Come visit us on http://www.twcenter.net/forums/forumdisplay.php?f=603

  10. #10
    Indiana Jones of Modding! Member Patrizius's Avatar
    Join Date
    Oct 2007
    Posts
    103

    Default 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 ),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
    Ideator,Scripter and Team Leader of RES BELLICAE modding project.Come visit us on http://www.twcenter.net/forums/forumdisplay.php?f=603

  11. #11

    Default 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.
    RTR VII Developer

  12. #12
    Indiana Jones of Modding! Member Patrizius's Avatar
    Join Date
    Oct 2007
    Posts
    103

    Default 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
    Ideator,Scripter and Team Leader of RES BELLICAE modding project.Come visit us on http://www.twcenter.net/forums/forumdisplay.php?f=603

  13. #13
    Indiana Jones of Modding! Member Patrizius's Avatar
    Join Date
    Oct 2007
    Posts
    103

    Default Re: Eureka! Running scripts automatically!

    i have reaad just now.i solved that problem .please tell me if you find something new.;)
    Last edited by Patrizius; 05-29-2008 at 19:42.
    Ideator,Scripter and Team Leader of RES BELLICAE modding project.Come visit us on http://www.twcenter.net/forums/forumdisplay.php?f=603

  14. #14

    Default 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?
    Last edited by HouseOfHam; 05-29-2008 at 19:46.
    RTR VII Developer

  15. #15
    Indiana Jones of Modding! Member Patrizius's Avatar
    Join Date
    Oct 2007
    Posts
    103

    Default 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 :( ...
    Ideator,Scripter and Team Leader of RES BELLICAE modding project.Come visit us on http://www.twcenter.net/forums/forumdisplay.php?f=603

  16. #16

    Default 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.
    RTR VII Developer

  17. #17
    Indiana Jones of Modding! Member Patrizius's Avatar
    Join Date
    Oct 2007
    Posts
    103

    Default Re: Eureka! Running scripts automatically!

    yes i already use this way.I didn't post it cause it was a known solution ;)
    Ideator,Scripter and Team Leader of RES BELLICAE modding project.Come visit us on http://www.twcenter.net/forums/forumdisplay.php?f=603

  18. #18
    Indiana Jones of Modding! Member Patrizius's Avatar
    Join Date
    Oct 2007
    Posts
    103

    Default 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 ;)
    Ideator,Scripter and Team Leader of RES BELLICAE modding project.Come visit us on http://www.twcenter.net/forums/forumdisplay.php?f=603

  19. #19

    Default Re: Eureka! Running scripts automatically!

    Great discovery HouseOfHam,
    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"?


    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.

    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"?
    Last edited by Bardo; 05-30-2008 at 18:24.

  20. #20

    Default 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.
    RTR VII Developer

  21. #21
    Indiana Jones of Modding! Member Patrizius's Avatar
    Join Date
    Oct 2007
    Posts
    103

    Default Re: Eureka! Running scripts automatically!


    Patrizius, then the scripts are launched completely automatically (without human intervention) when you select "only speech mode"?

    yes

    but we need to find something better for me.I'm also going to test.in three we may reach some results ;)
    Ideator,Scripter and Team Leader of RES BELLICAE modding project.Come visit us on http://www.twcenter.net/forums/forumdisplay.php?f=603

  22. #22

    Default 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.

  23. #23
    Indiana Jones of Modding! Member Patrizius's Avatar
    Join Date
    Oct 2007
    Posts
    103

    Default Re: Eureka! Running scripts automatically!

    great topic!
    Ideator,Scripter and Team Leader of RES BELLICAE modding project.Come visit us on http://www.twcenter.net/forums/forumdisplay.php?f=603

  24. #24
    Indiana Jones of Modding! Member Patrizius's Avatar
    Join Date
    Oct 2007
    Posts
    103

    Default Re: Eureka! Running scripts automatically!

    great discover of course and thanks ;)
    Ideator,Scripter and Team Leader of RES BELLICAE modding project.Come visit us on http://www.twcenter.net/forums/forumdisplay.php?f=603

  25. #25
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: Eureka! Running scripts automatically!

    Good work. Keep going and you may even convince me that scripts might be worth considering....
    "One of the most sophisticated Total War mods ever developed..."

  26. #26
    Indiana Jones of Modding! Member Patrizius's Avatar
    Join Date
    Oct 2007
    Posts
    103

    Default Re: Eureka! Running scripts automatically!

    good to hear this ;) dol_guldur
    Ideator,Scripter and Team Leader of RES BELLICAE modding project.Come visit us on http://www.twcenter.net/forums/forumdisplay.php?f=603

  27. #27

    Default 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....
    Hah, RTW without scripts = stone age.
    RTR VII Developer

  28. #28
    Indiana Jones of Modding! Member Patrizius's Avatar
    Join Date
    Oct 2007
    Posts
    103

    Default Re: Eureka! Running scripts automatically!

    Quote Originally Posted by HouseOfHam
    Hah, RTW without scripts = stone age.
    i agree with you.but scripts make us
    Ideator,Scripter and Team Leader of RES BELLICAE modding project.Come visit us on http://www.twcenter.net/forums/forumdisplay.php?f=603

  29. #29

    Default 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.
    RTR VII Developer

  30. #30
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default 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

    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 :)
    "One of the most sophisticated Total War mods ever developed..."

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO