LB Booster
« The puppet master recorder and play tool »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 03:57am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: The puppet master recorder and play tool  (Read 470 times)
michael
New Member
Image


member is offline

Avatar




PM


Posts: 28
xx The puppet master recorder and play tool
« Thread started on: Mar 24th, 2016, 2:33pm »

OK -- play with me for a bit.. when you run this program HOLD DOWN YOUR LEFT MOUSE BUTTON drag the ring around for a while and then close the window..


After you do that, go down to the next program on the next reply and run it... HE HE HE!!

Code:
call screen 1200,800' I made this for a generic host screen call (#h-window) #h.1 is graphic box.
#h.1 "down; fill black"
gcolor$= "white" ' lets give a default color
hpos=0
vpos=0
open "recorder" for output as #f
'**********name**x***y***size*R***G**B*Dimmer
call ring "ring",100,300,100,200,150,200,4
'^^^^^^ nameing it ring gives the BMP image a name..
'^^^^^^ it will become ring1 after in later sprite commands.
'^^^^^^ this will now apply to sphere as well
mx=100' I set the location of the sprite to mx, my locations for mouse
my=100
[loop]
'****** I put ring1 instead of ring because it was renamed for sprite
#h.1 "spritexy ring1 ";mx;" ";my
print #f, mx
print #f, my
'****** remember that for future names you will always add 1 to the name
'#h.1 "spritemovexy ring1 1 1"
mx=MouseX
my=MouseY
#h.1 "drawsprites"
scan
#h.1 "when leftButtonMove [loop]"

wait
[quit]
 #h.1 "discard"
 close #f
 close #h
 end

'     LOOK UP ^^^^ that's how big your code is with description.
'     Making sprites never was so easy
'***************************************************************
'*****   I moved the globals down to make a clean work space   *
'***************************************************************
sub screen x,y
nomainwin
WindowWidth=x
WindowHeight=y
UpperLeftX=0
UpperLeftY=0
global name$
global name1$
global getsizeh' globals have been moved to make it a cleaner interface
global getsizev
global hpos ' the horizontal locators for ENTER sub
global vpos ' the vertical locator for ENTER sub
global gcolor$   ' YOU MUST DEFINE gcolor$ BEFORE you use GRPRINT or ENTER but it only needs to be done once
graphicbox #h.1, 0,0,1000,700
open "Generic Window Host" for window_nf as #h
print #h, "trapclose [quit]"
end sub

sub ring n$,h,v,size,x,c,a,dimmer ' dimmer cannot be more than 24- this command is sprite ready
name$=n$' see if assigning the global variable to n$ will solve the error
hpos=h-size  ' get the starting location for image capture
calcv=size*3
vpos=v-calcv
#h.1 "place ";h-5;" ";v-size
#h.1 "down;color white"
othervar=size*2
othervar2=size
bh=h-size : bv=v-othervar-othervar2-5 : v2=size*2
othersize=size+2
for fnl=1 to othersize*2
st=st+1
#h.1 "line ";bh;" ";bv+st;" ";bh+v2;" ";bv+st
next fnl
nv= size*2
nv2= v-nv
#h.1 "place ";h;" ";nv2
#h.1 "color black"
#h.1 "backcolor black"
#h.1 "circlefilled ";size
getsizeh= size*2
getsizev= size*4
rsize= size/4
inner=rsize/2
fcenter=size-rsize
r=0
switch=0
for y=1 to size
#h.1 "place ";h;" ";v
#h.1 "down"
#h.1 "color ";x;" ";c;" ";a
#h.1 "size 2"
r=r+1
if fcenter+r> size then switch=1:goto [jump]
#h.1 "circle ";fcenter-r
#h.1 "circle ";fcenter+r
[jump]
if switch=1 then print #h.1, "place ";h;" ";nv2;"down;color white;backcolor white;circlefilled ";fcenter-r
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
#h.1 "flush"
#h.1 "getbmp ";name$;" ";hpos;" ";vpos;" ";getsizeh;" ";getsizev
name1$=name$+"1"
#h.1 "addsprite ";name1$;" ";name$
#h.1 "centersprite ";name1$
end sub

sub enter message$
#h.1 "place ";hpos;" ";vpos
#h.1 "backcolor black"
#h.1 "color ";gcolor$
#h.1 "\";message$
vpos=vpos+20
end sub


sub gline x,y,h,v  ' its my attempt to bring back a line command. like in the old days
#h.1 "backcolor black"
#h.1 "color ";gcolor$
#h.1 "line ";x;" ";y;" ";h;" ";v
end sub

sub grprint x,y,message$
    #h.1 "backcolor black"
    #h.1 "up"
    #h.1 "place ";x;" ";y
    #h.1 "down"
    #h.1 "color ";gcolor$
    #h.1 "\";message$
    end sub

sub sphere n$,h,v,size,x,c,a,dimmer ' dimmer cannot be more than 24- this command is sprite ready
name$=n$
hpos=h-size  ' get the starting location for image capture
calcv=size*3
vpos=v-calcv
#h.1 "place ";h-5;" ";v-size
#h.1 "down;color white"
othervar=size*2
othervar2=size
bh=h-size : bv=v-othervar-othervar2-5 : v2=size*2
othersize=size+2
for fnl=1 to othersize*2
st=st+1
#h.1 "line ";bh;" ";bv+st;" ";bh+v2;" ";bv+st
next fnl
nv= size*2
nv2= v-nv
#h.1 "place ";h;" ";nv2
#h.1 "color black"
#h.1 "backcolor black"
#h.1 "circlefilled ";size
getsizeh= size*2
getsizev= size*4
for y=1 to size
#h.1 "place ";h;" ";v
#h.1 "down"
#h.1 "color ";x;" ";c;" ";a
#h.1 "size 2"
#h.1 "circle ";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
next y
#h.1 "flush"
#h.1 "getbmp ";name$;" ";hpos;" ";vpos;" ";getsizeh;" ";getsizev
name1$=name$+"1"
#h.1 "addsprite ";name1$;" ";name$
#h.1 "centersprite ";name1$
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
#h.1 "place ";h;" ";v
p=size/2
for y=1 to size
#h.1 "down"
#h.1 "color ";x;" ";c;" ";a
#h.1 "size 1"
print #h.1, "line ";h-y;" ";v-y;" ";h+y;" ";v-y
print #h.1, "line ";h+y;" ";v-y;" ";h+y;" ";v+y
print #h.1, "line ";h+y;" ";v+y;" ";h-y;" ";v+y
print #h.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
#h.1 "place ";h;" ";v
if sizex>sizey then limit=sizex
if sizey>sizex then limit=sizey
for y=1 to limit
#h.1 "down"
#h.1 "color ";x;" ";c;" ";a
#h.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
#h.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

sub rect x,y,h,v
#h.1 "down"
#h.1 "color ";gcolor$
#h.1 "size 1"
print #h.1, "line ";x;" ";y;" ";h;" ";y
print #h.1, "line ";h;" ";y;" ";h;" ";v
print #h.1, "line ";h;" ";v;" ";x;" ";v
print #h.1, "line ";x;" ";v;" ";x;" ";y
end sub

 
User IP Logged

I make program generators and some utilities. Its my hobby
michael
New Member
Image


member is offline

Avatar




PM


Posts: 28
xx Re: The puppet master recorder and play tool
« Reply #1 on: Mar 24th, 2016, 2:34pm »

