Log in

View Full Version : Why won't my script run properly?



fallen851
02-16-2006, 06:55
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.

Epistolary Richard
02-16-2006, 08:25
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:



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

Monkwarrior
02-16-2006, 09:23
Be careful with romans_julii
if the text in the post is directly copied from script.

fallen851
02-16-2006, 17:53
Thank you both. Any reason why the season script should be below?

Myrddraal
02-16-2006, 18:34
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.

fallen851
02-16-2006, 20:36
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?

LorDBulA
02-16-2006, 21:32
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.

fallen851
02-16-2006, 22:36
"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.

fallen851
02-16-2006, 23:45
Ok, it works, I'd like to thank everyone in this thread for helping me through it.

Thanks.