int argument required problem when compiling build_mod

正在查看此主题的用户

vako

Sergeant at Arms
Ok.  I've spent two weeks setting up new troops, worked out all the crap save this one last glitch.  If anyone knows how I might fix it, I'll be forever grateful.  If it's unfixable I'll scream, cry, swear profusely in several languages, throw sharp, jagged objects at the computer and seriously consider giving up this whole modding thing 'cause losing a month of work gives a body a serious pain in the butt.

The error looks like this: (typed out, because I have lost my screenshots file)
File "process_troops.py", line 19, in save_troops
  file.write("\ntrp_%s %s %s %d %d %d %d\n  "%(convert_to_identifier(troop[0]),replace_spaces(troop[1]),replace_spaces(troop[2]),troop[3],troop[4],troop[5], troop[6]))
TypeError: int argument required

I've: checked other source codes process_troops.py, the line looks exactly the same to me
      recompiled several times, left it over night then recompiled several more times
      tried replacing with native process_troops.py
      tried replacing the line with one copied from native
      in a last ditch effort, made a new mod file and copied over all the new coding, not only did that not fix the problem, but I can't figure out how to export/import maps in Thorgrim's map editor so I get the same map as in the original mod.
      searched the forums and came up with squat.
      checked the Q&A thread and came up with this:

Error:
TypeError: int argument required
Meaning:
Missing an integer such as a mission-template flag. You can find out which calls are integers by looking at Armagan's documentation at the beginning of each module file, (int) calls being integers.

  so I opened up process_ troops and module_troops and checked the documentation which only makes a tiny bit of sense to me.

from header_common import *
from header_items import *
from header_troops import *
from header_skills import *
from ID_factions import *
from ID_items import *
from ID_scenes import *

this I understand, but this:

def wp(x):
  n = 0
  r = 10 + int(x / 10)
  n |= wp_one_handed(x + random.randrange(r))
  n |= wp_two_handed(x + random.randrange(r))
  n |= wp_polearm(x + random.randrange(r))
  n |= wp_archery(x + random.randrange(r))
  n |= wp_crossbow(x + random.randrange(r))
  n |= wp_throwing(x + random.randrange(r))
  return n

I assume has to do with the division of wps.

Checked my codingwith regards to wps.  I can't see anything wrong, and wouldn't it have picked it up before if there had been?  Mind you, I'm coming to the conclusion that I've been looking at this to long.

My only, not particularly hopeful, wild guess is that it might have something to do with adding riding to a troop that already knows common?  But I find this highly unlikely.

Sorry for this rather long post, but I thought I might as well be as thorough as possible without actually including the whole of the new stuff in module_troops.

Please, gods of modding M&B, help me, your most humble and unworthy servant.

Giving up for the day and going to get some lunch and maybe do some Homer,  Vako.


 
 
You mucked up the syntax somewhere. Most likely there's a field missing in one of your tuples. This can be caused by leaving out an entire field, or something as simple as placing a period where a comma should go.

Also, why didn't you post to the Q&A thread?

Hydraulically,
Winter
 
That's a good question.  Why didn't I?  Probably because I'm an idiot and didn't think of it.

It looks like I have another long session of searching for where I screwed up ahead of me.
 
A quick way to narrow it down is the go through your troops file, and comment out blocks until it compiles.  Then un-comment the block, and comment out part of that block.  Repeat until you have found the troop entry causing the problem, then check values 4-7 are correct (all flags, not strings or anything, and that all 4 are there).  I assume you have only added a couple of troops anyway?  So it should be fairly easy to work out which one it is.

Feel free to post the entries that are causing problems if you still can't work it out.
 
后退
顶部 底部