OK now run this program and watch the show!!
It has been modified to load all your actions and replay them.
This is very cool... but the thing is that you could technically make it only store a fraction of the information and set up the program to seek for the next positions.
Code:
call screen 1200,800' I made this for a generic host screen call (#h-window) #h.1 is graphic box.
#h.1 "down; fill black"
gcolor$= "white" ' lets give a default color
hpos=0
vpos=0
open "recorder" for input as #f
'**********name**x***y***size*R***G**B*Dimmer
call ring "ring",100,300,100,200,150,200,4
'^^^^^^ nameing it ring gives the BMP image a name..
'^^^^^^ it will become ring1 after in later sprite commands.
'^^^^^^ this will now apply to sphere as well
mx=100' I set the location of the sprite to mx, my locations for mouse
my=100
[loop]
'****** I put ring1 instead of ring because it was renamed for sprite
#h.1 "spritexy ring1 ";mx;" ";my
input #f, mx
input #f, my
call pause 10
if eof(#f)<0 then [quit]
'****** remember that for future names you will always add 1 to the name
'#h.1 "spritemovexy ring1 1 1"
'mx=MouseX
'my=MouseY
#h.1 "drawsprites"
scan
'#h.1 "when leftButtonMove [loop]"
goto [loop]

wait
[quit]
 #h.1 "discard"
 close #f
 close #h
 end

'     LOOK UP ^^^^ that's how big your code is with description.
'     Making sprites never was so easy
'***************************************************************
'*****   I moved the globals down to make a clean work space   *
'***************************************************************
sub pause mil
     t=time$("milliseconds")
     while time$("milliseconds")<t+mil
     wend
   end sub
sub screen x,y
nomainwin
WindowWidth=x
WindowHeight=y
UpperLeftX=0
UpperLeftY=0
global name$
global name1$
global getsizeh' globals have been moved to make it a cleaner interface
global getsizev
global hpos ' the horizontal locators for ENTER sub
global vpos ' the vertical locator for ENTER sub
global gcolor$   ' YOU MUST DEFINE gcolor$ BEFORE you use GRPRINT or ENTER but it only needs to be done once
graphicbox #h.1, 0,0,1000,700
open "Generic Window Host" for window_nf as #h
print #h, "trapclose [quit]"
end sub

sub ring n$,h,v,size,x,c,a,dimmer ' dimmer cannot be more than 24- this command is sprite ready
name$=n$' see if assigning the global variable to n$ will solve the error
hpos=h-size  ' get the starting location for image capture
calcv=size*3
vpos=v-calcv
#h.1 "place ";h-5;" ";v-size
#h.1 "down;color white"
othervar=size*2
othervar2=size
bh=h-size : bv=v-othervar-othervar2-5 : v2=size*2
othersize=size+2
for fnl=1 to othersize*2
st=st+1
#h.1 "line ";bh;" ";bv+st;" ";bh+v2;" ";bv+st
next fnl
nv= size*2
nv2= v-nv
#h.1 "place ";h;" ";nv2
#h.1 "color black"
#h.1 "backcolor black"
#h.1 "circlefilled ";size
getsizeh= size*2
getsizev= size*4
rsize= size/4
inner=rsize/2
fcenter=size-rsize
r=0
switch=0
for y=1 to size
#h.1 "place ";h;" ";v
#h.1 "down"
#h.1 "color ";x;" ";c;" ";a
#h.1 "size 2"
r=r+1
if fcenter+r> size then switch=1:goto [jump]
#h.1 "circle ";fcenter-r
#h.1 "circle ";fcenter+r
[jump]
if switch=1 then print #h.1, "place ";h;" ";nv2;"down;color white;backcolor white;circlefilled ";fcenter-r
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
#h.1 "flush"
#h.1 "getbmp ";name$;" ";hpos;" ";vpos;" ";getsizeh;" ";getsizev
name1$=name$+"1"
#h.1 "addsprite ";name1$;" ";name$
#h.1 "centersprite ";name1$
end sub

sub enter message$
#h.1 "place ";hpos;" ";vpos
#h.1 "backcolor black"
#h.1 "color ";gcolor$
#h.1 "\";message$
vpos=vpos+20
end sub


sub gline x,y,h,v  ' its my attempt to bring back a line command. like in the old days
#h.1 "backcolor black"
#h.1 "color ";gcolor$
#h.1 "line ";x;" ";y;" ";h;" ";v
end sub

sub grprint x,y,message$
    #h.1 "backcolor black"
    #h.1 "up"
    #h.1 "place ";x;" ";y
    #h.1 "down"
    #h.1 "color ";gcolor$
    #h.1 "\";message$
    end sub

sub sphere n$,h,v,size,x,c,a,dimmer ' dimmer cannot be more than 24- this command is sprite ready
name$=n$
hpos=h-size  ' get the starting location for image capture
calcv=size*3
vpos=v-calcv
#h.1 "place ";h-5;" ";v-size
#h.1 "down;color white"
othervar=size*2
othervar2=size
bh=h-size : bv=v-othervar-othervar2-5 : v2=size*2
othersize=size+2
for fnl=1 to othersize*2
st=st+1
#h.1 "line ";bh;" ";bv+st;" ";bh+v2;" ";bv+st
next fnl
nv= size*2
nv2= v-nv
#h.1 "place ";h;" ";nv2
#h.1 "color black"
#h.1 "backcolor black"
#h.1 "circlefilled ";size
getsizeh= size*2
getsizev= size*4
for y=1 to size
#h.1 "place ";h;" ";v
#h.1 "down"
#h.1 "color ";x;" ";c;" ";a
#h.1 "size 2"
#h.1 "circle ";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
next y
#h.1 "flush"
#h.1 "getbmp ";name$;" ";hpos;" ";vpos;" ";getsizeh;" ";getsizev
name1$=name$+"1"
#h.1 "addsprite ";name1$;" ";name$
#h.1 "centersprite ";name1$
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
#h.1 "place ";h;" ";v
p=size/2
for y=1 to size
#h.1 "down"
#h.1 "color ";x;" ";c;" ";a
#h.1 "size 1"
print #h.1, "line ";h-y;" ";v-y;" ";h+y;" ";v-y
print #h.1, "line ";h+y;" ";v-y;" ";h+y;" ";v+y
print #h.1, "line ";h+y;" ";v+y;" ";h-y;" ";v+y
print #h.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
#h.1 "place ";h;" ";v
if sizex>sizey then limit=sizex
if sizey>sizex then limit=sizey
for y=1 to limit
#h.1 "down"
#h.1 "color ";x;" ";c;" ";a
#h.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
#h.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

sub rect x,y,h,v
#h.1 "down"
#h.1 "color ";gcolor$
#h.1 "size 1"
print #h.1, "line ";x;" ";y;" ";h;" ";y
print #h.1, "line ";h;" ";y;" ";h;" ";v
print #h.1, "line ";h;" ";v;" ";x;" ";v
print #h.1, "line ";x;" ";v;" ";x;" ";y
end sub

 

« Last Edit: Mar 24th, 2016, 2:39pm by michael » User IP Logged

I make program generators and some utilities. Its my hobby
michael
New Member
Image


member is offline

Avatar




PM


Posts: 28
xx Re: The puppet master recorder and play tool
« Reply #2 on: May 3rd, 2016, 04:21am »

For the current conversation for this example
User IP Logged

I make program generators and some utilities. Its my hobby
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls