-- main.c run when dink is started

function main()
    -- let's initialize all our globals first.........
    -- These globals are REQUIRED by dink.exe (it directly uses them)

    global.create("exp", 0)
    global.create("strength", 1)
    global.create("defense", 0)
    global.create("cur_weapon", 0)
    global.create("cur_magic", 0)
    global.create("gold", 0)
    global.create("magic", 0)
    global.create("magic_level", 0)
    global.create("vision", 0)
    global.create("result", 0)
    global.create("lifemax", 10)
    global.create("life", 10)
    global.create("level", 1)
    global.create("player_map", 0)
    global.create("last_text", 0)
    global.create("update_status", 0)
    global.create("missile_target", 0)
    global.create("missle_source", 0)
    global.create("enemy_sprite", 0)
    global.create("magic_cost", 0)

    -- the 2 below aren't really required, but used for many default scripts, so best to leave them here.
    global.create("save_x", 0)
    global.create("save_y", 0)

    -- Add your own globals here - Best to stick to the total of 200 for compatibility in all Dink Engines
    global.create("story", 0)

    -- Autoincludes are scripts that are included in every other Lua script
    autoinclude("cutscene", "_cutscene")

    -- If Dink had herb boots armed, let's reset his speed.
    player:set_speed(3)
    player.frame_delay = 0

    -- If Dink had a weapon armed, let's reset the graphics to fists.
    dink.init([[load_sequence_now graphics\dink\walk\ds-w1- 71 43 38 72 -14 -9 14 9]])
    dink.init([[load_sequence_now graphics\dink\walk\ds-w2- 72 43 37 69 -13 -9 13 9]])
    dink.init([[load_sequence_now graphics\dink\walk\ds-w3- 73 43 38 72 -14 -9 14 9]])
    dink.init([[load_sequence_now graphics\dink\walk\ds-w4- 74 43 38 72 -12 -9 12 9]])
    dink.init([[load_sequence_now graphics\dink\walk\ds-w6- 76 43 38 72 -13 -9 13 9]])
    dink.init([[load_sequence_now graphics\dink\walk\ds-w7- 77 43 38 72 -12 -10 12 10]])
    dink.init([[load_sequence_now graphics\dink\walk\ds-w8- 78 43 37 69 -13 -9 13 9]])
    dink.init([[load_sequence_now graphics\dink\walk\ds-w9- 79 43 38 72 -14 -9 14 9]])
    dink.init([[load_sequence_now graphics\dink\idle\ds-i2- 12 250 33 70 -12 -9 12 9]])
    dink.init([[load_sequence_now graphics\dink\idle\ds-i4- 14 250 30 71 -11 -9 11 9]])
    dink.init([[load_sequence_now graphics\dink\idle\ds-i6- 16 250 36 70 -11 -9 11 9]])
    dink.init([[load_sequence_now graphics\dink\idle\ds-i8- 18 250 32 68 -12 -9 12 9]])
    dink.init([[load_sequence_now graphics\dink\hit\normal\ds-h2- 102 75 60 72 -19 -9 19 9]])
    dink.init([[load_sequence_now graphics\dink\hit\normal\ds-h4- 104 75 61 73 -19 -10 19 10]])
    dink.init([[load_sequence_now graphics\dink\hit\normal\ds-h6- 106 75 58 71 -18 -10 18 10]])
    dink.init([[load_sequence_now graphics\dink\hit\normal\ds-h8- 108 75 61 71 -19 -10 19 10]])

    dink.debug("Dink started. Time to fight for your right to party.")

    dink.kill_this_task()
end
