LB Booster
General >> General Board >> Richard: 'include
http://lbb.conforums.com/index.cgi?board=general&action=display&num=1442255392

Richard: 'include
Post by michael on Sep 14th, 2015, 6:29pm

I just didn't keep posting, because my example wasn't dealt with and I didn't want to irritate anyone.. so I have been talking to mmiscool on the phone and he says he knows how to make it work.
He is busy too and I am having to learn C++ for the ESP8266 wifi module and Im having issues with the LB interface for the slave Arduino Uno... (freezes up on my modifications for switch control.)
I was gonna ask you if you were willing to contribute to the public art forums for graphics creations that everyone can use for anything, but I didn't want to poke at you.
You can do it your way.. I have seen your work and it is impressive..
Your skills would be an asset to your platform as well as Liberty Basic.
So far Im the only one doing the work and I don't mind it because its my hobby to make free stuff for everyone.
I am a free public software contributor and want to help everyone.
If you are interested here is the link:
http://canevian.conforums.com/index.cgi?board=Development
I am putting more content in there all the time and promoting it for public use.

Re: Richard: 'include
Post by tsh73 on Sep 14th, 2015, 8:58pm

Quote:
I just didn't keep posting, because my example wasn't dealt with and I didn't want to irritate anyone..

If you are speaking about your use of 'include,
you was told that
1) Include is tested to work, so you might be doing something wrong
2) 'include doesn't work on a first line.

Here I moved that line to the end of program. It works for me.
Code:
nomainwin
 open "The sphere subroutine !!Created by Michael Gallup (free for the public to use)" for graphics_nsb_fs as #1
 #1 "trapclose [quit]"
 #1 "fill black ; home ; down ; north"
'************H***V***S***R***G***B**Dimmer
call sphere 500,500,220,225,240,250,1
call sphere 50,50,25,225,240,250,9
call sphere 100,100,50,200,200,200,4
call sphere 200,200,100,140,200,200,2
wait
[quit]
close #1
end
'include mytools.bas
 


Re: Richard: 'include
Post by michael on Sep 14th, 2015, 9:02pm

Ok thanks.. I am only using LBB for this.. I didn't use Liberty Basic Workshop because I was told it would work fine in LBB.
I will use your example and see if it works this time.. Maybe its where the files are saved that is causing the issue.
I thought I did it the way your showing.
Re: Richard: 'include
Post by michael on Sep 14th, 2015, 9:35pm

ok. it works now for that type of example..
The example program I used was a quick snippet I slapped together and was not the original program I had issues with..
I made sure my savefile was all lower case and I was able to make it work in the above program.

The next one, even though it executes, wont open graphics screen.
But if I make a generic graphics screen sub command, it will open a text box and wont display the graphics: here is the main program:
Code:
call screen ' I made this for a generic screen call
call sphere 500,500,220,225,240,250,1'sphere h,v,size,R,G,B,dimmer  --syntax
call block 100,50,20,200,200,200,8' block x,y,size,R,G,B,dimmer
call ellipse 100,500,250,100,225,240,250,2 ' ellipse x,y,width,height,R,G,B,dimmer
call circle 800,600,20,"green" 'circle x,y,size,"color"
call chip 700,700,100,"lightgray","black","blue"'chip x,y,size, color$ , topcolor$,midcolor$ 
call star 100,200,"starhalf"  'star h,v,"half or full star"
call star 200,120,"starfull"
wait
[quit]
  close #1
 end
'include tools.BAS
 

and here is the program named tools.BAS
LBB saves the files with uppercase BAS.. so maybe that's important
Code:
sub sphere h,v,size,x,c,a,dimmer ' dimmer cannot be more than 24
#1 "place ";h;" ";v
for y=1 to size
#1 "down"
#1 "color ";x;" ";c;" ";a
#1 "size 2"
#1 "circle ";y
#1 "flush"
x=x-dimmer
c=c-dimmer
a=a-dimmer
if x<2 then x=2
if c<2 then c=2
if a<2 then a=2
next y
end sub
'block h,v,size,R,G,B,dimmer
sub block h,v,size,x,c,a,dimmer ' dimmer cannot be more than 24
#1 "place ";h;" ";v
p=size/2
for y=1 to size
#1 "down"
#1 "color ";x;" ";c;" ";a
#1 "size 1"
print #1, "line ";h-y;" ";v-y;" ";h+y;" ";v-y
print #1, "line ";h+y;" ";v-y;" ";h+y;" ";v+y
print #1, "line ";h+y;" ";v+y;" ";h-y;" ";v+y
print #1, "line ";h-y;" ";v+y;" ";h-y;" ";v-y
x=x-dimmer
c=c-dimmer
a=a-dimmer
if x<2 then x=2
if c<2 then c=2
if a<2 then a=2
p=p-1
next y
end sub
'ellipse h,v,sizex,sizey,R,G,B,dimmer
sub ellipse h,v,sizex,sizey,x,c,a,dimmer ' dimmer cannot be more than 24
#1 "place ";h;" ";v
if sizex>sizey then limit=sizex
if sizey>sizex then limit=sizey
for y=1 to limit
#1 "down"
#1 "color ";x;" ";c;" ";a
#1 "size 2"
hi=hi+1:if sizex>sizey then hi=hi+1
wi=wi+1:if sizey>sizex then wi=wi+1
if hi>sizex then hi=sizex
if wi>sizey then wi=sizey
#1 "ellipse ";hi;" ";wi
x=x-dimmer
c=c-dimmer
a=a-dimmer
if x<2 then x=2
if c<2 then c=2
if a<2 then a=2
next y
end sub
'initialize generic screen
sub screen
   nomainwin
   open "Another way of doing graphics !!" for graphics_nsb_fs as #1
   print #1, "Down trapclose [quit]"

    print #1, "fill black ; home ; down ; north"
