CMI 5.00 Addons Tutorial
------------------------
How to create CMI Addons
------------------------
English
------

Basic Functions :

- Install Process :
CMI.install(value,text) / value =  -183 - +98 , this is the shown process. text = Your Text you want to print during the process. For Example:

CMI.install(-183,"Installation") / This shows the Install Proces with 0 %, because -183 = 0 % , 98 = 100 % . Complet Process, example :

CMI.install(-183,"Install")
System.copyFile("ms0:/blabla.prx","ms0:/PSP/blabla.prx",0)
CMI.install(-43,"Install")
System.copyFile("ms0:/blablu.prx","ms0:/PSP/blablu.prx",0)
CMI.install(32,"Install")
System.copyFile("ms0:/blabli.prx","ms0:/PSP/blabli.prx",0)
CMI.install(98,"Install") // In the end the proces bar is by 100 % , easy, or is it ? 

----

- CMI Backround ( CMI Backround Image )
CMI.bg() / This was it ;) You must nothing edit, this was the complet code

----

- Addon dofile itself
dofileme() / With this you can dofile your addon. Its very useful if you want to code a Menu, because you can go to the Addon Main Menu with this little code

----

- Start CMI again
back() / this code will start CMI again

----

- Get the CMI config 
CMI.getconfigs() / with this code you read out the CMI configs

----

- Password abfrage 
CMI.security() / in CMI 5.0 there is the new Funktion "CMI Security". With this code you can start the Security mode. This function gaves a True or a False back. For example :

CMI.getconfigs()
CMI.security()
if password == true then
-- If the Password is correct ...
end
if password == false then
-- If the Password is false then
CMI.security() -- For example, start CMI Security again.
end

----

- CMI Window ( Warn, Info etc. Windows, for exaple the Quickbar-Menu )
CMI.msg() / text position : 107,96 ( top position )

----

- CMI Bar
CMI.bar() / This shows the CMI bar

----

- CMI Menu Style
CMI.drawmenu(position,text) / Position = 0 - 480 . Change the position as you want that it looks like perfect ;) text = Menu name . for example:

CMI.drawmenu(200,"My Addon Menu")  / You dont need CMI.bg() ;)

----

- Language 
if language == "de" then        / Get the language config. You dont need CMI.getconfigs()
-- if the language is german
end

if language == "en" then
-- if the language is english
end


----

Complet Menu in CMI Style :



modus = 1
oldpad = Controls.read()
while true do
CMI.drawmenu(200,"Test Menu")
if modus==1 then
screen:fontPrint(klein,70,50,"=> Eins", red)
screen:fontPrint(klein,70,66,"Zwei", white)
screen:fontPrint(klein,70,82,"Drei", white)
screen:fontPrint(klein,70,98,"Vier", white)
screen:fontPrint(klein,70,114,"Zurueck", white) 
screen:fontPrint(klein,1,250,"Information for One", white)
screen.flip()
screen.waitVblankStart(0)
elseif modus == 2 then
screen:fontPrint(klein,70,50,"Eins", white)
screen:fontPrint(klein,70,66,"=> Zwei", red)
screen:fontPrint(klein,70,82,"Drei", white)
screen:fontPrint(klein,70,98,"Vier", white)
screen:fontPrint(klein,70,114,"Zurueck", white)
screen:fontPrint(klein,1,250,"Information for Two", white)
screen.flip()
screen.waitVblankStart(0)
elseif modus == 3 then
screen:fontPrint(klein,70,50,"Eins", white)
screen:fontPrint(klein,70,66,"Zwei", white)
screen:fontPrint(klein,70,82,"=> Drei", red)
screen:fontPrint(klein,70,98,"Vier", white)
screen:fontPrint(klein,70,114,"Zurueck", white)
screen:fontPrint(klein,1,250,"Information for Three", white)
screen.flip()
screen.waitVblankStart(0)
elseif modus == 4 then
screen:fontPrint(klein,70,50,"Eins", white)
screen:fontPrint(klein,70,66,"Zwei", white)
screen:fontPrint(klein,70,82,"Drei", white)
screen:fontPrint(klein,70,98,"=> Vier", red)
screen:fontPrint(klein,70,114,"Zurueck", white)
screen:fontPrint(klein,1,250,"Information for For", white)
screen.flip()
screen.waitVblankStart(0)
elseif modus == 5 then
screen:fontPrint(klein,70,50,"Eins", white)
screen:fontPrint(klein,70,66,"Zwei", white)
screen:fontPrint(klein,70,82,"Drei", white)
screen:fontPrint(klein,70,98,"Vier", white)
screen:fontPrint(klein,70,114,"Zurueck", red)
screen:fontPrint(klein,1,250,"Information for Back", white)
screen.flip()
screen.waitVblankStart(0)
end


pad = Controls.read()

if pad:up() and oldpad:up()~=pad:up() then 
if modus==1 then
modus=5
elseif modus==2 then
modus=1 
elseif modus==3 then
modus=2
elseif modus==4 then
modus=3 
elseif modus==5 then
modus=4
end
end

if pad:down() and oldpad:down()~=pad:down() then
if modus==1 then 
modus=2
elseif modus==2 then
modus=3
elseif modus==3 then
modus=4
elseif modus==4 then
modus=5
elseif modus==5 then
modus=1
end
end


if pad:cross() and oldpad:cross()~=pad:cross() then

if modus == 5 then
-- By pressing the 
end

if modus == 1 then
-- Hier was passieren soll bei Klicken des Men Punktes Eins
end

if modus == 2 then
-- Hier was passieren soll bei Klicken des Men Punktes zwei
end

if modus == 3 then
-- Hier was passieren soll bei Klicken des Men Punktes Drei
end

if modus == 4 then
-- Hier was passieren soll bei Klicken des Men Punktes Vier
end


end
oldpad = pad
end



---

Den Rest kann man ganz einfach in Lua Coden ;)

Viel Spa

PS. Ich habe noch ein Open Source Addon beigelegt um sich nochmal einen berblcik machen zu knnen.


Euer
Namenloser
