I've been toying around with the AI code some more and I've added a working compiler for my pseudocode
.
I can now make bytecode but I still haven't injected it into the dat files yet as I'd need to patch some offsets in.
In addition to this I've added if/else parsing to turn code like this:
self.varDC = 0
self.varDD = 0
self.varDE = 0
if (character.alive == 3) {
movesay(1)
if (character.alive == 0) {
movesay(6)
}
else {
if (character.alive == 1) {
movesay(8)
}
else {
if (character.alive == 5) {
movesay(9)
}
else {
if (character.alive == 2) {
movesay(10)
}
else {
if (character.alive == 4) {
movesay(11)
}
}
}
}
}
}
else {
if (character.alive == 1) {
movesay(2)
if (character.alive == 0) {
movesay(6)
}
else {
if (character.alive == 3) {
movesay(7)
}
else {
if (character.alive == 5) {
movesay(9)
}
else {
if (character.alive == 2) {
movesay(10)
}
else {
if (character.alive == 4) {
movesay(11)
}
}
}
}
}
}
else {
if (character.alive == 5) {
movesay(3)
if (character.alive == 0) {
movesay(6)
}
else {
if (character.alive == 3) {
movesay(7)
}
else {
if (character.alive == 1) {
movesay(8)
}
else {
if (character.alive == 2) {
movesay(10)
}
else {
if (character.alive == 4) {
movesay(11)
}
}
}
}
}
}
else {
if (character.alive == 2) {
movesay(4)
if (character.alive == 0) {
movesay(6)
}
else {
if (character.alive == 3) {
movesay(7)
}
else {
if (character.alive == 1) {
movesay(8)
}
else {
if (character.alive == 5) {
movesay(9)
}
else {
if (character.alive == 4) {
movesay(11)
}
}
}
}
}
}
else {
if (character.alive == 0) {
movesay(0)
if (character.alive == 3) {
movesay(7)
}
else {
if (character.alive == 1) {
movesay(8)
}
else {
if (character.alive == 5) {
movesay(9)
}
else {
if (character.alive == 2) {
movesay(10)
}
else {
if (character.alive == 4) {
movesay(11)
}
}
}
}
}
}
else {
movesay(5)
if (character.alive == 0) {
movesay(6)
}
else {
if (character.alive == 3) {
movesay(7)
}
else {
if (character.alive == 1) {
movesay(8)
}
else {
if (character.alive == 5) {
movesay(9)
}
else {
if (character.alive == 2) {
movesay(10)
}
}
}
}
}
}
}
}
}
}
movesay(12)
movesay(13)
unknown1C(4)
into this:
self.varDC = 0
self.varDD = 0
self.varDE = 0
if (character.alive == 3) {
movesay(1)
if (character.alive == 0) {
movesay(6)
}
else if (character.alive == 1) {
movesay(8)
}
else if (character.alive == 5) {
movesay(9)
}
else if (character.alive == 2) {
movesay(10)
}
else if (character.alive == 4) {
movesay(11)
}
}
else if (character.alive == 1) {
movesay(2)
if (character.alive == 0) {
movesay(6)
}
else if (character.alive == 3) {
movesay(7)
}
else if (character.alive == 5) {
movesay(9)
}
else if (character.alive == 2) {
movesay(10)
}
else if (character.alive == 4) {
movesay(11)
}
}
else if (character.alive == 5) {
movesay(3)
if (character.alive == 0) {
movesay(6)
}
else if (character.alive == 3) {
movesay(7)
}
else if (character.alive == 1) {
movesay(8)
}
else if (character.alive == 2) {
movesay(10)
}
else if (character.alive == 4) {
movesay(11)
}
}
else if (character.alive == 2) {
movesay(4)
if (character.alive == 0) {
movesay(6)
}
else if (character.alive == 3) {
movesay(7)
}
else if (character.alive == 1) {
movesay(8)
}
else if (character.alive == 5) {
movesay(9)
}
else if (character.alive == 4) {
movesay(11)
}
}
else if (character.alive == 0) {
movesay(0)
if (character.alive == 3) {
movesay(7)
}
else if (character.alive == 1) {
movesay(8)
}
else if (character.alive == 5) {
movesay(9)
}
else if (character.alive == 2) {
movesay(10)
}
else if (character.alive == 4) {
movesay(11)
}
}
else {
movesay(5)
if (character.alive == 0) {
movesay(6)
}
else if (character.alive == 3) {
movesay(7)
}
else if (character.alive == 1) {
movesay(8)
}
else if (character.alive == 5) {
movesay(9)
}
else if (character.alive == 2) {
movesay(10)
}
}
movesay(12)
movesay(13)
unknown1C(4)
In addition to this, the editor now has better highlighting and line numbering due to the use of ScintillaNET.
I'm not really sure what to do with the tool though since it's tied into Ifrit at the moment.
I guess there's a few things I could do:
a) pull out the code and put it in a standalone application
b) speak to the person who wrote Ifrit and try to get it put into the main release
c) fork Ifrit (although I don't really want to do this one)
What do you guys think?