planetmaker@localhost:~/ottd/grfdev$ nmlc -d test_nml.nml Switch, Feature = 0, name = pass_weight_switch Expression: ID: vehicle_type_id Body: Min: Int: 0 Max: Int: 0 Result: Return value: Int: 35 Min: Int: 1 Max: Int: 1 Result: Return value: Int: 70 Min: ID: default Max: ID: default Result: Return value: Int: 0 Switch, Feature = 0, name = pass_weight_checks Expression: ID: grfid Body: Min: Call function: str2number Parameter: String literal: "EN\01\01" Max: Call function: str2number Parameter: String literal: "EN\01\01" Result: Go to block: ID: pass_weight_switch Min: ID: default Max: ID: default Result: Return value: Int: 0 Item, feature 0x0 Property block: Property: weight ID: pass_weight_checks nmlc warning: "test_nml.nml", line 8: Block 'pass_weight_checks' is not referenced, ignoring. nmlc warning: "test_nml.nml", line 2: Block 'pass_weight_switch' is not referenced, ignoring. nmlc ERROR: "test_nml.nml", line 15: Binary operator requires both operands to be integers. planetmaker@localhost:~/ottd/grfdev$ nmlc -s test_nml.nml nmlc warning: "test_nml.nml", line 8: Block 'pass_weight_checks' is not referenced, ignoring. nmlc warning: "test_nml.nml", line 2: Block 'pass_weight_switch' is not referenced, ignoring. nmlc ERROR: "test_nml.nml", line 15: Binary operator requires both operands to be integers. Traceback (most recent call last): File "/home/planetmaker/bin/nmlc", line 6, in main.run() File "/home/planetmaker/ottd/grfdev/nml/nml/main.py", line 425, in run main(sys.argv[1:]) File "/home/planetmaker/ottd/grfdev/nml/nml/main.py", line 170, in main ret = nml(input, input_filename, opts.debug, outputs, opts.start_sprite_num, opts.compress, opts.crop, not opts.no_cache, opts.forced_palette, opts.md5_filename) File "/home/planetmaker/ottd/grfdev/nml/nml/main.py", line 248, in nml tmp_actions = result.get_action_list() File "/home/planetmaker/ottd/grfdev/nml/nml/ast/base_statement.py", line 154, in get_action_list action_list.extend(stmt.get_action_list()) File "/home/planetmaker/ottd/grfdev/nml/nml/ast/item.py", line 98, in get_action_list return base_statement.BaseStatementList.get_action_list(self) File "/home/planetmaker/ottd/grfdev/nml/nml/ast/base_statement.py", line 154, in get_action_list action_list.extend(stmt.get_action_list()) File "/home/planetmaker/ottd/grfdev/nml/nml/ast/item.py", line 169, in get_action_list return action0.parse_property_block(self.prop_list, item_feature, item_id, item_size) File "/home/planetmaker/ottd/grfdev/nml/nml/actions/action0.py", line 661, in parse_property_block value_list_list.extend(parse_property_value(prop_info, prop.value, prop.unit, size_bit) for prop_info in new_prop_info_list) File "/home/planetmaker/ottd/grfdev/nml/nml/actions/action0.py", line 661, in value_list_list.extend(parse_property_value(prop_info, prop.value, prop.unit, size_bit) for prop_info in new_prop_info_list) File "/home/planetmaker/ottd/grfdev/nml/nml/actions/action0.py", line 518, in parse_property_value value = prop_info['value_function'](value) File "/home/planetmaker/ottd/grfdev/nml/nml/actions/action0properties.py", line 179, in low_byte_info = {'num': low_prop, 'size': 1, 'value_function': lambda value: BinOp(nmlop.AND, value, ConstantNumeric(0xFF, value.pos), value.pos).reduce()} File "/home/planetmaker/ottd/grfdev/nml/nml/expression/binop.py", line 77, in reduce self.op.validate_func(expr1, expr2, self.pos) File "/home/planetmaker/ottd/grfdev/nml/nml/nmlop.py", line 100, in validate_func_int raise generic.ScriptError("Binary operator requires both operands to be integers.", pos) nml.generic.ScriptError: "test_nml.nml", line 15: Binary operator requires both operands to be integers. planetmaker@localhost:~/ottd/grfdev$ cd nml planetmaker@localhost:~/ottd/grfdev/nml$ hg pull -u Rufe von http://dev.openttdcoop.org/hg/nml ab echte Adresse ist https://hg.openttdcoop.org/nml Suche nach Ă„nderungen Keine Ă„nderungen gefunden planetmaker@localhost:~/ottd/grfdev/nml$ cd .. planetmaker@localhost:~/ottd/grfdev$ cat test_nml.nml //Sets weight of the passenger carriage based on the engine. switch(FEAT_TRAINS, PARENT, pass_weight_switch, vehicle_type_id) { 0: return 35; 1: return 70; default: return 0; } //Checks for native grfid switch(FEAT_TRAINS, PARENT, pass_weight_checks, grfid) { str2number("EN\01\01"): pass_weight_switch; default: return 0; } //Passenger Car item(FEAT_TRAINS, item_passenger_wagon, 0) { property { weight: pass_weight_checks; } }