a_bertrand Posted July 25, 2012 Posted July 25, 2012 Some of you was looking for a tutorial how to convert McCode V2 mods to NWE. I thought, maybe it is possible to at least partially help the conversion, therefore I started to write down a little tool to help you guys. It will not produce a good NWE mod and I would say that most of the time the conversion made by the tool will not work, yet it helps for the first and most annoying steps like changing all the $db->query into $db->Execute and such. The project is pretty much experimental, and may very well be improved over time, yet it's a start point: http://www.nw-engine.com/index.php?c=mc2_converter So what is supported: - $userid => $userID - $ir['something'] => $userStats['something']->value - removes the include of global.php - removes the $h->endpage - mysql_query('something') => $db->Execute('something') - $db->query('something') => $db->Execute('something') - mysql_insert_id => $db->LastId() - mysql_num_rows($q) => $q->NbRows - $db->num_rows($q) => $q->NbRows - item_add(...) => Item::InventoryAdd(...) - item_remove(...) => Item::IventoryRemove(...) - event_add(...) => SotrePersonalLog(...) - Adds the Translate function around the echo and print strings. So, for the time being, that's what it does. More functions can be added and things like get_rank can be either implemented as additional function automatically added to the converted code or an equivalent function can be added to the engine itself. What it doesn't do: - Convert the links / buttons - Put the query values as parameters of the $db->Execute - Uses the table header / table footer - Generates the menu.php or whatever other files - Convert the db structure Let me know if you find it any useful, but don't expect to simply copy / paste your code there and have your mod fully working for NWE. Quote
rulerofzu Posted July 25, 2012 Posted July 25, 2012 This will help some quite a lot. My tutorial will still appear however its peak season for me at my shop plus events/festivals at weekends so im doing what i can when i can. I had a look at this and indeed dont expect a cut and paste job you will need to work through the conversion as on my test it also stripped out some = signs among other things. But it will give you a good idea on how to change. Until my tutorial appears then feel free to drop me a message if you wish if you get stuck or add to the post here Quote
a_bertrand Posted July 25, 2012 Author Posted July 25, 2012 Well tell me what it removed, as it's certainly some bug on my side. It should not break too much your code ;) Quote
rulerofzu Posted July 25, 2012 Posted July 25, 2012 Just ran through it again and your adding \ before double and single quotes It was removing = signs yesterday which didnt occur today. Quote
a_bertrand Posted July 25, 2012 Author Posted July 25, 2012 I don't see any \ before single and double quotes, can you give me a source code examples where this happens? Quote
rulerofzu Posted July 25, 2012 Posted July 25, 2012 Hmm odd ran it again didnt do it that time. I did have it in the browser from yesterday so could have been it I suspect you changed it slightly. Quote
a_bertrand Posted July 25, 2012 Author Posted July 25, 2012 OO yes I changed it this morning with a newer version with less bugs ;) Quote
a_bertrand Posted July 25, 2012 Author Posted July 25, 2012 I managed to implement yet another piece inside the mod converter. It shall add the Translate function around string which are used for echo or print. It shall extract also variables from it, however it will not keep the HTML outside of the translate yet. I may be able to do that too but for the time being it's not all that bad. Just for that it's 210 lines of code... But I'm happy... it shall handle PHP strings correctly. HEREDOC strings are currently skipped btw. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.