| 1 | local getopt = require('getopt') |
| 2 | |
| 3 | example = "script run remagic" |
| 4 | author = "Iceman" |
| 5 | |
| 6 | desc = |
| 7 | [[ |
| 8 | This is a script that tries to bring back a chinese magic card (1k generation1) |
| 9 | from the dead when it's block 0 has been written with bad values. |
| 10 | |
| 11 | Arguments: |
| 12 | -h this help |
| 13 | ]] |
| 14 | --- |
| 15 | -- A debug printout-function |
| 16 | function dbg(args) |
| 17 | if DEBUG then |
| 18 | print("###", args) |
| 19 | end |
| 20 | end |
| 21 | --- |
| 22 | -- This is only meant to be used when errors occur |
| 23 | function oops(err) |
| 24 | print("ERROR: ",err) |
| 25 | end |
| 26 | |
| 27 | --- |
| 28 | -- Usage help |
| 29 | function help() |
| 30 | print(desc) |
| 31 | print("Example usage") |
| 32 | print(example) |
| 33 | end |
| 34 | |
| 35 | --- |
| 36 | -- The main entry point |
| 37 | function main(args) |
| 38 | |
| 39 | |
| 40 | -- Read the parameters |
| 41 | for o, a in getopt.getopt(args, 'h') do |
| 42 | if o == "h" then help() return end |
| 43 | end |
| 44 | |
| 45 | local _cmds = { |
| 46 | --[[ |
| 47 | --]] |
| 48 | [0] = "hf 14a raw -p -a -b 7 40", |
| 49 | [1] = "hf 14a raw -p -a 43", |
| 50 | [2] = "hf 14a raw -c -p -a A000", |
| 51 | [3] = "hf 14a raw -c -p -a 01 02 03 04 04 98 02 00 00 00 00 00 00 00 10 01", |
| 52 | } |
| 53 | core.clearCommandBuffer() |
| 54 | |
| 55 | local i |
| 56 | --for _,c in pairs(_cmds) do |
| 57 | for i = 0, 3 do |
| 58 | print ( _cmds[i] ) |
| 59 | core.console( _cmds[i] ) |
| 60 | end |
| 61 | end |
| 62 | |
| 63 | main(args) |