[Smartai] Eai To Sai Convertor

Greetings,

maybe it’s a stupid idea… But I’ve written a nearly functional EAI->SAI convertor in PHP. I think manual conversions aren’t effective enough, so this should convert the whole creature_ai_scripts table. There are still few things to do, can somebody help me? /emoticons/default_sad.png

Read all comments carefully. Script expects EAI standards. You can run this script without any changes in DB, executing of queries is commented for now, but you will see results on the screen.

TODO:

  • remove continue; (or replace by goto nextAction; if need to skip certain actions) commands from action type switch (cases 17, 27 and 98, QUERIES ARE NOT FILLED PROPERLY IF continue; IS DONE!)

  • check if $target should be set in action type switch where commented

  • check and fix $phaseMask and event_flags calculation

  • replace first zero by 1 (default target type should be self) on line 196

  • all comments should be read and solved

  • improve code (if needed) - maybe id modulo calculation should be replaced by incremented variable because of not meeting EAI TC standars everywhere (something like in case 1 in action type switch)

  • check it, test it and correct it

Edit: uploaded the last version in this post

EAI_to_SAI.php

The idea is nice. If you get to improve it to do a complete conversion it would be great /emoticons/default_smile.png

One of our big wishes is to delete EAI from the core (and DB).

So, go go, don’t give up (like many other did before /emoticons/default_tongue.png)

This would be a very, very nice way to do this properly indeed. I support you!

If you ever have questions how stuff works in SAI or what it should’ve meant in EAI, you can always ask me or any other database developer on either IRC or PM (github/forums).

Hello,

here is a new version. Rows with more then one action in EAI are now splitted into more rows in SAI - only comments are the same on these rows (maybe comments shouldn’t be converted, but should be composed by the script depending on event and action types). I will try to do the last critical point from TODO (implement ACTION_T_SAY, needs also convert creature_ai_texts), but the rest is in your hands. Comments are updated and I think it clearly says what needs to be checked or updated. Please help me with this /emoticons/default_smile.png

Also it needs to be hard visual and/or ingame tested.

Edit: don’t download this version, in the first post is the latest version

EAI_to_SAI.php

Converting creature text sounds like fun :expressionless:

I just have 1 question, why are you using goto to move on to the next loop iteration? thats what continue is for

@subv: Continue was the first command i used here. I don’t know why, but continue didn’t skip the rest of the loop in this script. Maybe it only skipped part of it, but on the end, it printed the query filled by values before the continue and by zeroes after the continue.

@Malcrom: I think nothing can be “bigger fun” then converting creature_ai_scripts /emoticons/default_biggrin.png

Hello there,

here is my last version I think. ACTION_T_SAY and creature_ai_texts conversion implemented. Don’t know how to fix the rest - see TODO. And read comments again please /emoticons/default_smile.png

Edit: little warning, this script expects that EAI scripts meets TC EAI standards

EAI_to_SAI.php

http://www.trinityco…help-us-review/