Results 1 to 20 of 20

Thread: Intermediate Guide to Scripting Discussion

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Simulation Monkey Member The_Mark's Avatar
    Join Date
    Dec 2004
    Location
    Helsinki, Finland
    Posts
    2,613

    Default Re: Intermediate Guide to Scripting Discussion

    What you need to get the Trait condition work is an exported character_record, and condition monitors don't export values; you'll need an event monitor, and convenient events to do that are far and few between.

  2. #2
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Intermediate Guide to Scripting Discussion

    I don't think it's possible except through CharacterSelected which involves that the player does something and the character is on the map.
    You might also consider using a show_me

  3. #3

    Default Re: Intermediate Guide to Scripting Discussion

    I have a question regarding scripts.

    I'm trying to get a show_me script to run from a background script, but it doesn't seem to be working. This is similar to the Client Kingdoms mod implemented into the TFT mod. The background script works fine and all other functions within it work as intended. Here is the background script section that is supposed to start the show_me script:

    Code:
    monitor_event SettlementTurnStart SettlementName Rome
    	and SettlementIsLocal
    	and Treasury > 5000
    	advance_advice_thread Recruit_Legion_Thread
    end_monitor
    This is just temporary until I can get it working - then I'll tweak the costs and add a RandomPercent. Here is the advice thread it refers to:

    Code:
    AdviceThread Recruit_Legion_Thread
        GameArea Campaign
        
        Item Recruit_Legion
        		Uninhibitable
        		Verbosity  0 
        		Threshold  1  
        		Attitude Normal
        		Presentation Default
        		Title Recruit_Legion_Title
         	Script scripts\show_me\recruit_roman_legion.txt
    		Text Recruit_Legion_Text1
    And yes, I have set up the text. Finally, here is the whole show_me script:

    Code:
    script
    console_command create_unit Rome "roman hastati" 2
    console_command create_unit Rome "roman princeps" 2
    console_command create_unit Rome "roman velite" 2
    console_command create_unit Rome "roman Triarii" 1
    console_command create_unit Rome "roman light cavalry" 1
    console_command add_money -5000
    console_command add_population Rome -1210
    
    select_ui_element advisor_dismiss_button
    simulate_mouse_click lclick_down
    simulate_mouse_click lclick_up
    
    terminate_script
    end_script
    Can anyone see what I'm doing wrong here? I've tried changing it so that the script runs when Rome is selected using I_SettlementSelected SettlementName Rome but no dice...

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

    Default Re: Intermediate Guide to Scripting Discussion

    Well, perhaps it's a silly answer, but the first possible mistake is "roman Triarii" instead of "roman triarii".

    The second point is that I cannot see the need for a background script only for this purpose. It would be enough with a normal trigger in export_descr_advice, as in Client Kingdoms mod.

    Third point: Did you try the final script without the authomatic "button pressing"?

    You should include some "mark" just to know where the method is failing.

    Good luck!

  5. #5

    Default Re: Intermediate Guide to Scripting Discussion

    When you say not working, does the advisor come up at all? Do you have entries in text\export_advice for that advice thread?
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  6. #6
    Simulation Monkey Member The_Mark's Avatar
    Join Date
    Dec 2004
    Location
    Helsinki, Finland
    Posts
    2,613

    Default Re: Intermediate Guide to Scripting Discussion

    AFAIK RTW doesn't support multiple scripts running side by side; you'll have to include the event script in the background script in an event_monitor ButtonPressed ButtonPressed advisor_button_of_choice (excluding show_me button - no multiple scripts -> no script running -> no registered click on the button, or something to that effect; this limits the button quite surely to advisor_portrait_button).

  7. #7

    Default Re: Intermediate Guide to Scripting Discussion

    Well, perhaps it's a silly answer, but the first possible mistake is "roman Triarii" instead of "roman triarii".
    Didn't think of that. I'll fix it an give it a go.

    The second point is that I cannot see the need for a background script only for this purpose. It would be enough with a normal trigger in export_descr_advice, as in Client Kingdoms mod.
    Sorry, I didn't make it clear. I'm running a background script for a whole lot of things - such as 4tpy, historical events and such. I wanted to add this as a show_me script from the background script as the background script has the "suspend_unscripted_advice true" line added (otherwise I couldn't stop the script from continuously reloading).

    Third point: Did you try the final script without the authomatic "button pressing"?
    Good point, I'll give it a go if the Triarii typo doesn't fix it.

    You should include some "mark" just to know where the method is failing.
    Not entirely sure what you mean, or how to do it.

    When you say not working, does the advisor come up at all? Do you have entries in text\export_advice for that advice thread?
    Advisor doesn't even come up. Yes, as I said earlier, I have the text set up properly.

    Thanks for the help, guys, I'll give the script another go with a few changes.

    AFAIK RTW doesn't support multiple scripts running side by side; you'll have to include the event script in the background script in an event_monitor ButtonPressed ButtonPressed advisor_button_of_choice (excluding show_me button - no multiple scripts -> no script running -> no registered click on the button, or something to that effect; this limits the button quite surely to advisor_portrait_button).
    Good point, but I could have sworn that the TFT mod made this work...
    Last edited by Cheexsta; 12-07-2005 at 14:52.

  8. #8

    Default Re: Intermediate Guide to Scripting Discussion

    Quote Originally Posted by Cheexsta
    Not entirely sure what you mean, or how to do it.
    He means put something in the background script monitor or the script so you'll be able to see if its even being accessed. The discerning scripter uses the infamous console_command puppify_my_love for the purpose, for example:

    Code:
    monitor_event SettlementTurnStart SettlementName Rome and SettlementIsLocal and Treasury > 5000 console_command puppify_my_love advance_advice_thread Recruit_Legion_Thread end_monitor


    If your faction symbol turns into a puppy when you fulfil those criteria then you at least know that that monitor is being accessed.



    And Mark, I'm pretty sure you can run a show_me script during the campaign script of the Prologue. Guy made a special mention of how difficult it had been to get the two running at the same time.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  9. #9
    Simulation Monkey Member The_Mark's Avatar
    Join Date
    Dec 2004
    Location
    Helsinki, Finland
    Posts
    2,613

    Default Re: Intermediate Guide to Scripting Discussion

    Hmm. I remember Guy stating that RTW didn't support multiple scripts at all, though I could very well be mistaken. Have you tried declare_show_me command, if that'd affect it?

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