OpenXcom Forum
OpenXcom Forks => OXCE Bugs => OpenXcom Extended (OXCE) => OXCE Bugs FIXED => Topic started by: zRrr on February 11, 2025, 04:16:09 pm
-
Since 8.0.4 y-script refuses to parse hexadecimal numbers with 'A'-'F' in them. Hex numbers with just decimal digits are fine.
extended:
scripts:
newTurnItem:
- new: INT_0x111
offset: 10
code: |
debug_log "test 0x111" 0x111;
return;
- new: INT_0x1A
offset: 10
code: |
debug_log "test 0x1A" 0x1A;
return;
- new: INT_0xAA
offset: 10
code: |
debug_log "test 0xAA" 0xAA;
return;
- new: INT_0xA000
offset: 10
code: |
debug_log "test 0xA000" 0xA000;
return;
- new: INT__0x1a
offset: 10
code: |
debug_log "test 0x1a" 0x1a;
return;
logs:
[11-02-2025_17-08-14] [ERROR] Error in parsing script 'newTurnItem' for 'Global:INT_0x1A': invalid argument '0x1A' in line: 'debug_log "test 0x1A" 0x1A;' (at 1)
[11-02-2025_17-08-14] [ERROR] for node with code at line 42 in D:/games/_openxcom-extended/user/mods/__int-literals-test/int-literals-test.rul
[11-02-2025_17-08-14] [ERROR]
[11-02-2025_17-08-14] [ERROR] Error in parsing script 'newTurnItem' for 'Global:INT_0xAA': invalid argument '0xA' in line: 'debug_log "test 0xAA" 0xAA;' (at 1)
[11-02-2025_17-08-14] [ERROR] for node with code at line 48 in D:/games/_openxcom-extended/user/mods/__int-literals-test/int-literals-test.rul
[11-02-2025_17-08-14] [ERROR]
[11-02-2025_17-08-14] [ERROR] Error in parsing script 'newTurnItem' for 'Global:INT_0xA000': invalid argument '0xA' in line: 'debug_log "test 0xA000" 0xA000;' (at 1)
[11-02-2025_17-08-14] [ERROR] for node with code at line 54 in D:/games/_openxcom-extended/user/mods/__int-literals-test/int-literals-test.rul
[11-02-2025_17-08-14] [ERROR]
[11-02-2025_17-08-14] [ERROR] Error in parsing script 'newTurnItem' for 'Global:INT__0x1a': invalid argument '0x1a' in line: 'debug_log "test 0x1a" 0x1a;' (at 1)
[11-02-2025_17-08-14] [ERROR] for node with code at line 60 in D:/games/_openxcom-extended/user/mods/__int-literals-test/int-literals-test.rul
-
Ok, I will fix it
-
Just out of curiosity, why do we need the hexadecimal numbers?
-
This is script code, and sometimes if you want squeeze more data into `int` bit mask are useful.
Overall similar like C++, in 99% cases you can live without them, but sometimes are very valuable.
-
Should've used my (https://github.com/Delian0/OpenXcom/commit/da606e21062e31a857a4680119635a35f898a14a) solution :P
-
I prefer to not strongly couple script engine with yaml lib (as it should only be used to load data) but probably need use your version then.
[ps]
I check gotbolt and its show that code should accept upper cases hex, problem could be else where.
-
ok, Its look by bug was elsewhere, my conclusion is that implicit conversion are root of all evil :D
In my tokenizer I miss one check because of typo and implicit conversion still allowing bugged code to compile.
-
Fixed.
https://github.com/MeridianOXC/OpenXcom/commit/08ee0ec32042c626e751d8763563590bea0c5a27