Jump to content

Recommended Posts

Posted (edited)

i made a small sdlBasic converter, from parts list (like from toysperiod.com ) to .ldr file

a list like:

3005 2 Red
3065 5 White
3002 4 Blue

would result into:

1 4 0 0 100 1 0 0 0 1 0 0 0 1 3005
1 4 0 0 200 1 0 0 0 1 0 0 0 1 3005
1 15 100 0 100 1 0 0 0 1 0 0 0 1 3065
1 15 100 0 200 1 0 0 0 1 0 0 0 1 3065
1 15 100 0 300 1 0 0 0 1 0 0 0 1 3065
1 15 100 0 400 1 0 0 0 1 0 0 0 1 3065
1 15 100 0 500 1 0 0 0 1 0 0 0 1 3065
1 1 200 0 100 1 0 0 0 1 0 0 0 1 3002
1 1 200 0 200 1 0 0 0 1 0 0 0 1 3002
1 1 200 0 300 1 0 0 0 1 0 0 0 1 3002
1 1 200 0 400 1 0 0 0 1 0 0 0 1 3002

 

the code is: 

finp$="test.list.txt"
function lstinf$(a$,b$,c$)
    adra=1:adrb=1:blngt=len(b$):d$=""
  while adrb<=blngt
     if mid$ (a$,adra,1)=mid$ (b$,adrb,1) then:adrb+=1:end if
     adra=adra+1
   end while
  while mid$(a$,adra,1)<>left$(c$,1)
     d$=d$+mid$(a$,adra,1):adra=adra+1
   end while
     lstinf$=d$
 end function
fout$=finp$+".ldr"
open finp$ for input as #1:open fout$ for output as #2
dst=100:vamt=0
while eof(1)=0
  setcaption(finp$+"line:"+str$(vamt))
  file input #1,trln$
  trln$="> "+trln$+" 0 0 0 "
  q1$=lstinf$(trln$,"> "," ")
  q2$=lstinf$(trln$,">  "," ")
  q3$=lstinf$(trln$,">   "," ")
  v2=val(q2$)
  '-----
  if lcase$(q3$)="black" then:q3$="0":end if
  if lcase$(q3$)="blue" then:q3$="1":end if
  if lcase$(q3$)="green" then:q3$="2":end if
  if lcase$(q3$)="red" then:q3$="4":end if
  if lcase$(q3$)="grey" then:q3$="7":end if
  if lcase$(q3$)="oldgray" then:q3$="7":end if
  if lcase$(q3$)="lightgray" then:q3$="7":end if
  if lcase$(q3$)="yellow" then:q3$="14":end if
  if lcase$(q3$)="white" then:q3$="15":end if
  if lcase$(q3$)="multi" then:q3$="15":end if
  '-----
  if lcase$(q3$)="transparent" then:q3$="47":end if
  if lcase$(q3$)="clear" then:q3$="47":end if
  if lcase$(q3$)="transclear" then:q3$="47":end if
  if lcase$(q3$)="trgreen" then:q3$="35":end if
  if lcase$(q3$)="transgreen" then:q3$="35":end if
  if lcase$(q3$)="trred" then:q3$="36":end if
  if lcase$(q3$)="transred" then:q3$="36":end if
  if lcase$(q3$)="tryellow" then:q3$="46":end if
  if lcase$(q3$)="transyellow" then:q3$="46":end if
  '-----
  if lcase$(q3$)="darkturquoise" then:q3$="3":end if
  if lcase$(q3$)="darkpink" then:q3$="5":end if
  if lcase$(q3$)="brown" then:q3$="6":end if
  if lcase$(q3$)="darkgray" then:q3$="8":end if
  if lcase$(q3$)="lightblue" then:q3$="9":end if
  if lcase$(q3$)="brightgreen" then:q3$="10":end if
  if lcase$(q3$)="lightturquoise" then:q3$="11":end if
  if lcase$(q3$)="salmon" then:q3$="12":end if
  if lcase$(q3$)="pink" then:q3$="13":end if
  if lcase$(q3$)="maincolour" then:q3$="16":end if
  if lcase$(q3$)="lightgreen" then:q3$="17":end if
  if lcase$(q3$)="lightyellow" then:q3$="18":end if
  if lcase$(q3$)="tan" then:q3$="19":end if
  if lcase$(q3$)="lightviolet" then:q3$="20":end if
  if lcase$(q3$)="purple" then:q3$="22":end if
  if lcase$(q3$)="darkblueviolet" then:q3$="23":end if
  if lcase$(q3$)="orange" then:q3$="25":end if
  if lcase$(q3$)="brightlightyellow" then:q3$="226":end if
  if lcase$(q3$)="verylightgray" then:q3$="503":end if
  '-----
  for l2=1 to v2
    stou$="1 "+q3$+" "+str$(vamt*dst)+" -24 "+str$((l2-1)*dst)+" 1 0 0 0 1 0 0 0 1 "+q1$
    print #2,stou$
    next
  vamt=vamt+1
  wend
close #1:close #2

 

Edited by nitrofurano
updated script
  • Fugazi changed the title to I made a parts list to .ldr converter script

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...