-- By me_hungry
!currentitem = !!ce
-- values inside not processed file
!readarray = object ARRAY()
-- replacement file dir
!fileelement = object FILE('d:\ReplacementSpecs.txt')
!fileelement.DeleteFile()
-- Output file dir
!uofileelement = object FILE('d:\OutputSpecsFile.txt')
!uofileelement.DeleteFile()
var !spearr coll all spec with(matchwild(name,'*LIMBOSPEC*') ne true) for ce
speconmode
-- formate
do !specs values !spearr
$!specs
-- create file
file /$!fileelement overwrite output ce file end
-- replace /* in file
!readarray = !fileelement.readFile()
-- values inside new file
!valinnewfile = object ARRAY()
do !readval values !readarray
!readval = !readval.replace('*/',!specs.dbref().name + '/')
!valinnewfile.append(!readval)
enddo
!uofileelement.writeFile('APPEND', !valinnewfile)
enddo
exit
$!currentitem
!fileelement.DeleteFile()
!outputFolder = '[COLOR=#FF0000]C:\temp\specs\[/COLOR]'
!outputFolderOF = OBJECT FILE(!outputFolder)
if (!outputFolderOF.Exists().Not()) then
!!Alert.Message('Please first create folder
$!outputFolder')
RETURN
endif
if (!!CE.Type NEQ 'SPWL') then
!!Alert.Message('Works only on SPWL level')
RETURN
endif
!getCE = !!CE.Name
VAR !specs COLLECT ALL SPEC WITH ( NOT ( MATCHW(NAME,'*LIMBO*') ) ) FOR CE
do !x from 1 to !specs.Size()
!outputArray = OBJECT ARRAY()
!outputFileName = !outputFolder + !specs[!x].Dbref().Name.Replace('/','_') + '.csv'
!outputFileNameOF = object file(!outputFileName)
!outputArray.Append('Specification: ' + !specs[!x].Dbref().Name)
var !GtypSele COLLECT ALL SPEC MEM WITH (TYPE EQ 'SELE') for $!specs[$!x]
do !y from 1 to !GtypSele.Size()
!outputArray.Append(!GtypSele[!y].Dbref().Tans)
!GtypSeleDepth = !GtypSele[!y].Dbref().Dbdept
VAR !spcos COLLECT ALL SPCO FOR $!GtypSele[$!y]
!outputArray.Append('Spco Name;Catref;Detail;Matxt;Cmpref')
do !z from 1 to !spcos.Size()
!outputString = ''
!getCatref = !spcos[!z].Dbref().Catref.Name
HANDLE ANY
!getCatref = 'No valid Catref or unset'
ENDHANDLE
!getDetail = !spcos[!z].Dbref().Detref.Name
HANDLE ANY
!getDetail = 'No valid Detref or unset'
ENDHANDLE
!getMatref = !spcos[!z].Dbref().Matxt.Name
HANDLE ANY
!getMatref = 'No valid Matref or unset'
ENDHANDLE
!getCmpref = !spcos[!z].Dbref().Cmpref.Name
HANDLE ANY
!getCmpref = 'No valid Cmpref or unset'
ENDHANDLE
!spcoDepth = !spcos[!z].Dbref().Dbdepth
!GetDepthUntilGtyp = !spcoDepth - !GtypSeleDepth - 1
!outputString = !outputString + !spcos[!z].Dbref().Name + ';' + !getCatref + ';' + !getDetail + ';' + !getMatref + ';' + !getCmpref
!outputArray.Append(!outputString)
!outputString = ''
!spcoOwnerQuestion = !spcos[!z].Dbref().Owner.Tquest
!spcoAnswer = !spcos[!z].Dbref().Tanswer
!spcoMaxAnswer = ''
if (!spcoOwnerQuestion EQ '') then
!spcoOwnerQuestion = !spcos[!z].Dbref().Owner.Quest
endif
if (!spcoAnswer EQ '') then
!spcoAnswer = !spcos[!z].Dbref().Answer.String()
!spcoMaxAnswer = '(MaxAns=' + !spcos[!z].Dbref().MaxAnswer.String() + ')'
endif
if (!spcoOwnerQuestion EQ 'PBOR') then
!spcoOwnerQuestion = !spcoOwnerQuestion + !spcos[!z].Dbref().Owner.Qual.String()
endif
!outputString = !outputString + !spcoOwnerQuestion + '=' + !spcoAnswer + !spcoMaxAnswer
$!spcos[$!z]
do !a from 1 to !getDepthUntilGtyp
OWNER
!seleOwnerQuestion = !!CE.Owner.Tquest
!seleAnswer = !!CE.Tanswer
!seleMaxAnswer = ''
if (!seleOwnerQuestion EQ '') then
!seleOwnerQuestion = !!CE.Owner.Quest
endif
if (!seleAnswer EQ '') then
!seleAnswer = !!CE.Answer.String()
!seleMaxAnswer = '(MaxAns=' + !!CE.MaxAnswer.String() + ')'
endif
if (!seleOwnerQuestion EQ 'PBOR') then
!seleOwnerQuestion = !seleOwnerQuestion + !!CE.Owner.Qual.String()
endif
!outputString = !outputString + '<--' + !seleOwnerQuestion + '=' + !seleAnswer + !seleMaxAnswer
enddo
!outputArray.Append(!outputString)
!outputArray.Append('')
enddo
!outputArray.Append('')
enddo
!outputArray.Append('')
!outputFileNameOF.WriteFile('OVERWRITE',!outputArray)
enddo
$!getCE