oups... i'm just 20 years old,

so i don't remember Amigo.
in fact, you have more experience then me, and it make my confused....

for start - discover some examples from FBA folder on the PC...
FBA hasn't functions for dialoge box, so you should make it by your hands.
mainloop redraw all on the screen every cadr.
memory pages changing are already organized by the APIit looks like this:
Code:
function mainloop()
clear(0,0,0)
drawMyShaberMap()
drawMyShaberUnits()
drawSuperPatricles()
drawAnythingElse()
monsterAI()
checkSomething()
end
so, if you want to make dialoge box, the simpiest code should be like this:
Code:
-- all this code before mainloop are executing one time on program start. it's like "VAR" in the pascal :)
-- ofcoarse, i writed only variables, which related to dialogebox
-- in the Lua you don't need to set Type of variable. It is Variant.
isDialogeOnTheSreen=false
DialogeNumber=0
NumberOfAnswers=0
DialogeAnswer={} --DialogeAnswer is a table.
loadphrasedatabase() --this is our function, we'll make it later
LastStylusUpX=0
LastStylusUpY=0
function mainloop()
if isDialogeOnTheSreen then
MyFunctionDrawDialoge(DialogeNumber)
else
clear(0,0,0)
drawMyShaberMap()
drawMyShaberUnits()
drawSuperPatricles()
drawAnythingElse()
monsterAI()
checkSomething()
end
end
so, lets go forward...
all this is MY way to organize the program working. I'm sure, it isn't ideal...
onstylusup(x,y) is standart event function. it work every time stylus or mouse button move up :) let's write it...
Code:
function onstylusup(x,y)
if isDialogeOnTheSreen then
LastStylusUpX=x
LastStylusUpY=y
else
--there are some actions for non-dialogeBox game control. for example:
unit[player]["targetx"]=x
unit[player]["targety"]=y
--or
shotWithMagic(Selected_magic,player,x,y)
end
end
and, finaly, dialogebox:
Code:
function MyFunctionDrawDialoge(dialogenumber)
fillrect(50,50,200,300,255,220,210) --fillrect(x1,y1,x2,y2,red,green,blue) draw filled rectangle
print(70,60,phrasesDatabase[DialogeNumber],0,0,0) -- print(x, y, text, red, green, blue)
for i = 0,NumberOfAnswers-1 do
print(70, 70+i*20, phrasesDatabase[DialogeAnswer[i]] , 0, 0, 0)
if (LastStylusUpY >60+i*20) and (LastStylusUpY <80+i*20) then
--action,change dialoge...
end
end
end
oups, it isn't finaly :)
how to create dialoge with THIS model:
Code:
--for example...
if QuestStep==141 then
isDialogeOnTheSreen=true
DialogeNumber=150
NumberOfAnswers=5
DialogeAnswer[0]=151
DialogeAnswer[1]=152
DialogeAnswer[2]=153
DialogeAnswer[3]=14
DialogeAnswer[4]=900
end
and
Code:
function loadphrasedatabase()
phrasesDatabase={}
phrasesDatabase[0]="lets start the game"
phrasesDatabase[1]="what your name?"
phrasesDatabase[2]="select your rase!"
...
phrasesDatabase[14]="No,thanks"
...
phrasesDatabase[151]="Do you think it will be useless?"
phrasesDatabase[152]="I understand. How many do you want?"
phrasesDatabase[153]="Calm out! It's joke..."
...
phrasesDatabase[900]="Die, bastard!"
...
end
near that... it isn't a ready-to-work model, but quite for a begin.
whay about loading in background images.. its very simple. look at the "graphic" in the FBA help - you can find all you need about this things...
whoooh... So many english make my brain burning...
