Why won't my script run properly?
The first part of my script is the 4 turns a year piece by Mydral (spelling...), and that part of the script works fine, but then I get into the part where I want the AI to get some extra cash, and it doesn't appear to be working (at least not in Romeshell).
"script
suspend_during_battle on
console_command date -272
console_command season summer
while I_TurnNumber = 0
suspend_unscripted_advice true
end_while
....
declare_counter loop
set_counter loop 0
monitor_event FactionTurnStart Treasury < 10000
and FactionType romans_julii
and not I_LocalFaction romans_juli
console_command add_money roman_julii, 10000
end_monitor
while I_CompareCounter loop = 0
end_while
end_script"
The triggers and seasons work fine, but why won't the money script work? When I open Romeshell it doesn't show any money being added, is there another way I can check? If I remove the "not" from "and not I_LocalFaction romans_juli", will it give the money to me?
Please help. Thanks.
Re: Why won't my script run properly?
Yes, removing the not will add the money to your own treasury when you're playing as the Julii.
As to making it work, the multiple seasons should pretty much always go at the bottom of your background script.
So try something like this:
Code:
script
;declare counters
suspend_during_battle on
declare_counter loop
set_counter loop 0
;money script
monitor_event FactionTurnStart Treasury < 10000
and FactionType romans_julii
and not I_LocalFaction romans_juli
console_command add_money roman_julii, 10000
end_monitor
;Multiple seasons
console_command date -272
console_command season summer
while I_TurnNumber = 0
suspend_unscripted_advice true
end_while
....
while I_CompareCounter loop = 0
end_while
end_script
Re: Why won't my script run properly?
Be careful with romans_julii
if the text in the post is directly copied from script.
Re: Why won't my script run properly?
Thank you both. Any reason why the season script should be below?
Re: Why won't my script run properly?
Because the season script pauses in between turns, so anything after or in the middle of the season script only happens after that turn is reached.
Once you declare a monitor, it continually checks the conditions, so you can declare a monitor at the top of the script and it will keep checking throughout the running of the script.
So a general scripting tip would be to put monitors and starting commands at the top, then put while loops at the bottom in a logical order.
Re: Why won't my script run properly?
Arg, so I put the money script up top, and the seasons below, but now when I click on a settlement to activate the script, the advisor pops up but the "Show me how" button is greyed out, oddly it didn't do that when the seasons were on top.
I read Monk's fix in another thread, but I can't get it to work properly. Could someone please explain how to get the button working properly?
Re: Why won't my script run properly?
Greyed out button means that there is some fatal error in your script file and RTW wont allow to use it.
Launch RTW with -show_err command and on RTW exit you will get information what is wrong.
Go and fix it.
Re: Why won't my script run properly?
"script error in data/scripts\show_me\A_script.txt at line 7041, column 1
don't recognize this token: end_script"
What's the deal?
EDIT: I think I fixed it.
Re: Why won't my script run properly?
Ok, it works, I'd like to thank everyone in this thread for helping me through it.
Thanks.