Author Topic: Ascii Scroller  (Read 15422 times)

0 Members and 1 Guest are viewing this topic.

Offline bikerboy

  • Amiga 1200
  • ****
  • Posts: 349
  • Karma: 12
    • View Profile
Re: Hello everyone :)
« Reply #20 on: December 21, 2008 »
i really think your doing excellently bikerboy keep pluging away and you will get there.

thanx man  ;D

now that i see it working i can say i was so close too, i didn't change the LettersY(i) = 165-15*sin(LettersX(i)/10) part.


does that help?

not only it helps, it's perfect :clap: :clap: much appreciated man thanx again for all your help ;D :cheers:

now it looks so nice that i want to add more to it :P :P

ASCII textlines colored the way they're now with a simple starfield --> classic intro  :carrot:

is it easy to create a simple starfield? , nothing fancy and complicated , just dots moving from one left to right ::)

EDIT: just noticed the scroller starts from the middle of the screen and it does not repeat :skint:

and the full code i'm using (replaced only the text lines)

Code: [Select]
Screenres 640,480,16,2

#Include Once "tinyptc_ext++.bi"
#include "windows.bi"
#include "tune.bas"
#include "crt.bi"

       'Play our music
    Dim hWave As HWAVEOUT
    hWave = uFMOD_PlaySong(@Music(0),31009,XM_MEMORY)
   
'' To keep our letters in memory
Dim buffer as integer
Dim as string LettersToScroll(60) => {" "," "," "," "," "," "," "," ","!","!","!"," "," ","9","0","0","2"," "," ","R","A","E","Y"," "," ","W","E","N"," "," ","Y","P","P","A","H"}
dim a as string

'' To keep our letters position somewhere :
Dim as single LettersX(60), LettersY(60)


'' init Letters position (I assume a letter width and Height is 10)
For i as integer = 0 to 60
   
    LettersX(i) = 640-i*15
    LettersY(i) = 480  '' middle screen
   
next

'bikerboy
Dim Shared As String Message(55)
Message(1) = "           ...       _     _ _             _                       ...     "
Message(2) = "          ( oo)     | |   (_) |           | |                     (- o)    "
Message(3) = "      ooO--(_)--Ooo-| |__  _| | _____ _ __| |__   ___  _   _ -ooO--(_)--Ooo"
Message(4) = "                    | '_ \| | |/ / _ \ '__| '_ \ / _ \| | | |             "
Message(5) = "                    | |_) | |   <  __/ |  | |_) | (_) | |_| |             "
Message(6) = "                    |_.__/|_|_|\_\___|_|  |_.__/ \___/ \__, |             "
Message(7) = "                                                        __/ |             "
Message(8) = "                    _________________________________  |___/              "

Message(9) = "-------------------------------text-------------------------------"
Message(10) = "-------------------------------text-------------------------------"
Message(11) = "-------------------------------text-------------------------------"
Message(12) = "-------------------------------text-------------------------------"
Message(13) = "-------------------------------text-------------------------------"
Message(14) = "-------------------------------text-------------------------------"
Message(15) = "-------------------------------text-------------------------------"
Message(16) = "-------------------------------text-------------------------------"
Message(17) = "-------------------------------text-------------------------------"

Message(19) = "-------------------------------text-------------------------------"
Message(20) = "-------------------------------text-------------------------------"
Message(21) = "-------------------------------text-------------------------------"
Message(22) = "-------------------------------text-------------------------------"
Message(23) = "-------------------------------text-------------------------------"
Message(24) = "-------------------------------text-------------------------------"

Message(25) = "-------------------------------text-------------------------------"
Message(26) = "-------------------------------text-------------------------------"
Message(27) = "-------------------------------text-------------------------------"
Message(28) = "-------------------------------text-------------------------------"
Message(29) = "-------------------------------text-------------------------------"
Message(30) = "-------------------------------text-------------------------------"
Message(31) = "-------------------------------text-------------------------------"
Message(32) = "-------------------------------text-------------------------------"
Message(33) = "-------------------------------text-------------------------------"
Message(34) = "-------------------------------text-------------------------------"
Message(35) = "-------------------------------text-------------------------------"
Message(36) = "-------------------------------text-------------------------------"
Message(37) = "-------------------------------text-------------------------------"

Message(38) = "-------------------------------text-------------------------------"
Message(39) = "-------------------------------text-------------------------------"
Message(40) = "-------------------------------text-------------------------------"
Message(41) = "-------------------------------text-------------------------------"
Message(42) = "-------------------------------text-------------------------------"
Message(43) = "-------------------------------text-------------------------------"
Message(44) = "-------------------------------text-------------------------------"
Message(45) = "-------------------------------text-------------------------------"
Message(46) = "-------------------------------text-------------------------------"
Message(47) = "-------------------------------text-------------------------------"
Message(48) = "-------------------------------text-------------------------------"
Message(49) = "-------------------------------text-------------------------------"
Message(50) = "-------------------------------text-------------------------------"
Message(51) = "-------------------------------text-------------------------------"
Message(52) = "-------------------------------text-------------------------------"

Do : screenlock
   
    Dim As Double DeltaFR , DeltaFG , DeltaFB
    Dim As Double R = 0 , G = 0 , B = 0
    Dim As Integer Y
    DeltaFR = 125/(8/2)
    DeltaFG = 146/(8/2)
    DeltaFB = 242/(8/2)

    For Y = 0 to 55
   
        COLOR rgb(R,G,B), rgb(0,0,0)
        Draw String(3,Y*9),Message(Y)
        'color part
        R += DeltaFR
        G += DeltaFG
        B += DeltaFB

        If R > 254 Then
            R = 254
            DeltaFR = -DeltaFR
        EndIf
        If R < 0 Then
            R = 0
            DeltaFR = -DeltaFR
        EndIf
        If G > 250 Then
            G = 250
            DeltaFG = -DeltaFG
        EndIf
        If G < 0 Then
            G = 0
            DeltaFG = -DeltaFG
        EndIf
        If B > 251 Then
            B = 251
            DeltaFB = -DeltaFB
        EndIf
        If B < 0 Then
            B = 0
            DeltaFB = -DeltaFB
        EndIf
    Next
   
    'DBF url
    Color RGB(42,240,222),RGB(0,0,0)
    Draw String(68,68),"             @ http://www.dbfinteractive.com"
       
    'the scroller part
    For i as integer = 0 to 60
       
        LettersX(i) -= 0.075  ' scroll along X axis
       
        LettersY(i) = 165-15*sin(LettersX(i)/10)   ' Sine Scroll along Y axis (the distance of letters)
       
        Draw String(LettersX(i), LettersY(i)),LettersToScroll(i),rgb(98,39,252)
       
       
        if LettersX(i)>640 then LettersX(i) = -0  '' if a letter is too far on the right, make it start again on the left
   
    Next
   
    Screenunlock : sleep 2,1
    cls
Loop until multikey(&h01)  '' Will quit loop if ESC is pressed
« Last Edit: December 21, 2008 by va!n »


Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: Hello everyone :)
« Reply #21 on: December 21, 2008 »
you missed a few other lines too.

Code: [Select]
Screenres 640,480,16,2

'#Include Once "tinyptc.bi"
Screenres 640,480,16,2

'#Include Once "tinyptc_ext++.bi"
#include "windows.bi"
'#include "tune.bas"
#include "crt.bi"

       'Play our music
   ' Dim hWave As HWAVEOUT
   ' hWave = uFMOD_PlaySong(@Music(0),31009,XM_MEMORY)
   
'' To keep our letters in memory
Dim buffer as integer
Dim as string LettersToScroll(60) => {" "," "," "," "," "," "," "," ","!","!","!"," "," ","9","0","0","2"," "," ","R","A","E","Y"," "," ","W","E","N"," "," ","Y","P","P","A","H"}
dim a as string

'' To keep our letters position somewhere :
Dim as single LettersX(60), LettersY(60)


'' init Letters position (I assume a letter width and Height is 10)
For i as integer = 0 to 60
   
    LettersX(i) = 640+i*15
    LettersY(i) = 480  '' middle screen
   
next

'bikerboy
Dim Shared As String Message(52)
Message(1) = "           ...       _     _ _             _                       ...     "
Message(2) = "          ( oo)     | |   (_) |           | |                     (- o)    "
Message(3) = "      ooO--(_)--Ooo-| |__  _| | _____ _ __| |__   ___  _   _ -ooO--(_)--Ooo"
Message(4) = "                    | '_ \| | |/ / _ \ '__| '_ \ / _ \| | | |             "
Message(5) = "                    | |_) | |   <  __/ |  | |_) | (_) | |_| |             "
Message(6) = "                    |_.__/|_|_|\_\___|_|  |_.__/ \___/ \__, |             "
Message(7) = "                                                        __/ |             "
Message(8) = "                    _________________________________  |___/              "

Message(9) = "-------------------------------text-------------------------------"
Message(10) = "-------------------------------text-------------------------------"
Message(11) = "-------------------------------text-------------------------------"
Message(12) = "-------------------------------text-------------------------------"
Message(13) = "-------------------------------text-------------------------------"
Message(14) = "-------------------------------text-------------------------------"
Message(15) = "-------------------------------text-------------------------------"
Message(16) = "-------------------------------text-------------------------------"
Message(17) = "-------------------------------text-------------------------------"

Message(19) = "-------------------------------text-------------------------------"
Message(20) = "-------------------------------text-------------------------------"
Message(21) = "-------------------------------text-------------------------------"
Message(22) = "-------------------------------text-------------------------------"
Message(23) = "-------------------------------text-------------------------------"
Message(24) = "-------------------------------text-------------------------------"

Message(25) = "-------------------------------text-------------------------------"
Message(26) = "-------------------------------text-------------------------------"
Message(27) = "-------------------------------text-------------------------------"
Message(28) = "-------------------------------text-------------------------------"
Message(29) = "-------------------------------text-------------------------------"
Message(30) = "-------------------------------text-------------------------------"
Message(31) = "-------------------------------text-------------------------------"
Message(32) = "-------------------------------text-------------------------------"
Message(33) = "-------------------------------text-------------------------------"
Message(34) = "-------------------------------text-------------------------------"
Message(35) = "-------------------------------text-------------------------------"
Message(36) = "-------------------------------text-------------------------------"
Message(37) = "-------------------------------text-------------------------------"

Message(38) = "-------------------------------text-------------------------------"
Message(39) = "-------------------------------text-------------------------------"
Message(40) = "-------------------------------text-------------------------------"
Message(41) = "-------------------------------text-------------------------------"
Message(42) = "-------------------------------text-------------------------------"
Message(43) = "-------------------------------text-------------------------------"
Message(44) = "-------------------------------text-------------------------------"
Message(45) = "-------------------------------text-------------------------------"
Message(46) = "-------------------------------text-------------------------------"
Message(47) = "-------------------------------text-------------------------------"
Message(48) = "-------------------------------text-------------------------------"
Message(49) = "-------------------------------text-------------------------------"
Message(50) = "-------------------------------text-------------------------------"
Message(51) = "-------------------------------text-------------------------------"
Message(52) = "-------------------------------text-------------------------------"

Do : screenlock
   
    Dim As Double DeltaFR , DeltaFG , DeltaFB
    Dim As Double R = 0 , G = 0 , B = 0
    Dim As Integer Y
    DeltaFR = 125/(52/2)
    DeltaFG = 146/(52/2)
    DeltaFB = 242/(52/2)

    For Y = 0 to 52
   
        COLOR rgb(R+60,G+40,B+13), rgb(0,0,0)
        Draw String(3,Y*9),Message(Y)
        'color part
        R += DeltaFR
        G += DeltaFG
        B += DeltaFB

        If R > 125 Then
            R = 125
            DeltaFR = -DeltaFR
        EndIf
        If R < 0 Then
            R = 0
            DeltaFR = -DeltaFR
        EndIf
        If G > 146 Then
            G = 146
            DeltaFG = -DeltaFG
        EndIf
        If G < 0 Then
            G = 0
            DeltaFG = -DeltaFG
        EndIf
        If B > 242 Then
            B = 242
            DeltaFB = -DeltaFB
        EndIf
        If B < 0 Then
            B = 0
            DeltaFB = -DeltaFB
        EndIf
    Next
   
    'DBF url
    Color RGB(42,240,222),RGB(0,0,0)
    Draw String(68,68),"             @ http://www.dbfinteractive.com"
       
    'the scroller part
    For i as integer = 0 to 60
       
        LettersX(i) -= 0.075  ' scroll along X axis
       
        LettersY(i) = 165-15*sin(LettersX(i)/10)   ' Sine Scroll along Y axis (the distance of letters)
       
        Draw String(LettersX(i), LettersY(i)),LettersToScroll(i),rgb(98,39,252)
       
       
        if LettersX(i)<0 then LettersX(i) = 640  '' if a letter is too far on the right, make it start again on the left
       
    Next
   
    Screenunlock : sleep 2,1
    cls
Loop until multikey(&h01)  '' Will quit loop if ESC is pressed

for a starfeild if you have a look through this freebasic forum shockwave has done a starfeild challenge which can be thought of like a tutorial. i think you will find a few tutorials too though.
Challenge Trophies Won:

Offline bikerboy

  • Amiga 1200
  • ****
  • Posts: 349
  • Karma: 12
    • View Profile
Re: Hello everyone :)
« Reply #22 on: December 21, 2008 »
weird, i just compiled the code in your post and there's no scroller and the text lines have a single color :skint:

thanx man i'll go look for it   :D

EDIT: found two nice starfields to play with ;D :stirrer:

the first one is here http://www.dbfinteractive.com/forum/index.php/topic,1758.0.html
and the other one here http://www.dbfinteractive.com/forum/index.php/topic,3140.0.html

cooked the code a bit and i have the same problem with both starfields, the problem is that i can hear the tune play, i can see the starfield but i can't see the scroller and the colored text.

it seems that the starfield and the scroller use the word "buffer" in order to play so there's a conflict there.

the starfield uses ->DIM SHARED AS INTEGER BUFFER ( XRES * YRES ):
and the scroller uses -> Dim buffer as integer

at first i commented Dim buffer as integer and get the result above (no scroller and color text).

then i renamed DIM SHARED AS INTEGER BUFFER ( XRES * YRES ): to DIM SHARED AS INTEGER BUFFER2 ( XRES * YRES ):

also renamed buffer2 wherever it was used by the starfield, but no luck same result.

i'll look into it again tomorrow, now the time here is 6:33 in the morning and my brain does not compile lol :P

the code

Code: [Select]
'Screenres 640,480,16,2

#Include Once "tinyptc_ext++.bi"
#include "windows.bi"
#include "tune.bas"
#include "crt.bi"

OPTION STATIC
OPTION EXPLICIT

    CONST XRES AS INTEGER = 640:' Screen Width In Pixels.
    CONST YRES AS INTEGER = 480:' Screen Height In Pixels.

       'Play our music
    Dim hWave As HWAVEOUT
    hWave = uFMOD_PlaySong(@Music(0),31009,XM_MEMORY)
   
        DIM SHARED AS INTEGER BUFFER ( XRES * YRES ):' The Screen Array.

'   This is how we define a variable;

    DIM SHARED AS INTEGER NUMBER_OF_STARS = 1000:' How many stars to have.
   
    DIM SHARED AS INTEGER SX(NUMBER_OF_STARS):' WILL STORE X POS
    DIM SHARED AS INTEGER SY(NUMBER_OF_STARS):' WILL STORE Y POS
    DIM SHARED AS INTEGER SS(NUMBER_OF_STARS):' WILL STORE SPEED
   
'' To keep our letters in memory
'Dim buffer as integer
Dim as string LettersToScroll(60) => {" "," "," "," "," "," "," "," ","!","!","!"," "," ","9","0","0","2"," "," ","R","A","E","Y"," "," ","W","E","N"," "," ","Y","P","P","A","H"}
dim a as string

'' To keep our letters position somewhere :
Dim as single LettersX(60), LettersY(60)


'' init Letters position (I assume a letter width and Height is 10)
For i as integer = 0 to 60
   
    LettersX(i) = 640-i*15
    LettersY(i) = 480  '' middle screen
   
next

DECLARE SUB SET_STARS():' SET UP STARFIELD
    DECLARE SUB DO_STARS():'  MOVE / DRAW STARS ETC.
   
'   This is how we call a subroutine;
   
    SET_STARS():' Set Star Positions and speed.

'   Open The Screen;

    IF (PTC_OPEN("STARFIELD",XRES,YRES)=0) THEN
    END-1
    END IF

'
'   Main Loop;
'

WHILE (1)
   
    DO_STARS():' Do the starfield
    PTC_UPDATE@BUFFER(0):' Update Screen
    ERASE BUFFER:' Clear Screen
   
WEND
END

'
' Do The Starfield;
'
SUB DO_STARS()

'   PLEASE NOTE THE VARIABLE "SL"
'   ALTHOUGH THIS VARIABLE NAME IS THE SAME AS IN THE OTHER SUB, IT IS
'   A COMPLETELY SEPERATE VARIABLE, AS IT IS A LOCAL VARIABLE :-)
'   GENERALLY IT IS BAD PROGRAMMING PRACTICE TO DO WHAT I HAVE DONE HERE
'   YOU SHOULD GIVE THE LOOP A PREFIX LIKE DO_STARS_SL
'
    DIM AS INTEGER SL :' Used as a pointer in loop.
   
    FOR SL=1 TO NUMBER_OF_STARS
       
    SX(SL)=SX(SL)+SS(SL) : ' Move Star
   
    IF SX(SL) > XRES THEN SX(SL)=SX(SL)-XRES :' reset it if off screen
   
    IF SX(SL)>0 AND SX(SL)<XRES THEN:' Check if onscreen before drawing
   
    'Draw in the correct colour according to speed.
    IF SS(SL) =1 THEN BUFFER (SX(SL) + ( SY(SL) * XRES) ) = &H444444
    IF SS(SL) =2 THEN BUFFER (SX(SL) + ( SY(SL) * XRES) ) = &H777777
    IF SS(SL) =3 THEN BUFFER (SX(SL) + ( SY(SL) * XRES) ) = &HAAAAAA
    IF SS(SL) =4 THEN BUFFER (SX(SL) + ( SY(SL) * XRES) ) = &HCCCCCC
    IF SS(SL) =5 THEN BUFFER (SX(SL) + ( SY(SL) * XRES) ) = &HFFFFFF
   
    END IF   

    NEXT
   
END SUB

'-------------------------------------------------------------------------------
' THIS SIMPLY MAKES A RANDOM X AND Y LOCATION FOR EACH STAR
'-------------------------------------------------------------------------------
SUB SET_STARS()
   
'   Because this is being dimensioned inside a sub, the variable SL
'   is inaccessible by any other part of the program, it will only work in
'   THIS sub.

    DIM AS INTEGER SL:' Loop counter variable
   
    for SL = 1 TO NUMBER_OF_STARS
       
        SX(SL) = INT(RND(1) * XRES):' GENERATE AND STORE NUMBER BETWEEN 0 AND XRES
        SY(SL) = INT(RND(1) * YRES):' GENERATE AND STORE NUMBER BETWEEN 0 AND YRES
        SS(SL) = INT(RND(1) * 5) + 1:' RANDOM SPEED
    NEXT
   
END SUB

'bikerboy
Dim Shared As String Message(55)
Message(1) = "           ...       _     _ _             _                       ...     "
Message(2) = "          ( oo)     | |   (_) |           | |                     (- o)    "
Message(3) = "      ooO--(_)--Ooo-| |__  _| | _____ _ __| |__   ___  _   _ -ooO--(_)--Ooo"
Message(4) = "                    | '_ \| | |/ / _ \ '__| '_ \ / _ \| | | |             "
Message(5) = "                    | |_) | |   <  __/ |  | |_) | (_) | |_| |             "
Message(6) = "                    |_.__/|_|_|\_\___|_|  |_.__/ \___/ \__, |             "
Message(7) = "                                                        __/ |             "
Message(8) = "

Message(9) = "-----------------------------text line-----------------------------"
Message(10) = "-----------------------------text line-----------------------------"
Message(11) = "-----------------------------text line-----------------------------"
Message(12) = "-----------------------------text line-----------------------------"
Message(13) = "-----------------------------text line-----------------------------"
Message(14) = "-----------------------------text line-----------------------------"
Message(15) = "-----------------------------text line-----------------------------"
Message(16) = "-----------------------------text line-----------------------------"
Message(17) = "-----------------------------text line-----------------------------"

Message(19) = "-----------------------------text line-----------------------------"
Message(20) = "-----------------------------text line-----------------------------"
Message(21) = "-----------------------------text line-----------------------------"
Message(22) = "-----------------------------text line-----------------------------"
Message(23) = "-----------------------------text line-----------------------------"
Message(24) = "-----------------------------text line-----------------------------"

Message(25) = "-----------------------------text line-----------------------------"
Message(26) = "-----------------------------text line-----------------------------"
Message(27) = "-----------------------------text line-----------------------------"
Message(28) = "-----------------------------text line-----------------------------"
Message(29) = "-----------------------------text line-----------------------------"
Message(30) = "-----------------------------text line-----------------------------"
Message(31) = "-----------------------------text line-----------------------------"
Message(32) = "-----------------------------text line-----------------------------"
Message(33) = "-----------------------------text line-----------------------------"
Message(34) = "-----------------------------text line-----------------------------"
Message(35) = "-----------------------------text line-----------------------------"
Message(36) = "-----------------------------text line-----------------------------"
Message(37) = "-----------------------------text line-----------------------------"

Message(38) = "-----------------------------text line-----------------------------"
Message(39) = "-----------------------------text line-----------------------------"
Message(40) = "-----------------------------text line-----------------------------"
Message(41) = "-----------------------------text line-----------------------------"
Message(42) = "-----------------------------text line-----------------------------"
Message(43) = "-----------------------------text line-----------------------------"
Message(44) = "-----------------------------text line-----------------------------"
Message(45) = "-----------------------------text line-----------------------------"
Message(46) = "-----------------------------text line-----------------------------"
Message(47) = "-----------------------------text line-----------------------------"
Message(48) = "-----------------------------text line-----------------------------"
Message(49) = "-----------------------------text line-----------------------------"
Message(50) = "-----------------------------text line-----------------------------"
Message(51) = "-----------------------------text line-----------------------------"
Message(52) = "-----------------------------text line-----------------------------"

Do : screenlock
   
    Dim As Double DeltaFR , DeltaFG , DeltaFB
    Dim As Double R = 0 , G = 0 , B = 0
    Dim As Integer Y
    DeltaFR = 125/(8/2)
    DeltaFG = 146/(8/2)
    DeltaFB = 242/(8/2)

    For Y = 0 to 55
   
        COLOR rgb(R,G,B), rgb(0,0,0)
        Draw String(3,Y*9),Message(Y)
        'color part
        R += DeltaFR
        G += DeltaFG
        B += DeltaFB

        If R > 254 Then
            R = 254
            DeltaFR = -DeltaFR
        EndIf
        If R < 0 Then
            R = 0
            DeltaFR = -DeltaFR
        EndIf
        If G > 250 Then
            G = 250
            DeltaFG = -DeltaFG
        EndIf
        If G < 0 Then
            G = 0
            DeltaFG = -DeltaFG
        EndIf
        If B > 251 Then
            B = 251
            DeltaFB = -DeltaFB
        EndIf
        If B < 0 Then
            B = 0
            DeltaFB = -DeltaFB
        EndIf
    Next
   
    'DBF url
    Color RGB(42,240,222),RGB(0,0,0)
    Draw String(68,68),"             @ http://www.dbfinteractive.com"
       
    'the scroller part
    For i as integer = 0 to 60
       
        LettersX(i) -= 0.075  ' scroll along X axis
       
        LettersY(i) = 165-15*sin(LettersX(i)/10)   ' Sine Scroll along Y axis (the distance of letters)
       
        Draw String(LettersX(i), LettersY(i)),LettersToScroll(i),rgb(98,39,252)
       
       
        if LettersX(i)>640 then LettersX(i) = -0  '' if a letter is too far on the right, make it start again on the left
   
    Next
   
    Screenunlock : sleep 2,1
    cls
Loop until multikey(&h01)  '' Will quit loop if ESC is pressed
« Last Edit: December 21, 2008 by va!n »


Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: Hello everyone :)
« Reply #23 on: December 21, 2008 »
right the main problem here is that the starfeild is done in tinyptc. and your code runs on freebasic graphics library.

you should not mix the two. thats what all the buffer stuff is about, what i suggest doing is ripping all the x and y's out of the buffer commands and use somethig like draw point from the freebasic lib. also get rid of all the tinyptc stuff for now. then carefully put the starfeild stuff in your code making sure not to disrupt too much other stuff.

if you look at your example you will see you have two main loops one for the stars and your original one. the star mainloop comes first thats why you never see your code running.

btw about the scoller here it is fixed  and the colors changed just cause i was messing around with them Just put them to what ever you like :p .

Code: [Select]
Screenres 640,480,16,2

'#Include Once "tinyptc_ext++.bi"
#include "windows.bi"
'#include "tune.bas"
#include "crt.bi"

       'Play our music
   ' Dim hWave As HWAVEOUT
   ' hWave = uFMOD_PlaySong(@Music(0),31009,XM_MEMORY)
   
'' To keep our letters in memory
Dim buffer as integer
Dim as string LettersToScroll(60) => {" "," "," "," "," "," "," "," ","!","!","!"," "," ","9","0","0","2"," "," ","R","A","E","Y"," "," ","W","E","N"," "," ","Y","P","P","A","H"}
dim a as string

'' To keep our letters position somewhere :
Dim as single LettersX(60), LettersY(60)


'' init Letters position (I assume a letter width and Height is 10)
For i as integer = 0 to 60
   
    LettersX(i) = 350+i*15
    LettersY(i) = 480  '' middle screen
   
next

'bikerboy
Dim Shared As String Message(52)
Message(1) = "           ...       _     _ _             _                       ...     "
Message(2) = "          ( oo)     | |   (_) |           | |                     (- o)    "
Message(3) = "      ooO--(_)--Ooo-| |__  _| | _____ _ __| |__   ___  _   _ -ooO--(_)--Ooo"
Message(4) = "                    | '_ \| | |/ / _ \ '__| '_ \ / _ \| | | |             "
Message(5) = "                    | |_) | |   <  __/ |  | |_) | (_) | |_| |             "
Message(6) = "                    |_.__/|_|_|\_\___|_|  |_.__/ \___/ \__, |             "
Message(7) = "                                                        __/ |             "
Message(8) = "                    _________________________________  |___/              "

Message(9) = "-------------------------------text-------------------------------"
Message(10) = "-------------------------------text-------------------------------"
Message(11) = "-------------------------------text-------------------------------"
Message(12) = "-------------------------------text-------------------------------"
Message(13) = "-------------------------------text-------------------------------"
Message(14) = "-------------------------------text-------------------------------"
Message(15) = "-------------------------------text-------------------------------"
Message(16) = "-------------------------------text-------------------------------"
Message(17) = "-------------------------------text-------------------------------"

Message(19) = "-------------------------------text-------------------------------"
Message(20) = "-------------------------------text-------------------------------"
Message(21) = "-------------------------------text-------------------------------"
Message(22) = "-------------------------------text-------------------------------"
Message(23) = "-------------------------------text-------------------------------"
Message(24) = "-------------------------------text-------------------------------"

Message(25) = "-------------------------------text-------------------------------"
Message(26) = "-------------------------------text-------------------------------"
Message(27) = "-------------------------------text-------------------------------"
Message(28) = "-------------------------------text-------------------------------"
Message(29) = "-------------------------------text-------------------------------"
Message(30) = "-------------------------------text-------------------------------"
Message(31) = "-------------------------------text-------------------------------"
Message(32) = "-------------------------------text-------------------------------"
Message(33) = "-------------------------------text-------------------------------"
Message(34) = "-------------------------------text-------------------------------"
Message(35) = "-------------------------------text-------------------------------"
Message(36) = "-------------------------------text-------------------------------"
Message(37) = "-------------------------------text-------------------------------"

Message(38) = "-------------------------------text-------------------------------"
Message(39) = "-------------------------------text-------------------------------"
Message(40) = "-------------------------------text-------------------------------"
Message(41) = "-------------------------------text-------------------------------"
Message(42) = "-------------------------------text-------------------------------"
Message(43) = "-------------------------------text-------------------------------"
Message(44) = "-------------------------------text-------------------------------"
Message(45) = "-------------------------------text-------------------------------"
Message(46) = "-------------------------------text-------------------------------"
Message(47) = "-------------------------------text-------------------------------"
Message(48) = "-------------------------------text-------------------------------"
Message(49) = "-------------------------------text-------------------------------"
Message(50) = "-------------------------------text-------------------------------"
Message(51) = "-------------------------------text-------------------------------"
Message(52) = "-------------------------------text-------------------------------"

Do : screenlock
   
    Dim As Double DeltaFR , DeltaFG , DeltaFB
    Dim As Double R = 0 , G = 0 , B = 0
    Dim As Integer Y
    DeltaFR = 125/(52/2)
    DeltaFG = 146/(52/2)
    DeltaFB = 242/(52/2)

    For Y = 0 to 52
   
        COLOR rgb(R+60,G+40,B+13), rgb(0,0,0)
        Draw String(3,Y*9),Message(Y)
        'color part
        R += DeltaFR
        G += DeltaFG
        B += DeltaFB

        If R > 125 Then
            R = 125
            DeltaFR = -DeltaFR
        EndIf
        If R < 0 Then
            R = 0
            DeltaFR = -DeltaFR
        EndIf
        If G > 146 Then
            G = 146
            DeltaFG = -DeltaFG
        EndIf
        If G < 0 Then
            G = 0
            DeltaFG = -DeltaFG
        EndIf
        If B > 242 Then
            B = 242
            DeltaFB = -DeltaFB
        EndIf
        If B < 0 Then
            B = 0
            DeltaFB = -DeltaFB
        EndIf
    Next
   
    'DBF url
    Color RGB(42,240,222),RGB(0,0,0)
    Draw String(68,68),"             @ http://www.dbfinteractive.com"
       
    'the scroller part
    For i as integer = 0 to 60
       
        LettersX(i) -= 0.6  ' scroll along X axis
       
        LettersY(i) = 165-15*sin(LettersX(i)/10)   ' Sine Scroll along Y axis (the distance of letters)
       
        Draw String(LettersX(i), LettersY(i)),LettersToScroll(i),rgb(98,39,252)
       
       
        if LettersX(i)<0 then LettersX(i) = 640  '' if a letter is too far on the right, make it start again on the left
       
    Next
   
    Screenunlock : sleep 2,1
    cls
Loop until multikey(&h01)  '' Will quit loop if ESC is pressed
« Last Edit: December 21, 2008 by ninogenio »
Challenge Trophies Won:

Offline bikerboy

  • Amiga 1200
  • ****
  • Posts: 349
  • Karma: 12
    • View Profile
Re: Hello everyone :)
« Reply #24 on: December 21, 2008 »
what i suggest doing is ripping all the x and y's out of the buffer commands and use somethig like draw point from the freebasic lib. also get rid of all the tinyptc stuff for now.

btw about the scoller here it is fixed  and the colors changed just cause i was messing around with them Just put them to what ever you like :p .

i'm not sure how to do all that ::)

thanx for the scroller man :clap:
« Last Edit: December 21, 2008 by va!n »


Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: Hello everyone :)
« Reply #25 on: December 21, 2008 »
as long as you show you are willing to try and learn new things the best you can bikerboy, im here to answer any of your questions to the best of my abilitys all year long ;)

really dont be affraid of studying code hard and long to try and figuare out how it works even though it looks complex take it apart if you have too. i have seen me looking at code i never thought in a million years i would understand, but by breaking it all up into small chunks and really analising it eventually i got it, and thats the best feeling trust me. its the only way you will progress.

now for the starfeild to understand how we might be able to port it we need to look at what is going on here.

DIM SHARED AS INTEGER BUFFER ( XRES * YRES ):' The Screen Array.

IF SS(SL) =1 THEN BUFFER (SX(SL) + ( SY(SL) * XRES) ) = &H444444
IF SS(SL) =2 THEN BUFFER (SX(SL) + ( SY(SL) * XRES) ) = &H777777
IF SS(SL) =3 THEN BUFFER (SX(SL) + ( SY(SL) * XRES) ) = &HAAAAAA
IF SS(SL) =4 THEN BUFFER (SX(SL) + ( SY(SL) * XRES) ) = &HCCCCCC

now for you too learn this you need to know what an array is do you know this?
also the buffer() array is essentally tinyptc's backbuffer when you put a Color hex value in the array. be it &H444444 , &H777777 or what ever and push the buffer array through with this command ( PTC_UPDATE(@BUFFER(0) ):' Update Screen ) a pixel will be lit on screen.

are you with me so far, dont be affraid of asking any questions. once you understand what i have said above we will move onto what a 1d array looks like and how we can move about it. basicaly what all this ( BUFFER (SX(SL) + ( SY(SL) * XRES) ) ) is about.

Also when i said get rid of the tinyptc stuff for now it was this stuff here.

    IF (PTC_OPEN("STARFIELD",XRES,YRES)=0) THEN
    END-1
    END IF
    PTC_UPDATE@BUFFER(0):' Update Screen
    ERASE BUFFER:' Clear Screen
   
« Last Edit: December 21, 2008 by ninogenio »
Challenge Trophies Won:

Offline bikerboy

  • Amiga 1200
  • ****
  • Posts: 349
  • Karma: 12
    • View Profile
Re: Hello everyone :)
« Reply #26 on: December 22, 2008 »
no i don't know what an array is or what it does, basically i have no idea what most of those commands do.

i know Dim is used to declare things, X Y Z are the positions,the draw string that shows a text message on screen, the cls that clears the screen,the color you showed me the other day,and the Loop until multikey(&h01) that plays until the esc is pressed.

that's all i know so far , oh and how to put a song and a picture on the screen


Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: Hello everyone :)
« Reply #27 on: December 22, 2008 »
right so we have a starting point then, i need to know what you so far understand so i can teach you from there.

an array is simply an area in memory you attach to a variable.try to think of it like your assigning lots of boxes to a variable. now what you put in each box and how many boxes you have is up too you.

say we want 10 boxes attached to a variable called box. we might do this.

Dim Shared as Integer Box(10)

now the () tells freebasic we want it to put some boxes onto the box variable and the number 10 is how many.

now we can put any number in box 1 like so.

Box(1) = 10

and also in box 2.

Box(2) = 40

etc.

the reason we like arrays is that they can save us a lot of trouble of trying to do something silly like.

Dim Shared As Integer Box1,Box2,Box3,Box4,Box5 etc

Box1 = 10
Box2 = 40
etc

and it also happens that arrays are really flexible when it comes to storing information and reading that info, like so

For X = 0 To 10
     Box(x) = 10
Next

now with that simple for loop you have just filled all your boxes with the value of 10! much nicer than writing it all out long hand.

try it out in practise once you get the fundimentals of this we will move on.
« Last Edit: December 22, 2008 by ninogenio »
Challenge Trophies Won:

Offline bikerboy

  • Amiga 1200
  • ****
  • Posts: 349
  • Karma: 12
    • View Profile
Re: Hello everyone :)
« Reply #28 on: December 22, 2008 »
oh i get it, it's like the text message ;D

Dim Shared As String Message(55)
Message(1) = "text"
Message(2) = "text"
and so on


Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: Hello everyone :)
« Reply #29 on: December 22, 2008 »
exactly!

and this tells freebasic we want it to add 640*480 boxes onto a variable called buffer like so DIM SHARED AS INTEGER BUFFER ( XRES * YRES ):' The Screen Array. Xres = 640 , Yres = 480

So now we have a buffer the same size as the screen which we can use as a backbuffer for page flipping.

the only thing about using a 1d array for the screen is there is no definition between X and Y.because a 1d array is layed out in memory like so.
          Y = 0               Y = 1                     Y = 2
| first 640 Boxes | Second 640 Boxes | Third 640 boxes | etc

instead of

| first 640 Boxes | Y = 0
| Second 640 Boxes | Y = 1
| Third 640 boxes | Y = 2
 
So if you wanted to plot a pixel at X = 0 , Y=2

on a 1d array you would have to put your color here.
                                                    Col
| first 640 Boxes | Second 640 Boxes | Third 640 boxes | etc

which would be the 1280th box in buffer. so to put a box at y = 2 x = 0 in a 1d buffer you could do this.

Buffer(1280) = col

or here is a special formula to make life easyer knowing this will be great for reading other peoples ptc code as you will likely see it everywhere.

Y*ScreenWidth+X = 1d array position

meaning that if we want to find out which box to put color into on our buffer if y = 2 and X = 0 then we could simply plug our X ,Y , And screen width into that Formula, So lets try it.

2*640+0 = 1280

Can you see how this formula applies to this.

IF SS(SL) =1 THEN BUFFER (SX(SL) + ( SY(SL) * XRES) ) = &H444444
IF SS(SL) =2 THEN BUFFER (SX(SL) + ( SY(SL) * XRES) ) = &H777777
IF SS(SL) =3 THEN BUFFER (SX(SL) + ( SY(SL) * XRES) ) = &HAAAAAA
IF SS(SL) =4 THEN BUFFER (SX(SL) + ( SY(SL) * XRES) ) = &HCCCCCC

can you see whats happening here.
« Last Edit: December 22, 2008 by ninogenio »
Challenge Trophies Won:

Offline bikerboy

  • Amiga 1200
  • ****
  • Posts: 349
  • Karma: 12
    • View Profile
Re: Hello everyone :)
« Reply #30 on: December 22, 2008 »
i think IF SS(SL) =4 THEN BUFFER (SX(SL) + ( SY(SL) * XRES) ) = &HCCCCCC tells the buffer to put the hex color &HCCCCCC  at array 4 and the (SX(SL) + ( SY(SL) * XRES) at what box to put it?

when you say box you mean pixel right?

and the S,SS,SL, what are those?

it's a bit confusing

EDIT: i kept thinking of your previous example and couldn't sleep so i stayed up all night thinking what could i do as an exersise (got me a headache too) lol :P

so i took this code from the "cardtro".

Code: [Select]
Screenres 640,480,32,2

dim buffer as integer
dim a as string
dim xText as double

xText=632:buffer=1

a="Hey what's up? :) !!      this is bikerboy at the k/b          what you see before you is my first attempt of a cardtro in freebasic, but i couldn't have done it without the help of some great guys :)           first of all i'd like to thank Shockwave for creating and maintaining DBF , DBF is the place to be :)        DrewPee - Benny! - hellfire - Hezad - rbz - , without your priceless help in coding this, i'd still be struggling          Stormbringer and the rest of the guys at www.retro-remakes.net for all those great intros they're remaking ,keep it up guys !         greets also go to everyone at DBF + GVY          i'd like to wish to all of you and your families the best for the holidays :)         the song you are listening is called 'MOD/Sidewinder..Xmas Jingles' and the author is Eric Gieseke           signing off bikerboy        scroller now restarts ... "
a=a+"                                                "
       
Do
    ScreenSync         
    ScreenSet buffer, buffer xor 1
    cls
   
    Draw String(xText,470),a
    xText=xText-1
    buffer= buffer xor 1
    if xText<(-len(a)*8) then xText=632
Loop until xText<((-len(a)*8)-16)

sleep

and made an ASCII scroller :D :D :carrot:

Code: [Select]
Screenres 640,480,32,2

dim buffer as integer
dim a as string
dim b as string
dim c as string
dim d as string
dim e as string
dim f as string
dim g as string
dim h as string
dim i as string
dim j as string
dim k as string

dim xText as double

xText=632:buffer=1
Color RGB(92,140,222),RGB(0,0,0)
a="      ___           ___           ___                                             ___           ___           ___           ___                                        ___           ___     "
b="     /\  \         /\__\         /\__\                                           /\__\         /\__\         /\  \         /\  \                                      /\__\         /\  \    "
c="    /::\  \       /:/ _/_       /:/  /        ___         ___                   /:/ _/_       /:/  /        /::\  \       /::\  \                                    /:/ _/_       /::\  \   "
d="   /:/\:\  \     /:/ /\  \     /:/  /        /\__\       /\__\                 /:/ /\  \     /:/  /        /:/\:\__\     /:/\:\  \                                  /:/ /\__\     /:/\:\__\  "
e="  /:/ /::\  \   /:/ /::\  \   /:/  /  ___   /:/__/      /:/__/                /:/ /::\  \   /:/  /  ___   /:/ /:/  /    /:/  \:\  \   ___     ___    ___     ___   /:/ /:/ _/_   /:/ /:/  /  "
f=" /:/_/:/\:\__\ /:/_/:/\:\__\ /:/__/  /\__\ /::\  \     /::\  \               /:/_/:/\:\__\ /:/__/  /\__\ /:/_/:/__/___ /:/__/ \:\__\ /\  \   /\__\  /\  \   /\__\ /:/_/:/ /\__\ /:/_/:/__/___"
g=" \:\/:/  \/__/ \:\/:/ /:/  / \:\  \ /:/  / \/\:\  \__  \/\:\  \__            \:\/:/ /:/  / \:\  \ /:/  / \:\/:::::/  / \:\  \ /:/  / \:\  \ /:/  /  \:\  \ /:/  / \:\/:/ /:/  / \:\/:::::/  /"
h="  \::/__/       \::/ /:/  /   \:\  /:/  /   ~~\:\/\__\  ~~\:\/\__\            \::/ /:/  /   \:\  /:/  /   \::/~~/~~~~   \:\  /:/  /   \:\  /:/  /    \:\  /:/  /   \::/_/:/  /   \::/~~/~~~~ "
i="   \:\  \        \/_/:/  /     \:\/:/  /       \::/  /     \::/  /             \/_/:/  /     \:\/:/  /     \:\~~\        \:\/:/  /     \:\/:/  /      \:\/:/  /     \:\/:/  /     \:\~~\     "
j="    \:\__\         /:/  /       \::/  /        /:/  /      /:/  /                /:/  /       \::/  /       \:\__\        \::/  /       \::/  /        \::/  /       \::/  /       \:\__\    "
k="     \/__/         \/__/         \/__/         \/__/       \/__/                 \/__/         \/__/         \/__/         \/__/         \/__/          \/__/         \/__/         \/__/    "

a=a+"                                                "
b=b+"                                                "
c=c+"                                                "
d=d+"                                                "
e=e+"                                                "
f=f+"                                                "
g=g+"                                                "
h=h+"                                                "
i=i+"                                                "
j=j+"                                                "
k=k+"                                                "

       
Do
    ScreenSync         
    ScreenSet buffer, buffer xor 1
    cls
    Draw String(xText,270),a
    Draw String(xText,280),b
    Draw String(xText,290),c
    Draw String(xText,300),d
    Draw String(xText,310),e
    Draw String(xText,320),f
    Draw String(xText,330),g
    Draw String(xText,340),h
    Draw String(xText,350),i
    Draw String(xText,360),j
    Draw String(xText,360),k

    xText=xText-1
    buffer= buffer xor 1
    if xText<(-len(a)*8) then xText=632
Loop until xText<((-len(a)*8)-16)

sleep

executable attached :D

Ps. i've never seen an ASCII scroller before, did i just discover the ASCII scroller? lol
« Last Edit: December 22, 2008 by bikerboy »


Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Ascii Scroller
« Reply #31 on: December 22, 2008 »
[This topic may now be posted in again in order to allow Bikerboy's demo to progress. Please keep it on topic! The subject matter appears to be ascii text scrolling.]
Shockwave ^ Codigos
Challenge Trophies Won:

Offline bikerboy

  • Amiga 1200
  • ****
  • Posts: 349
  • Karma: 12
    • View Profile
Re: Ascii Scroller
« Reply #32 on: December 22, 2008 »
it's ok there is no demo in progress here, i just came up with the ASCII scroller idea and wanted to share it in case someone is interested  :)


Offline Hezad

  • Sponsor
  • Pentium
  • *******
  • Posts: 613
  • Karma: 44
  • I believe .. in Patrick.
    • View Profile
    • Hezad.com Web hosting
Re: Ascii Scroller
« Reply #33 on: December 22, 2008 »
really nice ascii scroller :) I'm sure it would look awesome if the ASCII letters were sine-scrolling  ;D

Offline bikerboy

  • Amiga 1200
  • ****
  • Posts: 349
  • Karma: 12
    • View Profile
Re: Ascii Scroller
« Reply #34 on: December 23, 2008 »
really nice ascii scroller :) I'm sure it would look awesome if the ASCII letters were sine-scrolling  ;D

i'm not so sure b/c this particular scroller has 11 lines of text and since there is no font there but just plain text it might look distorted.

but then again it would look nice if it had a bit of a sine movement


Offline Hezad

  • Sponsor
  • Pentium
  • *******
  • Posts: 613
  • Karma: 44
  • I believe .. in Patrick.
    • View Profile
    • Hezad.com Web hosting
Re: Ascii Scroller
« Reply #35 on: December 24, 2008 »
Quote
i'm not so sure b/c this particular scroller has 11 lines of text and since there is no font there but just plain text it might look distorted.

Yeah, and that'd exactly be the awesome thing ^^ Something like that, but in movement :

|                                          __
|_|                                   __   |
|  |  __              |             |   __|
   |  |_ _   |        |    __     |__
      |_      |        |__   
          _   |___


It's totally, astoundingly ugly XD sorry for that, but you get the idea :) It'd look way better with your font  :D

just an idea though

Offline bikerboy

  • Amiga 1200
  • ****
  • Posts: 349
  • Karma: 12
    • View Profile
Re: Ascii Scroller
« Reply #36 on: December 24, 2008 »
yeah i guess it will look nice depending on the movement

i tried to add more lines to the sin scroller you gave me but couldn't make it happen

EDIT: tried to do this

Code: [Select]
Screenres 640,480,32,2

dim buffer as integer

dim a as string
dim b as string
dim c as string
dim d as string
dim e as string
dim f as string
dim g as string
dim h as string
dim m as string
dim j as string
dim k as string

dim xText as double




'' init Letters position (I assume a letter width and Height is 10)
For i as integer = 0 to 60
   
    Xtext(i) = 350+i*15
    Xtext(i) = 480

xText=632:buffer=1
Color RGB(92,140,222),RGB(0,0,0)
a="      ___           ___           ___                                             ___           ___           ___           ___                                        ___           ___     "
b="     /\  \         /\__\         /\__\                                           /\__\         /\__\         /\  \         /\  \                                      /\__\         /\  \    "
c="    /::\  \       /:/ _/_       /:/  /        ___         ___                   /:/ _/_       /:/  /        /::\  \       /::\  \                                    /:/ _/_       /::\  \   "
d="   /:/\:\  \     /:/ /\  \     /:/  /        /\__\       /\__\                 /:/ /\  \     /:/  /        /:/\:\__\     /:/\:\  \                                  /:/ /\__\     /:/\:\__\  "
e="  /:/ /::\  \   /:/ /::\  \   /:/  /  ___   /:/__/      /:/__/                /:/ /::\  \   /:/  /  ___   /:/ /:/  /    /:/  \:\  \   ___     ___    ___     ___   /:/ /:/ _/_   /:/ /:/  /  "
f=" /:/_/:/\:\__\ /:/_/:/\:\__\ /:/__/  /\__\ /::\  \     /::\  \               /:/_/:/\:\__\ /:/__/  /\__\ /:/_/:/__/___ /:/__/ \:\__\ /\  \   /\__\  /\  \   /\__\ /:/_/:/ /\__\ /:/_/:/__/___"
g=" \:\/:/  \/__/ \:\/:/ /:/  / \:\  \ /:/  / \/\:\  \__  \/\:\  \__            \:\/:/ /:/  / \:\  \ /:/  / \:\/:::::/  / \:\  \ /:/  / \:\  \ /:/  /  \:\  \ /:/  / \:\/:/ /:/  / \:\/:::::/  /"
h="  \::/__/       \::/ /:/  /   \:\  /:/  /   ~~\:\/\__\  ~~\:\/\__\            \::/ /:/  /   \:\  /:/  /   \::/~~/~~~~   \:\  /:/  /   \:\  /:/  /    \:\  /:/  /   \::/_/:/  /   \::/~~/~~~~ "
m="   \:\  \        \/_/:/  /     \:\/:/  /       \::/  /     \::/  /             \/_/:/  /     \:\/:/  /     \:\~~\        \:\/:/  /     \:\/:/  /      \:\/:/  /     \:\/:/  /     \:\~~\     "
j="    \:\__\         /:/  /       \::/  /        /:/  /      /:/  /                /:/  /       \::/  /       \:\__\        \::/  /       \::/  /        \::/  /       \::/  /       \:\__\    "
k="     \/__/         \/__/         \/__/         \/__/       \/__/                 \/__/         \/__/         \/__/         \/__/         \/__/          \/__/         \/__/         \/__/    "

a=a+"                                                "
b=b+"                                                "
c=c+"                                                "
d=d+"                                                "
e=e+"                                                "
f=f+"                                                "
g=g+"                                                "
h=h+"                                                "
m=m+"                                                "
j=j+"                                                "
k=k+"                                                "

       
Do
    ScreenSync         
    ScreenSet buffer, buffer xor 1
    cls
    Draw String(xText,270),a
    Draw String(xText,280),b
    Draw String(xText,290),c
    Draw String(xText,300),d
    Draw String(xText,310),e
    Draw String(xText,320),f
    Draw String(xText,330),g
    Draw String(xText,340),h
    Draw String(xText,350),i
    Draw String(xText,360),j
    Draw String(xText,360),k

For m as integer = 0 to 60
       
        Xtext(i) -= 0.4  ' scroll along X axis
       
        Xtext(i) = 165-15*sin(Xtext(i)/10)   ' Sine Scroll along Y axis (the distance of letters)
       
        Draw String(Xtext(i), Xtext(i)),Xtext(i),rgb(98,39,252)
       
       
        if Xtext(i)<0 then Xtext(i) = 640  '' if a letter is too far on the right, make it start again on the left
   
    Next
   
    Screenunlock : sleep 10
    cls
Loop until multikey(&h01)

and got this errors

Code: [Select]
Compiler output:
C:/Program Files/FreeBASIC/FreeBasic/FBIDETEMP.bas(25) error 67: Array not dimensioned, before '('
    Xtext(i) = 350+i*15
          ^
C:/Program Files/FreeBASIC/FreeBasic/FBIDETEMP.bas(26) error 67: Array not dimensioned, before '('
    Xtext(i) = 480
          ^
C:/Program Files/FreeBASIC/FreeBasic/FBIDETEMP.bas(67) error 55: Type mismatch, at parameter 5
    Draw String(xText,350),i
                           ^
C:/Program Files/FreeBASIC/FreeBasic/FBIDETEMP.bas(73) error 67: Array not dimensioned, before '('
        Xtext(i) -= 0.4  ' scroll along X axis
              ^
C:/Program Files/FreeBASIC/FreeBasic/FBIDETEMP.bas(75) error 67: Array not dimensioned, before '('
        Xtext(i) = 165-15*sin(Xtext(i)/10)   ' Sine Scroll along Y axis (the distance of letters)
              ^
C:/Program Files/FreeBASIC/FreeBasic/FBIDETEMP.bas(77) error 67: Array not dimensioned, before '('
        Draw String(Xtext(i), Xtext(i)),Xtext(i),rgb(98,39,252)
                          ^
C:/Program Files/FreeBASIC/FreeBasic/FBIDETEMP.bas(80) error 67: Array not dimensioned, before '('
        if Xtext(i)<0 then Xtext(i) = 640  '' if a letter is too far on the right, make it start again on the left
« Last Edit: December 24, 2008 by bikerboy »


Offline Hezad

  • Sponsor
  • Pentium
  • *******
  • Posts: 613
  • Karma: 44
  • I believe .. in Patrick.
    • View Profile
    • Hezad.com Web hosting
Re: Ascii Scroller
« Reply #37 on: December 24, 2008 »
First, never unlock the screen without having it locked !

You may have suppressed the -screenlock- I added and forgot to suppress ther screenunlock.
This said, Screenlock/screenunlock is, imho, way better (and user friendly) than screensetting.

e.g. :

replace
Code: [Select]
ScreenSet buffer, buffer xor 1with
Quote
Screenlock

Screenunlock is already here since I added it and you forgot to suppress it. So let it :)


Secondly, for the "array" errors, take a look at this :

Code: [Select]
dim xText as double
and then, this :
Quote
Xtext(i)

Don't you see something wrong ? xText is not declared as an array but it's used as an array !


Plus, you use a variable called "i" to loop through the array, but the variable is called "m" when you start the second for loop :

Plus, you didn't closed the first for-loop (for ... Next)

Code: [Select]
...
For [b]m[/b] as integer = 0 to 60
       
        Xtext([b]i[/b]) -= 0.4  ' scroll along X axis
...

Plus ....

There are really a lot of errors here, and to be honest, making those errors shows that you have a lack of basis knowledge about variables (you declare some variables as string and use it as integers [eg : "i"]), Array handling (already mentioned) and some other things.
That's not bad, you should just try to follow some basic tutorials :)

First, I'd start again from the working code (the first version) and try to think about the way I could handle the Sine stuff. First impression : The way you coded the ASCII text in the a,b,c,d... variables is an idea, but it'll be difficult to handle the Sine (You'll have to do some strings operations plus finding some offsets to make it work. Nothing impossible, but far from the easier).

Sorry, i'm in a hurry, i'll finish to speak about it later :)

Offline bikerboy

  • Amiga 1200
  • ****
  • Posts: 349
  • Karma: 12
    • View Profile
Re: Ascii Scroller
« Reply #38 on: December 24, 2008 »
That's not bad, you should just try to follow some basic tutorials :)

that is my main problem

where are those tutorials?

i mean even in the help file of FBIde there are either incomplete answers or examples for advanced users.

there should be a manual or something covering the basics, what commands FB has and what do they do, and variables and such.

everytime i see a code or try like the ASCIIsinscroller i go in blindly or guessing and hope it will work.


Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Ascii Scroller
« Reply #39 on: December 24, 2008 »
that is my main problem

where are those tutorials?
....
You can start reading this tutorial by Richard D. Clark / rdc, it got everything you need:
http://virtualink.wikidot.com/fbtut:fbasic

Challenge Trophies Won: