Mystic Software Forums

Mystic Software => General Discussion => Topic started by: AlienDude on December 02, 2005, 09:21:26 AM

Title: (no subject)
Post by: AlienDude on December 02, 2005, 09:21:26 AM
I did this lil proggie a few weeks ago, but have yet to get it to work. all it does not do is display the text that is inputted, here is the display method:
Code: [Select]
method display()
{
local(curtext$, "")
local(curline!, 0)
local(curttime!, 0)
local(curltime!, 0)
local(curred!, 255)
local(curgreen!, 255)
local(curblue!, 255)
local(curcenline!, 0)
local(next_t!, 0)
local(next_f!, 0)
local(next_s!, 0)
local(next_r!, 0)
local(next_g!, 0)
local(next_b!, 0)
local(next_c!, 0)
local(top!, 0)
local(left!, 0)


tcanvas!=createcanvas(windx!,windy!)
for(curline!=0; curline!<lines!; curline!++)
{
if(fontat[next_f!]! == curline!)
{
font(fonts[next_f!]$)
next_f!++
}

if(sizeat[next_s!]! == curline!)
{
fontsize(sizes[next_s!]!)
next_s!++
}

if(ttimeat[next_t!]! == curline!)
{
curttime!=ttimes[next_t!]!
next_t!++
}

if(ltimeat[next_l!]! == curline!)
{
curltime!=ltimes[next_l!]!
next_l!++
}

if(redat[next_r!]! == curline!)
{
curred!=reds[next_r!]!
next_r!++
}

if(greenat[next_g!]! == curline!)
{
curgreen!=greens[next_g!]!
next_g!++
}

if(blueat[next_b!]! == curline!)
{
curblue!=reds[next_b!]!
next_r!++
}

if(cenlineat[next_c!]! == curline!)
{
curcenline!=cenlines[next_c!]!
next_c!++
}

colorrgb(curred!, curgreen!, curblue!)
sl!=length(text[curline!]$)
if(curcenline!)
{
left!=castint((windx! / 2) - (gettextwidth(text[curline!]$) / 2))
}
font(curfont$)
fontsize(cursize!)
local(x!, 0)
for(x!=0; x!<=sl!; x!++)
{
curtext$ += charat(text[curline!]$, x!)
pixeltext(left!, top!, curtext$, tcanvas!)
drawcanvas(tcanvas!, canx!, cany!, windx!, windy!)
delay(curttime!)
}
delay(curltime!)
left! = 0
top! += gettextheight(text[curline!]$)
}
font(ftype[1]$)
fontsize(defsize!)
mwin("LINE COMPLETE")
}
}
I am thinking of taking out the canvas part, or eventually using my canvas handler class when it gets completed, or just have the cinetext class incorporated into it.
If i get this down i cna get the intro done, and some aspects of the menu and battle system.
btw i will also be making a version that only shows one line of text, so that you input write each line separately, instead of having it all show up in tandem. ANy help will obviously be greatly appreciated.
Title: (no subject)
Post by: Xorlak on December 02, 2005, 12:27:23 PM
Didn't someone mention a bug with local variables a while back?  I'll test the program and get back to you later.
Title: (no subject)
Post by: AlienDude on December 05, 2005, 11:54:07 AM
I found the problem: the font and font size are not being set through the algorithm. I forced settings for each line of text and it worked. If i have your email Xorlak, ill send you the entire prg file for the class. I may have screwed up somewhere else that is causing this.

I went through with local vars, and vars that get killed at the end, they both have the same problem.  If all else fails i may have one that only does one line of text like the old one. I actually think it has smth to do with the fact that it is part of a class.

By the way, you have to define member functions INSIDE the class scope, and you cant have default arguments, something that took me a many weeks to figure out (Heh...). SO some of the manual is wrong, at least for now.
Title: (no subject)
Post by: Xorlak on December 05, 2005, 01:30:44 PM
Good, because I somehow forgot about looking at this three days in a row.  (Heh...)  Hmm, having to set the font each time sounds a little wierd though.

email: xorlak@mysticsoftware.net
Title: (no subject)
Post by: AlienDude on December 06, 2005, 09:31:06 AM
it changes on the first time all the time and changes the value of the var only if the cntition is met, and i changed it so that it changes in the if statement.  The other problem is that the temp var that the text goes into wasnt clearing after each line, i may change it so that is only stores the next character, that way the text doesnt get applied a bunch of times. Could it have to do with using for loops? ill send it tomorrow, i will try smth with it tonight. Thanks!!!