end sub
' generic circle   syntax -  circle horizontal, vertical, size, color$
sub circle x, y, size, color$
   print #1," place  "; x;" ";y
   print #1," color "; color$
   print #1," circle "; size
end sub

sub color c$
print #1, "color ";c$
end sub
'chip x,y,size, color$,topcolor$,midcolor$
sub chip x,y,size, color$ , topcolor$,midcolor$            '******** HERE IS THE CHIP SUB FOR THIS PROJECT
print #1, "down"
if size< 30 then size =30
print #1, "color ";color$
for nloc= 1 to size/10
print #1,"place "; x;" ";y-nloc
print #1, "ellipsefilled ";size;" ";size/2
next nloc
print #1, "flush"
print #1, "color ";topcolor$
print #1, "ellipsefilled ";size;" ";size/2
print #1, "flush"
print #1, "color ";midcolor$
m= size/4
print #1, "ellipsefilled ";size/2;" ";m
print #1, "flush"
end sub
' ****************** RATING STARS **************

sub star h, v, type$
    if type$ ="starhalf" then restore [starhalf]
    if type$ ="starfull" then restore [starfull]
    ost$ =""
    read x, y

    while nst$ <>"100000"
        read nst$, t
        if nst$ ="0" then r =  0: g=   0:  b=   0   'black         0   0   0
        if nst$ ="3" then r =128: g= 128:  b= 128   'dark grey   128 128 128
        if nst$ ="b" then r =224: g=  32:  b=  64   'light red   224  32  64
        if nst$ ="h" then r =255: g= 255:  b= 255   'white       255 255 255
        if nst$ ="i" then r =255: g= 255:  b=   0   'yellow      255 255   0
        #1 "color "; r; " "; g; " "; b
        for u =0 to t
            a =a +1
            #1 "set "; c +h; " "; a +v
            if a >x  then c =c +1: a =0
        next u
    wend
    #1 "flush"

  [starhalf]
    data 16,16
    data 0,5,b,0,0,15,b,1,0,14,b,0,h,0,b,0,0,13,b,0,i,0,b,0,0,4,b,1,0,6,b,0,i,1,b,0,0,0,b,3,0
    data 7,b,0,i,2,b,0,h,0,i,1,b,0,0,7,b,0,i,5,b,0,0,5,b,2,i,5,h,0,b,0,0,3,b,1,h,1,i,6,b,0
    data 100000,0

  [starfull]
    data 16,16
    data 0,5,b,0,0,15,b,1,0,14,b,0,h,0,b,0,0,13,b,0,i,0,b,0,0,4,b,1,0,6,b,0,i,1,b,0,0,0,b,3,0
    data 7,b,0,i,2,b,0,h,0,i,1,b,0,0,7,b,0,i,5,b,0,0,5,b,2,i,5,h,0,b,0,0,3,b,1,h,1,i,6,b,0
    data 0,6,b,2,h,0,i,5,b,0,0,8,b,0,i,2,h,1,i,0,b,0,0,8,b,0,i,1,h,0,b,0,h,2,b,0,0,7,b,0,i
    data 0,h,0,b,0,0,0,b,3,0,7,b,0,h,0,b,0,0,4,b,1,0,6,b,0,h,0,b,0,0,13,b,1,100000,0

end sub

      

Re: Richard: 'include
Post by michael on Sep 14th, 2015, 9:50pm

OH!!! I FIGURED IT OUT
I have to press ENTER after I type the 'INCLUDE line....
on the same line....
I seen something about that but didn't realize it meant that you had to press enter after the line was typed
Re: Richard: 'include
Post by Richard Russell on Sep 15th, 2015, 05:51am

on Sep 14th, 2015, 9:50pm, michael wrote:
I seen something about that but didn't realize it meant that you had to press enter after the line was typed

Ah, I wrote that you need a CRLF after the 'include: I assumed you would know that CRLF (Carriage Return, Line Feed) means a 'new line', i.e. what you get from pressing the Enter or Return key.

Richard.

Re: Richard: 'include
Post by michael on Sep 15th, 2015, 06:27am

Yeah.. I didn't know what your terminology meant.

I am sure there will be many others that wont understand it either.

Once I know though, I will be around to help others understand in Layman's terms.

Thanks.