function template(project)
local dlg = Wizard()
dlg.text = "Elecbyte Player - Auto DEF"
-- Page 1 -- Character Information --
local page1 = WizardPage()
page1.title = dlg.text
page1.subTitle = "Character Information"
dlg:addPage(page1)
local lay1 = BoxLayout(BoxLayout.Vertical)
page1.layout = lay1
lay1:addWidget(Label("Character Name", page1))
local name = lay1:addWidget(TextEdit(page1))
name.text = "Name"
lay1:addWidget(Label("Character Display Name", page1))
local displayname = lay1:addWidget(TextEdit(page1))
displayname.text = "Name in Game"
lay1:addWidget(Label("Author Name", page1))
local author = lay1:addWidget(TextEdit(page1))
author.text = "Maker Name"
lay1:addWidget(Label("Character Resolution", page1))
local localcoord = lay1:addWidget(TextEdit(page1))
localcoord.text = "320,240"
-- Page 2 -- Pal Number --
local page2 = WizardPage()
page2.title = dlg.text
page2.subTitle = "Palette Number"
dlg:addPage(page2)
local lay2 = BoxLayout(BoxLayout.Vertical)
page2.layout = lay2
lay2:addWidget(Label("Quantity (0 will be considered 1 and 13+ will be considered 12)", page1))
local palnumber = lay2:addWidget(IntEdit(page2))
-- Generate template --
if dlg:show() == Dialog.Accepted then
local text = [==[
;Erase all the text before this
[Info]
Name = "@name"
DisplayName = "@displayname"
VersionDate =
MugenVersion =
Author = "@author"
LocalCoord = @localcoord
Pal.Defaults = 1
[Files]
cmd = @name.cmd
cns = @name.cns
st = @name.cns
stcommon = common1.cns
sprite = @name.sff
anim = @name.air
;sound = @name.snd
@pal1
@pal2
@pal3
@pal4
@pal5
@pal6
@pal7
@pal8
@pal9
@pal10
@pal11
@pal12]==]
if (palnumber.value >= 12) then
text = text:gsub("@pal12", "Pal12 = @name12.act")
else
text = text:gsub("@pal12", ";Pal12")
end
if (palnumber.value >= 11) then
text = text:gsub("@pal11", "Pal11 = @name11.act")
else
text = text:gsub("@pal11", ";Pal11")
end
if (palnumber.value >= 10) then
text = text:gsub("@pal10", "Pal10 = @name10.act")
else
text = text:gsub("@pal10", ";Pal10")
end
if (palnumber.value >= 9) then
text = text:gsub("@pal9", "Pal9 = @name9.act")
else
text = text:gsub("@pal9", ";Pal9")
end
if (palnumber.value >= 8) then
text = text:gsub("@pal8", "Pal8 = @name8.act")
else
text = text:gsub("@pal8", ";Pal8")
end
if (palnumber.value >= 7) then
text = text:gsub("@pal7", "Pal7 = @name7.act")
else
text = text:gsub("@pal7", ";Pal7")
end
if (palnumber.value >= 6) then
text = text:gsub("@pal6", "Pal6 = @name6.act")
else
text = text:gsub("@pal6", ";Pal6")
end
if (palnumber.value >= 5) then
text = text:gsub("@pal5", "Pal5 = @name5.act")
else
text = text:gsub("@pal5", ";Pal5")
end
if (palnumber.value >= 4) then
text = text:gsub("@pal4", "Pal4 = @name4.act")
else
text = text:gsub("@pal4", ";Pal4")
end
if (palnumber.value >= 3) then
text = text:gsub("@pal3", "Pal3 = @name3.act")
else
text = text:gsub("@pal3", ";Pal3")
end
if (palnumber.value >= 2) then
text = text:gsub("@pal2", "Pal2 = @name2.act")
else
text = text:gsub("@pal2", ";Pal2")
end
if (palnumber.value > 1) then
text = text:gsub("@pal1", "Pal1 = @name1.act")
else
text = text:gsub("@pal1", "Pal1 = @name.act")
end
text = text:gsub("@name", name.text):gsub("@displayname", displayname.text):gsub("@author", author.text):gsub("@localcoord", localcoord.text)
project:fromFile("scripts/project/Template/Elecbyte Player - Auto DEF/player.def", 0, false, true)
project.type = Project.Character
project.definitions:insertText(text)
return true
end
return false
end