Skip to content

Instantly share code, notes, and snippets.

@allanon
Last active September 20, 2016 17:01
Show Gist options
  • Select an option

  • Save allanon/1f23aae9387ff021214269dfc8bfe0ef to your computer and use it in GitHub Desktop.

Select an option

Save allanon/1f23aae9387ff021214269dfc8bfe0ef to your computer and use it in GitHub Desktop.
A new items_control.txt format, a new plugin for parsing the data in it, and an upgrade path for the old file.

items_control_upgrade.pl plugin

Manage the upgrade path from the old items_control.txt to items_control_new.txt.

  1. On load, check whether a control/items_control.txt file exists and has uncommented lines in it. If so:
  2. If a control/items_control_new.txt file already exists, display a warning, then go to step 2.
  3. If a control/items_control_old.txt file already exists, display a warning, then go to step 2.
  4. Display a message to the user, offering to upgrade the control/items_control.txt file to control/items_control_new.txt. If the user DOES NOT accept, go to step 2.
  5. Rename control/items_control.txt to control/items_control.txt.old.
  6. Load control/items_control.txt.old and convert the contents to the correct format for control/items_control_new.txt.
  7. Save control/items_control_new.txt.
  8. Create a control/items_control.txt file containing only a comment letting the user know that they should use control/items_control_new .txt instead. For example: "# NOTE: This file was renamed to items_control.txt.old on 2016-09-20 at 09:37:19, by the items_control_upgrade.pl plugin. The settings in this file should now be managed in items_control_new.txt instead. DO NOT EDIT THIS FILE, PLEASE."
  9. Go to step 2.
  10. Automatically unload the items_control_upgrade.pl plugin.

items_control_new.pl plugin

Parse the control/items_control_new.txt file, which contains:

  • pickupitems.txt settings
  • items_control.txt settings
  • buyAuto settings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment