any idea why my calendar gives an error?

正在查看此主题的用户

Domovoi

Recruit
插入代码块:
    (0.1, 0, ti_once, [], [(assign,"$month",1)]),
  (0.1, 0, ti_once, [], [(assign,"$year_day",1)]),
  (0.1, 0, ti_once, [], [(assign,"$season",1)]),
  (1.0, 0, (30.0 * 24.0), [eq,"$month",9], [(val_add,"$month",1)]),
  (1.0, 0, (30.0 * 24.0), [eq,"$month",4], [(val_add,"$month",1)]),
  (1.0, 0, (30.0 * 24.0), [eq,"$month",6], [(val_add,"$month",1)]),
  (1.0, 0, (30.0 * 24.0), [eq,"$month",11], [(val_add,"$month",1)]),
  (1.0, 0, (31.0 * 24.0), [eq,"$month",1], [(val_add,"$month",1)]),
  (1.0, 0, (31.0 * 24.0), [eq,"$month",2], [(val_add,"$month",1)]),
  (1.0, 0, (31.0 * 24.0), [eq,"$month",3], [(val_add,"$month",1)]),
  (1.0, 0, (31.0 * 24.0), [eq,"$month",5], [(val_add,"$month",1)]),
  (1.0, 0, (31.0 * 24.0), [eq,"$month",7], [(val_add,"$month",1)]),
  (1.0, 0, (31.0 * 24.0), [eq,"$month",8], [(val_add,"$month",1)]),
  (1.0, 0, (31.0 * 24.0), [eq,"$month",10], [(val_add,"$month",1)]),
  (1.0, 0, (31.0 * 24.0), [eq,"$month",12], [(val_sub,"$month",11)]),
  (1.0, 0, (24.0), [neq,"$year_day",365], [(val_add,"$year_day",1)]),
  (1.0, 0, (24.0), [eq,"$year_day",365], [(val_sub,"$year_day",364)]),
	#seasons
  (1.0, 0, (24.0), [eq,"$year_day",335], [
	(val_sub,"$season",3),
	(tutorial_box,"str_summer"),
	]),
  (1.0, 0, (24.0), [eq,"$year_day",60], [
	(val_add,"$season",1),
	(tutorial_box,"str_autumn"),
	]),
  (1.0, 0, (24.0), [eq,"$year_day",152], [
	(val_add,"$season",1),
	(tutorial_box,"str_winter"),
	]),
  (1.0, 0, (24.0), [eq,"$year_day",244], [
	(val_add,"$season",1),
	(tutorial_box,"str_spring"),
	]),


This spits out an error when i try to compile. I've no idea why, ive gone over it many times and rewritten parts, but to no avail.

The error is as follows.

exporting triggers...
Traceback (most recent call last):
  File "process_dialogs.py", line 157, in ?
    save_triggers(variables,triggers)
  File "process_dialogs.py", line 51, in save_triggers
    save_statement_block(file,trigger[trigger_conditions_pos]  , variable_list)
  File "E:\random art\bushranger\.780\process_operations.py", line 195, in save_
statement_block
    save_statement(ofile,statement,variable_list,local_vars)
  File "E:\random art\bushranger\.780\process_operations.py", line 189, in save_
statement
    ofile.write("%d %d %d %d "%(opcode,operand1,operand2,operand3))
TypeError: int argument required

The rest of the output is completely normal. If anyone could give me an idea of what to look for, it'd be nice...
 
Looks to me like your problem is the use of parentheses, such as "(30.0 * 24.0)" and "(24.0)". For M&B module scripting, parentheses are only used for operations or blocks and shouldn't be thrown in for aesthetics like that.
Just remove those parentheses and it should compile fine.

By the way, the module system is official so questions about it don't technically go in this board. The best place for future such questions would probably be the Mod Makers Q&A thread:
http://forums.taleworlds.com/index.php/topic,6575.0.html
 
Yeah, I could be wrong about that...

Looking back at the code though, I see something I know is a problem. Should have noticed before. Each operation has to be surrounded by either parentheses or brackets and can't be bare within an operation block.
So for instance:
插入代码块:
(1.0, 0, (30.0 * 24.0), [eq,"$month",9], [(val_add,"$month",1)]),
should instead be:
插入代码块:
(1.0, 0, (30.0 * 24.0), [(eq,"$month",9)], [(val_add,"$month",1)]),
 
****, of course. So simple. Thanks man... cant believe that didnt jump out at me.

I know my script is pretty messy anyway :razz:
 
后退
顶部 底部