Jump to content

knar

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

knar's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks again xyph, now I just have to figure out how to use those arrays
  2. Wow thanks a lot...regular expressions are beyond me it seems. I'm not sure if this makes a difference in how the code would be written, but the table columns are in this order "partname, description, r1, c1, r2, c2, r3, c3, r4, c4, r5, c5, r6, c6"
  3. if (strpos($line, 'pretty_name') === 0) { $pretty_name = str_replace("pretty_name ", "", $line); # Note - doesn't remove quotes } So the code above will grab just the text following "pretty_name" and put it in the variable $line? Would I then assign $line as array[0] for partname, array[1] for description and so on, then put that all into the database at the end of the loop? I'm also confused because you define $in_resources and $in_item as false, then do "if ($in_item)". Wouldnt it always be false and not do the strpos($line, 'pretty_name') stuff?
  4. I made a PHP/MySQL database site for the sandbox MMO Earthrise (www.play-earthrise.com) but manually entering hundreds of items/quests/NPCs would take an insane amount of time. What I would like to do is write a script, or otherwise extract the data, then put it all into a database automatically. This is a project that was OK'd by the makers of Earthrise, so it's not an attempt to get help with an exploit or other illegal thing. I know it would involve regular expressions, but I have no experience using them or automatically entering large amount of data into a DB. Here is one example of the LUA file, for the Parts. Parts can be recycled into raw resources, and each part turns into the set amount of each resource listed. The columns in the table are partname, description, r1, r2, r3, r4, r5, r6, c1, c2, c3, c4, c5, c6. r1-r6 are resource name (example: zirconium) and c1-c6 are the count or number of that resource you get (example: 39). Some parts only give 1 type of resource, while others give 6, so it needs to identify how many resources it gives instead of looking for 6 every time. I would also need a way to replace underscores "_" with a space " " and remove the escape slashes "\" from the descriptions. This is one entry from the Parts file. r1 would be zirconium, r2=nanoplastic, and r3=regenerative plasteel. c1=39, c2=14, c3=5. item_part 'Servo-Control' || pretty_name 'Servo-Control' cost 81 weight 297 max_stack_size 5 resources || object 'Items\\Ingredients\\Ingredients.lua?Zirconium' count 39 end || object 'Items\\Ingredients\\Ingredients.lua?Nanoplastic' count 14 end || object 'Items\\Ingredients\\Ingredients.lua?Regenerative_Plasteel' count 5 end icon 'Icons\\Items\\Parts\\Part_Servo-Control' description 'Complex control mechanism used to maintain the battlesuit\'s auxiliary movements.' end Any help would be greatly appreciated. I would prefer to be shown how to do it myself so I can set this up for each type of entry, but I wouldn't refuse if someone wrote some code .
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.