Results 1 to 5 of 5

Thread: Scripts not working PLEASE HELP????

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Scripts not working PLEASE HELP????

    OK i am writing a script to alter the kings purse based on number of settlements a faction holds...the script is not running at all...when i check the logs i see two lines involving my script....here they are....

    01:26:19.648 [game.script] [error] Script parsing error at line 4972, column 1 in mods/kingdoms_grand_campaign_mod/data/world/maps/campaign/imperial_campaign/campaign_script.txt
    don't recognise this token: end_monitor
    01:26:19.649 [game.script] [error] Script parsing error at line 4977, column 5 in mods/kingdoms_grand_campaign_mod/data/world/maps/campaign/imperial_campaign/campaign_script.txt
    Couldn't create a script from file mods/kingdoms_grand_campaign_mod/data/world/maps/campaign/imperial_campaign/campaign_script.txt
    And here's my campaign_script....The Blue lines are the lines in question (according to the log)

    monitor_event FactionTurnStart FactionType england
    and FactionIsLocal

    if I_NumberOfSettlements england > 0
    and I_NumberOfSettlements england <= 5
    set_kings_purse england 2500
    end_if

    if I_NumberOfSettlements england > 5
    and I_NumberOfSettlements england <= 10
    set_kings_purse england 5000
    end_if

    if I_NumberOfSettlements england > 10
    and I_NumberOfSettlements england <= 15
    set_kings_purse england 7500
    end_if

    if I_NumberOfSettlements england > 15
    and I_NumberOfSettlements england <= 20
    set_kings_purse england 10000
    end_if

    if I_NumberOfSettlements england > 20
    and I_NumberOfSettlements england <= 25
    set_kings_purse england 12500
    end_if

    if I_NumberOfSettlements england > 25
    set_kings_purse england 15000
    end_monitor

    monitor_event FactionTurnStart FactionType france
    and FactionIsLocal

    if I_NumberOfSettlements france > 0
    and I_NumberOfSettlements france <= 5
    set_kings_purse france 2500
    end_if

    if I_NumberOfSettlements france > 5
    and I_NumberOfSettlements france <= 10
    set_kings_purse france 5000
    end_if

    If you know what the problem is or have ideas then please help....thank you in advance for any assistance.......

  2. #2
    Emperor of Hell's Avatar SPA-NED 1-5
    Join Date
    Jul 2011
    Location
    Netherlands
    Posts
    5,747

    Default Re: Scripts not working PLEASE HELP????

    you should do it like this:
    Code:
    monitor_event FactionTurnStart FactionType england
    and FactionIsLocal
    
    if I_NumberOfSettlements england > 0
    and I_NumberOfSettlements england <= 5
    set_kings_purse england 2500
    end_if
    
    if I_NumberOfSettlements england > 5
    and I_NumberOfSettlements england <= 10
    set_kings_purse england 5000
    end_if
    
    if I_NumberOfSettlements england > 10
    and I_NumberOfSettlements england <= 15
    set_kings_purse england 7500
    end_if
    
    if I_NumberOfSettlements england > 15
    and I_NumberOfSettlements england <= 20
    set_kings_purse england 10000
    end_if
    
    if I_NumberOfSettlements england > 20
    and I_NumberOfSettlements england <= 25
    set_kings_purse england 12500
    end_if
    
    if I_NumberOfSettlements england > 25
    set_kings_purse england 15000
    end_if
    end_monitor
    
    monitor_event FactionTurnStart FactionType france
    and FactionIsLocal
    
    if I_NumberOfSettlements france > 0
    and I_NumberOfSettlements france <= 5
    set_kings_purse france 2500
    end_if
    
    if I_NumberOfSettlements france > 5
    and I_NumberOfSettlements france <= 10
    set_kings_purse france 5000
    end_if

  3. #3

    Default Re: Scripts not working PLEASE HELP????

    workin like a charm....thx
    Last edited by valvegas1; November 06, 2011 at 02:11 AM.

  4. #4

    Default Re: Scripts not working PLEASE HELP????

    Whenever you write long scripts it is very easy to over look the simplest things like forgetting to close an if statement or a minor spelling error. I find that there are certain techniques and guidelines you can use and follow that can help minimize these honest errors. The main one being formatting.

    As an example i try to indent and evenly space/tab certain lines, be it a command line or condition. Try to keep some kind of order as opposed to a box like effect u had in the first post. You will find it reads easier too.

    And given, ur formatting may have changed during posting, but thought i would raise the point anyway

    Code:
    monitor_event FactionTurnStart FactionType england
    	and FactionIsLocal
    
    	if I_NumberOfSettlements england > 20
    		and I_NumberOfSettlements england <= 25
    			set_kings_purse england 12500
    		end_if
    
    	if I_NumberOfSettlements england > 25
    			set_kings_purse england 15000
    		end_if
    
    end_monitor
    The other thing that can help you is using a text editor that uses colours. Which can help minimize spelling mistakes and scripting errors.
    ...longbows, in skilled hands, could reach further than trebuchets...

  5. #5

    Default Re: Scripts not working PLEASE HELP????

    yeah i'm getting the hang of it...plus i found the code to log script errors and such...thanks for the help guys....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •