Page 1 of 1

what are libraries?

Posted: Sun Aug 21, 2005 3:14 pm
by ... or guest or ????
what are libraries?

Posted: Sun Aug 21, 2005 3:31 pm
by Rattrapmax6
Libraries are groups of SUB routines to include into the code.... If you have a hundred SUBs that are used for costum commands like:

Code: Select all

SUB TYPE(TEXT01$, X01, Y01)
    FOR i = 1 TO LEN(TEXT01$)
        T! = TIMER
        PTRL$ += MID$(TEXT01$, i, 1)
        LOCATE Y01, X01: PRINT PTRL$;
        DO: LOOP UNTIL (TIMER - T!) >= .2
    NEXT
END SUB
You could make them into a lib.... So, insted of the code being like this:

Code: Select all

DECLARE SUB TYPE(TEXT01$, X01, Y01)

TYPE "Hello, world", 1, 1
SLEEP

SUB TYPE(TEXT01$, X01, Y01)
    FOR i = 1 TO LEN(TEXT01$)
        T! = TIMER
        PTRL$ += MID$(TEXT01$, i, 1)
        LOCATE Y01, X01: PRINT PTRL$;
        DO: LOOP UNTIL (TIMER - T!) >= .2
    NEXT
END SUB
It be like this:

Code: Select all

'$include: 'type.bi'

TYPE "Hello, world", 1, 1
SLEEP
Cuts down on lines of code, and makes things look nicer.. :wink: ..

Quick compare: Libraries in life are buildings with books of knowlegde we can go to and use;;; Libraries in code are the same, the code can go to these files and use the routines from them...

Posted: Sun Aug 21, 2005 3:38 pm
by ... or guest or ????
i don't get what you mean by routines

Posted: Sun Aug 21, 2005 3:49 pm
by Rattrapmax6
Dictionary.com wrote:Routine

Computer Science. A set of programming instructions designed to perform a specific limited task.
Take my above example,. insted of doing this every time I want a typing effect:

Code: Select all

TEXT01$ = "Hello, world": X01 = 1: Y01 = 1

FOR i = 1 TO LEN(TEXT01$)
    T! = TIMER
    PTRL$ += MID$(TEXT01$, i, 1)
    LOCATE Y01, X01: PRINT PTRL$;
    DO: LOOP UNTIL (TIMER - T!) >= .2
NEXT

TEXT01$ = "How are you?": X01 = 1: Y01 = 2

FOR i = 1 TO LEN(TEXT01$)
    T! = TIMER
    PTRL$ += MID$(TEXT01$, i, 1)
    LOCATE Y01, X01: PRINT PTRL$;
    DO: LOOP UNTIL (TIMER - T!) >= .2
NEXT
I can make it a SUB routine and CALL it ever time I need it insted of coding it:

Code: Select all

TYPE "Hello, world", 1, 1

TYPE "How are you?", 1, 2

SUB TYPE(TEXT01$, X01, Y01)
    FOR i = 1 TO LEN(TEXT01$)
        T! = TIMER
        PTRL$ += MID$(TEXT01$, i, 1)
        LOCATE Y01, X01: PRINT PTRL$;
        DO: LOOP UNTIL (TIMER - T!) >= .2
    NEXT
END SUB
Thus making it a routine for the program to use.... You see how the library works above I hope,.. same thing, except its outside the code included in....

:wink:

Posted: Sun Aug 21, 2005 4:04 pm
by Z!re
A routine is also commonly known as a procedure, aka: Sub or function.

Posted: Sun Aug 21, 2005 7:17 pm
by ... or guest or ????
o
so it's like a sub
just to make things easier

Posted: Sun Aug 21, 2005 7:49 pm
by The Awakened
Yes, but often times libraries are written in a different programming language, especially assembly, to make things like drawing graphics really fast, or to do things like sound and music that would otherwise take a lot of study and expermentation.

Posted: Sun Aug 21, 2005 8:07 pm
by ... or guest or ????
o i think i get it more now
o yeah is there an easier way to do graphics than using that data table thingy because it takes forever to draw 1 small picture

Re: what are libraries?

Posted: Sun Aug 21, 2005 8:41 pm
by Nodtveidt
... or guest or ???? wrote:what are libraries?
Large buildings with many objects inside called "books"...they contain these things called "pages", on which are written "words".

:lol: :lol: :lol: :lol: :lol: :lol: :lol:

Posted: Sun Aug 21, 2005 8:46 pm
by MystikShadows
LOL Nek....I'm sure that answered all his questions ;-) LOL

Posted: Sun Aug 21, 2005 10:53 pm
by The Awakened
... or guest or ???? wrote:o i think i get it more now
o yeah is there an easier way to do graphics than using that data table thingy because it takes forever to draw 1 small picture
Look in the tutorials on Pete's site, specifically on commands like BSAVE, BLOAD, GET, PUT, and stuff like that.

Posted: Mon Aug 22, 2005 7:27 am
by {Nathan}
and under the download/utilities section: pp256.

Posted: Mon Aug 22, 2005 2:37 pm
by ... or guest or ????
i did look at those but bload and bsave thingies still need the data table thingy
and i don't get what Nathan mean

and that was really helpful Nek, if i was 10 years younger

Posted: Mon Aug 22, 2005 3:27 pm
by The Awakened
He said download PixelPlus 256. Excellent pixel art program, although as far as I know, you can only use the graphics it makes in Screen 13... which is pretty much the standard for QB games.

Posted: Mon Aug 22, 2005 4:59 pm
by {Nathan}
no... you can bload in any screen mode, you just haave to remember to only use certain colors. and some games use screen 7 and 0.

Posted: Mon Aug 22, 2005 6:59 pm
by Z!re
... or guest or ???? wrote:and that was really helpful Nek, if i was 10 years younger
Yes, I agree with Dave.. way to go Nek.. *shakes head*