Advertisement
Guest User

FH Preset Maker v2 Source code

a guest
Jan 13th, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 55.06 KB | None | 0 0
  1. #include <File.au3>
  2. #include <Array.au3>
  3. #include <GUIConstantsEx.au3>
  4. #include <StaticConstants.au3>
  5. #include <WindowsConstants.au3>
  6. #include <Color.au3>
  7. #include <ListViewConstants.au3>
  8. #include <GuiListView.au3>
  9. #include <ListboxConstants.au3>
  10. #include <EditConstants.au3>
  11. ;=========================
  12.  
  13. Local $bodypartsArray[10] = ["BodyL","BodyR","EquipL","EquipR","EyeL","EyeR","HeadL","HeadR","Mane","Tail"]
  14.  
  15. ;=========================
  16. ;file exists checks
  17. If FileExists(@ScriptDir) Then
  18.    ; :)
  19. Else
  20.    error("Program directory could not be found",1) ;o.o how does that even work??
  21. EndIf
  22. $selfd = @ScriptDir
  23. If FileExists($selfd&"\resources") Then
  24.    ; :)
  25. Else
  26.    error("Resource directory could not be found",1)
  27. EndIf
  28. $resd = $selfd&"\resources"
  29. SplashImageOn("", $resd&"\logo.jpg", 300,300, -1, -1,1)
  30. If FileExists($resd&"\temp") Then
  31.    ; :)
  32. Else
  33.    error("Temp storage folder could not be found",1)
  34. EndIf
  35. $tempd = $resd&"\temp"
  36.  
  37. If FileExists($selfd&"\scripts") Then
  38.    ; :)
  39. Else
  40.    error("scripts folder could not be found",1)
  41. EndIf
  42. $scriptsd = $selfd&"\scripts"
  43.  
  44. ClearAllLayers() ;replaced with only the finest function technology xD
  45.  
  46. $filey = $tempd&"\layers\sse.txt"
  47. if FileExists($filey) Then
  48.    FileDelete($filey)
  49. EndIf
  50. FileWriteLine($filey,"0")
  51. FileWriteLine($filey,"0")
  52. FileWriteLine($filey,"0")
  53. FileWriteLine($filey,"0")
  54. ;------------
  55. ;defaults
  56. If FileExists($resd&"\defaults") Then
  57.    ; :)
  58. Else
  59.    error("Defaults could not be found",1)  ;what kinda person would delete it!! D:
  60. EndIf
  61. $defd = $resd&"\defaults"
  62. If FileExists($defd&"\d_options.cfg") Then
  63.    ; :)
  64. Else
  65.    error("Defaults could not be found",1)
  66. EndIf
  67. ;------------
  68. If FileExists($resd&"\clipboard") Then
  69.    ; :)
  70. Else
  71.    error("Clipboard could not be found",1)
  72. EndIf
  73. $cboard = $resd&"\clipboard"
  74.  
  75.  
  76. If FileExists($resd&"\options.cfg") Then
  77.    ; :)
  78. Else
  79.    FileCopy($defd&"\d_options.cfg", $resd&"\options.cfg")
  80. EndIf
  81. $opsdf = $defd&"\d_options.cfg"
  82. ;=========================
  83. $opsf = $resd&"\options.cfg"
  84. Local $ops
  85. _FileReadToArray($opsf, $ops)
  86. $opss = UBound($ops)
  87. If $opss >= 3 Then
  88.    ; :)
  89. Else
  90.    error("Failed to load options",1)
  91. EndIf
  92.  
  93. Local $opsd
  94. _FileReadToArray($opsdf, $opsd)
  95. $opsds = UBound($opsd)
  96. If $opsds >= 3 Then
  97.    ; :)
  98. Else
  99.    error("Failed to load default options",1)
  100. EndIf
  101.  
  102. ;=========
  103. Sleep(3000)
  104. SplashOff()
  105. ;=========
  106. $fhdir = $ops[1]
  107. If FileExists($fhdir) Then
  108.    ; :)
  109. Else
  110.    $fhdir = "C:\"
  111. EndIf
  112. $fhdir = FileSelectFolder("Feral Heart directory:", "C:\",0,$fhdir)
  113.  
  114. ;=========
  115. ;FH dir validation
  116. If FileExists($fhdir) Then
  117.    ; :)
  118. Else
  119.    error("Invalid Feral Heart directory",1)
  120. EndIf
  121. If FileExists($fhdir&"\my_presets") Then
  122.    ; :)
  123. Else
  124.    error("Failed to find 'my_presets' directory",1)
  125. EndIf
  126. $fhpresetsdir = $fhdir&"\my_presets"
  127. ;============
  128. SaveOptions($fhdir,"default")
  129.  
  130. ;=========
  131. ;== Gui ==
  132. ;=========
  133. $GuiWin = GUICreate("Feral Heart Preset Maker V.2.0", 820, 300,-1,-1) ; before save & load buttons 720,270
  134.  
  135.  
  136. ;== Basic ==
  137. GUICtrlCreateLabel("Basic",55,1,70,22,$SS_CENTER)
  138. GUICtrlSetFont(-1,14,-1,4)
  139. GUICtrlCreateLabel("Select preset slot:",1,25,110,22,$SS_CENTER)
  140. GUICtrlSetFont(-1,10)
  141. $prsslotlst = GUICtrlCreateList("", 50,40, 100, 70,$WS_VSCROLL)
  142. GUICtrlSetFont(-1,10)
  143. $resetprsbttn = GUICtrlCreateButton("Reset", 50, 110, 100, 30)
  144. GUICtrlSetFont(-1,13,600)
  145. $snewtfbasicbttn = GUICtrlCreateButton("Select new texutures(folder)", 10, 160, 170, 30)
  146. GUICtrlSetFont(-1,10)
  147. $changeprsbttn = GUICtrlCreateButton("Change", 25, 210, 140, 50)
  148. GUICtrlSetFont(-1,15,600)
  149. $saveprsbttn = GUICtrlCreateButton("Save", 35, 270, 50, 25)
  150. GUICtrlSetFont(-1,13,600)
  151. $loadprsbttn = GUICtrlCreateButton("Load", 100, 270, 55, 25)
  152. GUICtrlSetFont(-1,13,600)
  153. ;=========
  154.  
  155. ;== Advanced ==
  156. GUICtrlCreateLabel("Advanced",280,1,100,22,$SS_CENTER)
  157. GUICtrlSetFont(-1,14,-1,4)
  158. $singlesidechk = GUICtrlCreateCheckbox("Single Side Editing", 400, 5, 150, 20)
  159. GUICtrlSetFont(-1,10)
  160. GUICtrlCreateLabel("Body part:",200,25,110,15,$SS_CENTER)
  161. GUICtrlSetFont(-1,10)
  162. $bodypartslst = GUICtrlCreateList("", 220,40, 100, 70)
  163. GUICtrlSetFont(-1,10)
  164.  
  165. Local $size = UBound($bodypartsArray)
  166. for $i = 0 to $size-1
  167.    GUICtrlSetData($bodypartslst,$bodypartsArray[$i])
  168. Next
  169.  
  170. $bpprevimg = GUICtrlCreatePic("",325,25, 100,100)
  171.  
  172.  
  173. GUICtrlCreateLabel("Layers:",190,115,110,15,$SS_CENTER)
  174. GUICtrlSetFont(-1,10)
  175.  
  176. $layerslst = GUICtrlCreateList("", 220,130, 100, 70,$WS_VSCROLL)
  177. $addlayerbttn = GUICtrlCreateButton("Add Layer", 220, 240, 100, 20)
  178. GUICtrlSetFont(-1,10)
  179. $removelayerbttn = GUICtrlCreateButton("Remove Layer", 220, 260, 100, 20)
  180. GUICtrlSetFont(-1,10)
  181. $savelayerbttn = GUICtrlCreateButton("Save Layer", 220, 280, 100, 20)
  182. GUICtrlSetFont(-1,10)
  183.  
  184. $layerupbttn = GUICtrlCreateButton("^", 240, 200, 30, 20)
  185. $layerdownbttn = GUICtrlCreateButton("V", 275, 200, 30, 20)
  186. $layercopybttn = GUICtrlCreateButton("Copy", 220, 220, 50, 20)
  187. $layerpastebttn = GUICtrlCreateButton("Pase", 270, 220, 50, 20)
  188. GUICtrlSetFont(-1,10)
  189.  
  190. GUICtrlCreateLabel("Ambient:",425,45,55,15,$SS_CENTER)
  191. GUICtrlSetFont(-1,10)
  192. $ambin1 = GUICtrlCreateInput("1.000000", 485,40,70,25)
  193. GUICtrlSetFont(-1,10)
  194. $ambin2 = GUICtrlCreateInput("1.000000", 565,40,70,25)
  195. GUICtrlSetFont(-1,10)
  196. $ambin3 = GUICtrlCreateInput("1.000000", 645,40,70,25)
  197. GUICtrlSetFont(-1,10)
  198. $ambin4 = GUICtrlCreateInput("1.000000", 725,40,70,25)
  199. GUICtrlSetFont(-1,10)
  200.  
  201. GUICtrlCreateLabel("Diffuse:",425,80,55,15,$SS_CENTER)
  202. GUICtrlSetFont(-1,10)
  203. $diff1 = GUICtrlCreateInput("1.000000", 485,75,70,25)
  204. GUICtrlSetFont(-1,10)
  205. $diff2 = GUICtrlCreateInput("1.000000", 565,75,70,25)
  206. GUICtrlSetFont(-1,10)
  207. $diff3 = GUICtrlCreateInput("1.000000", 645,75,70,25)
  208. GUICtrlSetFont(-1,10)
  209. $diff4 = GUICtrlCreateInput("1.000000", 725,75,70,25)
  210. GUICtrlSetFont(-1,10)
  211.  
  212. GUICtrlCreateLabel("Specular:",425,115,55,15,$SS_CENTER)
  213. GUICtrlSetFont(-1,10)
  214. $spec1 = GUICtrlCreateInput("0.050000", 485,110,70,25)
  215. GUICtrlSetFont(-1,10)
  216. $spec2 = GUICtrlCreateInput("0.050000", 565,110,70,25)
  217. GUICtrlSetFont(-1,10)
  218. $spec3 = GUICtrlCreateInput("0.050000", 645,110,70,25)
  219. GUICtrlSetFont(-1,10)
  220. $spec4 = GUICtrlCreateInput("1.000000", 725,110,70,25)
  221. GUICtrlSetFont(-1,10)
  222.  
  223. GUICtrlCreateLabel("Emissive:",425,150,55,15,$SS_CENTER)
  224. GUICtrlSetFont(-1,10)
  225. $emit1 = GUICtrlCreateInput("0.000000", 485,145,70,25)
  226. GUICtrlSetFont(-1,10)
  227. $emit2 = GUICtrlCreateInput("0.000000", 565,145,70,25)
  228. GUICtrlSetFont(-1,10)
  229. $emit3 = GUICtrlCreateInput("0.000000", 645,145,70,25)
  230. GUICtrlSetFont(-1,10)
  231. $emit4 = GUICtrlCreateInput("1.000000", 725,145,70,25)
  232. GUICtrlSetFont(-1,10)
  233.  
  234.  
  235. $scrollanimchk = GUICtrlCreateLabel("Scroll Anim:", 470, 185, 90, 30)
  236. GUICtrlSetFont(-1,10)
  237. $scrollaniminx = GUICtrlCreateInput("0", 550, 185, 40, 20)
  238. GUICtrlSetFont(-1,10)
  239. $scrollaniminy = GUICtrlCreateInput("0", 590, 185, 40, 20)
  240. GUICtrlSetFont(-1,10)
  241.  
  242. $rotateaniminchk = GUICtrlCreateLabel("Rotate Anim:", 640, 185, 90, 30)
  243. GUICtrlSetFont(-1,10)
  244. $rotateanimin = GUICtrlCreateInput("0", 730, 185, 40, 20)
  245. GUICtrlSetFont(-1,10)
  246.  
  247. $sellaytxttxt = GUICtrlCreateInput("", 320, 240, 200, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
  248. GUICtrlSetFont(-1,10)
  249. $sellaytxtbttn = GUICtrlCreateButton("Select Layer texture", 320, 220, 200, 20)
  250. GUICtrlSetFont(-1,10)
  251. GUICtrlCreateLabel("-By JBRWolf",630,1,100,22,$SS_CENTER)
  252. GUICtrlSetFont(-1,10,-1,4)
  253.  
  254. $scriptslbl = GUICtrlCreateLabel("Scripts:", 540, 235, 50, 30)
  255. GUICtrlSetFont(-1,10)
  256. $scriptslst = GUICtrlCreateListView("Scripts                                        ", 595, 210, 100, 90,$LVS_NOCOLUMNHEADER);GUICtrlCreateList("", 595, 210, 100, 90,$WS_VSCROLL)
  257. $addscriptbttn = GUICtrlCreateButton("Add Script(s)", 700, 225, 110, 20)
  258. GUICtrlSetFont(-1,10)
  259. $removescriptbttn = GUICtrlCreateButton("Remove Script(s)", 700, 250, 110, 20)
  260. GUICtrlSetFont(-1,10)
  261.  
  262. ;=========
  263. GUISetState(@SW_SHOW)
  264. ;=========
  265. ;=========
  266. ;=========
  267.  
  268. Local $preslotsrl = ScanFolder($fhpresetsdir)
  269. $size = UBound($preslotsrl)
  270. $curpnum = 0
  271. If $size >0 Then
  272.    For $i = 0 to UBound($preslotsrl) -1
  273.       For $i2 = 0 to $size -1
  274.          If $preslotsrl[$i2] == "reference" Then
  275.             ;nuhhh xD
  276.          Else
  277.             $trimmed = StringTrimLeft($preslotsrl[$i2],7)
  278.             ;MsgBox(0,"",$trimmed)
  279.             If $trimmed == String($curpnum) Then
  280.                GUICtrlSetData($prsslotlst, $preslotsrl[$i2]&"|")
  281.             EndIf
  282.          EndIf
  283.       Next
  284.       $curpnum += 1
  285.    Next
  286. Else
  287.    error("No preset slots found in the 'my_presets' folder", 1)
  288. EndIf
  289.  
  290.  
  291. ;=========
  292. ;=========
  293. ;=========
  294.  
  295. ;=========
  296. ;== Main ==
  297. ;=========
  298. $lastselectedpart = ""
  299. $lastselectedlayer = ""
  300. $lastselectedpart2 = ""
  301. $prevselblast = ""
  302. $lastchk = $GUI_UNCHECKED
  303.  
  304. While 1
  305.    $msg = GUIGetMsg()
  306.    If $msg == "" Then
  307.       ;Save it doing other if checks
  308.    Else
  309.       If $msg == $GUI_EVENT_CLOSE Then ExitLoop
  310.      
  311.       If $msg == $resetprsbttn Then
  312.          $selected = GUICtrlRead($prsslotlst)
  313.          If $selected == "" Then
  314.             error("No slot selected",0)
  315.          Else
  316.             $useranswer = InputBox("Reset?", "Are you sure you want to remove everything in "&$selected&" and reset it to the default?(Type 'yes' to confirm)")
  317.             if $useranswer == "yes" Then
  318.                ClearFolder($fhpresetsdir&"\"&$selected)
  319.                $tempmatdir = $tempd&"\tempmat.txt"
  320.                If FileExists($tempmatdir) Then
  321.                   FileDelete($tempmatdir)
  322.                EndIf
  323.                FileWriteLine($tempmatdir,"material "&$selected&"_bodyMatL")
  324.                FileWriteLine($tempmatdir,"{")
  325.                FileWriteLine($tempmatdir,"technique")
  326.                FileWriteLine($tempmatdir,"{")
  327.                FileWriteLine($tempmatdir,"pass")
  328.                FileWriteLine($tempmatdir,"{")
  329.                FileWriteLine($tempmatdir,"texture_unit")
  330.                FileWriteLine($tempmatdir,"{")
  331.                FileWriteLine($tempmatdir,"texture "&$selected&"body.jpg")
  332.                FileWriteLine($tempmatdir,"}")
  333.                FileWriteLine($tempmatdir,"}")
  334.                FileWriteLine($tempmatdir,"}")
  335.                FileWriteLine($tempmatdir,"}")
  336.                
  337.                FileWriteLine($tempmatdir,"material "&$selected&"_bodyMatR")
  338.                FileWriteLine($tempmatdir,"{")
  339.                FileWriteLine($tempmatdir,"technique")
  340.                FileWriteLine($tempmatdir,"{")
  341.                FileWriteLine($tempmatdir,"pass")
  342.                FileWriteLine($tempmatdir,"{")
  343.                FileWriteLine($tempmatdir,"texture_unit")
  344.                FileWriteLine($tempmatdir,"{")
  345.                FileWriteLine($tempmatdir,"texture "&$selected&"body.jpg")
  346.                FileWriteLine($tempmatdir,"}")
  347.                FileWriteLine($tempmatdir,"}")
  348.                FileWriteLine($tempmatdir,"}")
  349.                FileWriteLine($tempmatdir,"}")
  350.                
  351.                FileWriteLine($tempmatdir,"material "&$selected&"_headMatL")
  352.                FileWriteLine($tempmatdir,"{")
  353.                FileWriteLine($tempmatdir,"technique")
  354.                FileWriteLine($tempmatdir,"{")
  355.                FileWriteLine($tempmatdir,"pass")
  356.                FileWriteLine($tempmatdir,"{")
  357.                FileWriteLine($tempmatdir,"texture_unit")
  358.                FileWriteLine($tempmatdir,"{")
  359.                FileWriteLine($tempmatdir,"texture "&$selected&"head.jpg")
  360.                FileWriteLine($tempmatdir,"}")
  361.                FileWriteLine($tempmatdir,"}")
  362.                FileWriteLine($tempmatdir,"}")
  363.                FileWriteLine($tempmatdir,"}")
  364.                
  365.                FileWriteLine($tempmatdir,"material "&$selected&"_headMatR")
  366.                FileWriteLine($tempmatdir,"{")
  367.                FileWriteLine($tempmatdir,"technique")
  368.                FileWriteLine($tempmatdir,"{")
  369.                FileWriteLine($tempmatdir,"pass")
  370.                FileWriteLine($tempmatdir,"{")
  371.                FileWriteLine($tempmatdir,"texture_unit")
  372.                FileWriteLine($tempmatdir,"{")
  373.                FileWriteLine($tempmatdir,"texture "&$selected&"head.jpg")
  374.                FileWriteLine($tempmatdir,"}")
  375.                FileWriteLine($tempmatdir,"}")
  376.                FileWriteLine($tempmatdir,"}")
  377.                FileWriteLine($tempmatdir,"}")
  378.                
  379.                FileWriteLine($tempmatdir,"material "&$selected&"_eyeMatL")
  380.                FileWriteLine($tempmatdir,"{")
  381.                FileWriteLine($tempmatdir,"technique")
  382.                FileWriteLine($tempmatdir,"{")
  383.                FileWriteLine($tempmatdir,"pass")
  384.                FileWriteLine($tempmatdir,"{")
  385.                FileWriteLine($tempmatdir,"texture_unit")
  386.                FileWriteLine($tempmatdir,"{")
  387.                FileWriteLine($tempmatdir,"texture "&$selected&"eye.jpg")
  388.                FileWriteLine($tempmatdir,"}")
  389.                FileWriteLine($tempmatdir,"}")
  390.                FileWriteLine($tempmatdir,"}")
  391.                FileWriteLine($tempmatdir,"}")
  392.                
  393.                FileWriteLine($tempmatdir,"material "&$selected&"_eyeMatR")
  394.                FileWriteLine($tempmatdir,"{")
  395.                FileWriteLine($tempmatdir,"technique")
  396.                FileWriteLine($tempmatdir,"{")
  397.                FileWriteLine($tempmatdir,"pass")
  398.                FileWriteLine($tempmatdir,"{")
  399.                FileWriteLine($tempmatdir,"texture_unit")
  400.                FileWriteLine($tempmatdir,"{")
  401.                FileWriteLine($tempmatdir,"texture "&$selected&"eye.jpg")
  402.                FileWriteLine($tempmatdir,"}")
  403.                FileWriteLine($tempmatdir,"}")
  404.                FileWriteLine($tempmatdir,"}")
  405.                FileWriteLine($tempmatdir,"}")
  406.                
  407.                FileWriteLine($tempmatdir,"material "&$selected&"_tailMat")
  408.                FileWriteLine($tempmatdir,"{")
  409.                FileWriteLine($tempmatdir,"technique")
  410.                FileWriteLine($tempmatdir,"{")
  411.                FileWriteLine($tempmatdir,"pass")
  412.                FileWriteLine($tempmatdir,"{")
  413.                FileWriteLine($tempmatdir,"texture_unit")
  414.                FileWriteLine($tempmatdir,"{")
  415.                FileWriteLine($tempmatdir,"texture "&$selected&"tail.jpg")
  416.                FileWriteLine($tempmatdir,"}")
  417.                FileWriteLine($tempmatdir,"}")
  418.                FileWriteLine($tempmatdir,"}")
  419.                FileWriteLine($tempmatdir,"}")
  420.                
  421.                FileWriteLine($tempmatdir,"material "&$selected&"_maneMat")
  422.                FileWriteLine($tempmatdir,"{")
  423.                FileWriteLine($tempmatdir,"technique")
  424.                FileWriteLine($tempmatdir,"{")
  425.                FileWriteLine($tempmatdir,"pass")
  426.                FileWriteLine($tempmatdir,"{")
  427.                FileWriteLine($tempmatdir,"lighting off")
  428.                FileWriteLine($tempmatdir,"cull_hardware none")
  429.                FileWriteLine($tempmatdir,"cull_software none")
  430.                FileWriteLine($tempmatdir,"cull_hardware one")
  431.                FileWriteLine($tempmatdir,"scene_blend alpha_blend")
  432.                FileWriteLine($tempmatdir,"depth_write off")
  433.                FileWriteLine($tempmatdir,"{")
  434.                FileWriteLine($tempmatdir,"texture "&$selected&"mane.png")
  435.                FileWriteLine($tempmatdir,"}")
  436.                FileWriteLine($tempmatdir,"}")
  437.                FileWriteLine($tempmatdir,"}")
  438.                FileWriteLine($tempmatdir,"}")
  439.                
  440.                FileWriteLine($tempmatdir,"material "&$selected&"_equipMatL")
  441.                FileWriteLine($tempmatdir,"{")
  442.                FileWriteLine($tempmatdir,"technique")
  443.                FileWriteLine($tempmatdir,"{")
  444.                FileWriteLine($tempmatdir,"pass")
  445.                FileWriteLine($tempmatdir,"{")
  446.                FileWriteLine($tempmatdir,"texture_unit")
  447.                FileWriteLine($tempmatdir,"{")
  448.                FileWriteLine($tempmatdir,"texture "&$selected&"equip.jpg")
  449.                FileWriteLine($tempmatdir,"}")
  450.                FileWriteLine($tempmatdir,"}")
  451.                FileWriteLine($tempmatdir,"}")
  452.                FileWriteLine($tempmatdir,"}")
  453.                
  454.                FileWriteLine($tempmatdir,"material "&$selected&"_equipMatR")
  455.                FileWriteLine($tempmatdir,"{")
  456.                FileWriteLine($tempmatdir,"technique")
  457.                FileWriteLine($tempmatdir,"{")
  458.                FileWriteLine($tempmatdir,"pass")
  459.                FileWriteLine($tempmatdir,"{")
  460.                FileWriteLine($tempmatdir,"texture_unit")
  461.                FileWriteLine($tempmatdir,"{")
  462.                FileWriteLine($tempmatdir,"texture "&$selected&"equip.jpg")
  463.                FileWriteLine($tempmatdir,"}")
  464.                FileWriteLine($tempmatdir,"}")
  465.                FileWriteLine($tempmatdir,"}")
  466.                FileWriteLine($tempmatdir,"}")
  467.                
  468.                FileCopy($tempmatdir, $fhpresetsdir&"\"&$selected&"\"&$selected&".material")
  469.                
  470.                If FileExists($tempd&"\tempmat.txt") Then
  471.                   FileDelete($tempd&"\tempmat.txt")
  472.                EndIf
  473.                MsgBox(0,"Done","Successfully reset "&$selected)
  474.                
  475.             Else
  476.                MsgBox(0,"Cancled", "Cancled reseting "&$selected)
  477.             EndIf
  478.          EndIf
  479.       EndIf
  480.      
  481.       If $msg == $snewtfbasicbttn Then ;NFLU DONE :)
  482.          Local $opsd
  483.          _FileReadToArray($opsf, $opsd)
  484.          ;$opsds = UBound($opsd)
  485.          $lastprediro = $opsd[2]
  486.          If FileExists($lastprediro) Then
  487.             ; :)
  488.          Else
  489.             $lastprediro = "C:\"
  490.          EndIf
  491.          $netfbd = FileSelectFolder("Preset textures directory:", "C:\",0,$lastprediro)
  492.          If FileExists($netfbd) Then
  493.             $newpferror = 1
  494.             $cleared = False
  495.            
  496.             Local $sizer = UBound($bodypartsArray)
  497.             for $i = 0 to $sizer-1
  498.                $trim = StringRight($bodypartsArray[$i],1)
  499.                $trim = StringLower($trim)
  500.                if $trim == "l" or $trim == "r" Then
  501.                   $srchitem = StringTrimRight($bodypartsArray[$i],1)
  502.                Else
  503.                   $srchitem = $bodypartsArray[$i]
  504.                EndIf
  505.                $srchitem = StringLower($srchitem)
  506.                $itm = GetFile($netfbd,$srchitem)
  507.                if $itm == "" Then
  508.                   ;nupe
  509.                Else
  510.                   $newpferror = 0
  511.                   If $cleared Then
  512.                      ;no
  513.                   Else
  514.                      $cleared = True
  515.                      SaveOptions("default",$netfbd)
  516.                      ClearAllLayers()
  517.                      $lastselectedpart = ""
  518.                   EndIf
  519.                   $f = $tempd&"\layers\"&StringLower($bodypartsArray[$i])&"\layer1.txt"
  520.                   if FileExists($f) Then
  521.                      FileDelete($f)
  522.                   EndIf
  523.                   FileWriteLine($f,stringRight($itm, 4))
  524.                   FileWriteLine($f,$netfbd&"\"&$itm)
  525.                   FileWriteLine($f,"1.000000")
  526.                   FileWriteLine($f,"1.000000")
  527.                   FileWriteLine($f,"1.000000")
  528.                   FileWriteLine($f,"1.000000")
  529.                   FileWriteLine($f,"1.000000")
  530.                   FileWriteLine($f,"1.000000")
  531.                   FileWriteLine($f,"1.000000")
  532.                   FileWriteLine($f,"1.000000")
  533.                   FileWriteLine($f,"0.050000")
  534.                   FileWriteLine($f,"0.050000")
  535.                   FileWriteLine($f,"0.050000")
  536.                   FileWriteLine($f,"1.000000")
  537.                   FileWriteLine($f,"0.000000")
  538.                   FileWriteLine($f,"0.000000")
  539.                   FileWriteLine($f,"0.000000")
  540.                   FileWriteLine($f,"1.000000")
  541.                   FileWriteLine($f,"0")
  542.                   FileWriteLine($f,"0")
  543.                   FileWriteLine($f,"0")
  544.                   FileWriteLine($f,"[scripts]")
  545.                   if stringRight($itm, 4) == ".png" Then
  546.                      FileWriteLine($f,"alpha_support")
  547.                   EndIf
  548.                EndIf
  549.             Next
  550.             If $newpferror == 1 Then
  551.                error("No textures were found in the folder "&$netfbd,0)
  552.             EndIf
  553.          Else
  554.             error("Folder not found",0)
  555.          EndIf
  556.       EndIf
  557.      
  558.       If $msg == $addlayerbttn Then
  559.          $selected = GUICtrlRead($bodypartslst)
  560.          If $selected == "" Then
  561.             ;nah
  562.          Else
  563.             $amo = CountFolder($tempd&"\layers\"&StringLower($selected))
  564.             $f = $tempd&"\layers\"&StringLower($selected)&"\layer"&$amo+1&".txt"
  565.             If FileExists($f) Then
  566.                FileDelete($f)
  567.             EndIf
  568.             FileWriteLine($f,"")
  569.             FileWriteLine($f,"")
  570.             FileWriteLine($f,"1.000000")
  571.             FileWriteLine($f,"1.000000")
  572.             FileWriteLine($f,"1.000000")
  573.             FileWriteLine($f,"1.000000")
  574.             FileWriteLine($f,"1.000000")
  575.             FileWriteLine($f,"1.000000")
  576.             FileWriteLine($f,"1.000000")
  577.             FileWriteLine($f,"1.000000")
  578.             FileWriteLine($f,"0.050000")
  579.             FileWriteLine($f,"0.050000")
  580.             FileWriteLine($f,"0.050000")
  581.             FileWriteLine($f,"1.000000")
  582.             FileWriteLine($f,"0.000000")
  583.             FileWriteLine($f,"0.000000")
  584.             FileWriteLine($f,"0.000000")
  585.             FileWriteLine($f,"1.000000")
  586.             FileWriteLine($f,"0")
  587.             FileWriteLine($f,"0")
  588.             FileWriteLine($f,"0")
  589.             FileWriteLine($f,"[scripts]")
  590.             if GuiCTRLRead($singlesidechk) = $GUI_CHECKED Then
  591.                ;nope
  592.             Else
  593.                $fb = $f
  594.                $side = StringRight(StringLower($selected),1)
  595.                $ori = StringTrimRight(StringLower($selected),1)
  596.                if $side == "l" Then
  597.                   $f = $tempd&"\layers\"&$ori&"r"&"\layer"&$amo+1&".txt"
  598.                Else
  599.                   $f = $tempd&"\layers\"&$ori&"l"&"\layer"&$amo+1&".txt"
  600.                EndIf
  601.                If FileExists($f) Then
  602.                   FileDelete($f)
  603.                EndIf
  604.                If FileExists($fb) Then
  605.                   FileCopy($fb,$f)
  606.                EndIf
  607.             EndIf
  608.             $lastselectedpart = ""
  609.          EndIf
  610.       EndIf
  611.      
  612.       If $msg = $layerupbttn Then
  613.          $selected = GUICtrlRead($bodypartslst)
  614.          If $selected == "" Then
  615.             ;nah
  616.          Else
  617.             $selected2 = GUICtrlRead($layerslst)
  618.             If $selected2 == "" Then
  619.                ;nah
  620.             Else
  621.                $f = $tempd&"\layers\"&StringLower($selected)&"\"&$selected2
  622.                if FileExists($f) Then
  623.                   $trim = StringTrimRight($selected2,4)
  624.                   $trim2 = StringTrimLeft($trim,5)
  625.                   $num = Int($trim2)-1
  626.                   $f2 = $tempd&"\layers\"&StringLower($selected)&"\"&"layer"&String($num)&".txt"
  627.                   if FileExists($f2) Then
  628.                      $copyloc = $tempd&"\layermovetmp.txt"
  629.                      if FileExists($copyloc) Then
  630.                         FileDelete($copyloc)
  631.                      EndIf
  632.                      FileCopy($f2,$copyloc)
  633.                      FileDelete($f2)
  634.                      FileMove($f,$f2)
  635.                      FileCopy($copyloc,$f)
  636.                   EndIf
  637.                EndIf
  638.                if GuiCTRLRead($singlesidechk) = $GUI_CHECKED Then
  639.                      ;nope
  640.                Else
  641.                   $side = StringRight(StringLower($selected),1)
  642.                   $ori = StringTrimRight(StringLower($selected),1)
  643.                   if $side == "l" Then
  644.                      $f = $tempd&"\layers\"&$ori&"r"&"\"&$selected2
  645.                      $fy = $tempd&"\layers\"&$ori&"r"&"\"
  646.                   Else
  647.                      $f = $tempd&"\layers\"&$ori&"l"&"\"&$selected2
  648.                      $fy = $tempd&"\layers\"&$ori&"l"&"\"
  649.                   EndIf
  650.                   if FileExists($f) Then
  651.                      $trim = StringTrimRight($selected2,4)
  652.                      $trim2 = StringTrimLeft($trim,5)
  653.                      $num = Int($trim2)-1
  654.                      $f2 = $fy&"layer"&String($num)&".txt"
  655.                      if FileExists($f2) Then
  656.                         $copyloc = $tempd&"\layermovetmp.txt"
  657.                         if FileExists($copyloc) Then
  658.                            FileDelete($copyloc)
  659.                         EndIf
  660.                         FileCopy($f2,$copyloc)
  661.                         FileDelete($f2)
  662.                         FileMove($f,$f2)
  663.                         FileCopy($copyloc,$f)
  664.                      EndIf
  665.                   EndIf
  666.                EndIf
  667.                $lastselectedpart = ""
  668.             EndIf
  669.          EndIf
  670.       EndIf
  671.      
  672.       If $msg = $layerdownbttn Then
  673.          $selected = GUICtrlRead($bodypartslst)
  674.          If $selected == "" Then
  675.             ;nah
  676.          Else
  677.             $selected2 = GUICtrlRead($layerslst)
  678.             If $selected2 == "" Then
  679.                ;nah
  680.             Else
  681.                $f = $tempd&"\layers\"&StringLower($selected)&"\"&$selected2
  682.                if FileExists($f) Then
  683.                   $trim = StringTrimRight($selected2,4)
  684.                   $trim2 = StringTrimLeft($trim,5)
  685.                   $num = Int($trim2)+1
  686.                   $f2 = $tempd&"\layers\"&StringLower($selected)&"\"&"layer"&String($num)&".txt"
  687.                   if FileExists($f2) Then
  688.                      $copyloc = $tempd&"\layermovetmp.txt"
  689.                      if FileExists($copyloc) Then
  690.                         FileDelete($copyloc)
  691.                      EndIf
  692.                      FileCopy($f2,$copyloc)
  693.                      FileDelete($f2)
  694.                      FileMove($f,$f2)
  695.                      FileCopy($copyloc,$f)
  696.                   EndIf
  697.                EndIf
  698.                if GuiCTRLRead($singlesidechk) = $GUI_CHECKED Then
  699.                      ;nope
  700.                Else
  701.                   $side = StringRight(StringLower($selected),1)
  702.                   $ori = StringTrimRight(StringLower($selected),1)
  703.                   if $side == "l" Then
  704.                      $f = $tempd&"\layers\"&$ori&"r"&"\"&$selected2
  705.                      $fy = $tempd&"\layers\"&$ori&"r"&"\"
  706.                   Else
  707.                      $f = $tempd&"\layers\"&$ori&"l"&"\"&$selected2
  708.                      $fy = $tempd&"\layers\"&$ori&"l"&"\"
  709.                   EndIf
  710.                   if FileExists($f) Then
  711.                      $trim = StringTrimRight($selected2,4)
  712.                      $trim2 = StringTrimLeft($trim,5)
  713.                      $num = Int($trim2)+1
  714.                      $f2 = $fy&"layer"&String($num)&".txt"
  715.                      if FileExists($f2) Then
  716.                         $copyloc = $tempd&"\layermovetmp.txt"
  717.                         if FileExists($copyloc) Then
  718.                            FileDelete($copyloc)
  719.                         EndIf
  720.                         FileCopy($f2,$copyloc)
  721.                         FileDelete($f2)
  722.                         FileMove($f,$f2)
  723.                         FileCopy($copyloc,$f)
  724.                      EndIf
  725.                   EndIf
  726.                EndIf
  727.                $lastselectedpart = ""
  728.             EndIf
  729.          EndIf
  730.       EndIf
  731.      
  732.       If $msg == $removelayerbttn Then
  733.          $selected = GUICtrlRead($bodypartslst)
  734.          If $selected == "" Then
  735.             ;nah
  736.          Else
  737.             $selected2 = GUICtrlRead($layerslst)
  738.             If $selected2 == "" Then
  739.                ;nah
  740.             Else
  741.                $f = $tempd&"\layers\"&StringLower($selected)&"\"&$selected2
  742.                $laf = $tempd&"\layers\"&StringLower($selected)
  743.                $count = CountFolder($laf)
  744.                $trim = StringTrimLeft($selected2,5)
  745.                $trim2 = StringTrimRight($trim,4)
  746.                if FileExists($f) Then
  747.                   FileDelete($f)
  748.                EndIf
  749.                if $count > Int($trim2) Then
  750.                   Local $layersr = ScanFolder($laf)
  751.                   $num = Int($trim2)
  752.                   for $i = 0 to UBound($layersr)-1
  753.                      for $i2 = 0 to UBound($layersr)-1
  754.                         $trimy = StringTrimLeft($layersr[$i2],5)
  755.                         $trimy2 = StringTrimRight($trimy,4)
  756.                         if Int($trimy2) > Int($trim2) Then
  757.                            If String($num) == $trimy2 Then
  758.                               $tnum = Int($trimy2)
  759.                               FileMove($laf&"\layer"&$trimy2&".txt",$laf&"\layer"&String($tnum-1)&".txt")
  760.                            EndIf
  761.                         endif
  762.                      Next
  763.                      $num += 1
  764.                   Next
  765.                EndIf
  766.                   if GuiCTRLRead($singlesidechk) = $GUI_CHECKED Then
  767.                      ;nope
  768.                   Else
  769.                      $side = StringRight(StringLower($selected),1)
  770.                      $ori = StringTrimRight(StringLower($selected),1)
  771.                      if $side == "l" Then
  772.                         $f = $tempd&"\layers\"&$ori&"r"&"\"&$selected2
  773.                      Else
  774.                         $f = $tempd&"\layers\"&$ori&"l"&"\"&$selected2
  775.                      EndIf
  776.                      $laf = $tempd&"\layers\"&$ori&"r"
  777.                      $count = CountFolder($laf)
  778.                      $trim = StringTrimLeft($selected2,5)
  779.                      $trim2 = StringTrimRight($trim,4)
  780.                      if FileExists($f) Then
  781.                         FileDelete($f)
  782.                      EndIf
  783.                      if $count > Int($trim2) Then
  784.                         Local $layersr2 = ScanFolder($laf)
  785.                         $num = Int($trim2)
  786.                         for $i = 0 to UBound($layersr2)-1
  787.                            for $i2 = 0 to UBound($layersr2)-1
  788.                               $trimy = StringTrimLeft($layersr2[$i2],5)
  789.                               $trimy2 = StringTrimRight($trimy,4)
  790.                               if Int($trimy2) > Int($trim2) Then
  791.                                  If String($num) == $trimy2 Then
  792.                                     $tnum = Int($trimy2)
  793.                                     FileMove($laf&"\layer"&$trimy2&".txt",$laf&"\layer"&String($tnum-1)&".txt")
  794.                                  EndIf
  795.                               endif
  796.                            Next
  797.                            $num += 1
  798.                         Next
  799.                      EndIf
  800.                      
  801.                EndIf
  802.                $lastselectedpart = ""
  803.             EndIf
  804.          EndIf
  805.       EndIf
  806.      
  807.       if $msg == $sellaytxtbttn Then
  808.          Local $opsd
  809.          _FileReadToArray($opsf, $opsd)
  810.          $opsds = UBound($opsd)
  811.          $lastprediro = $opsd[2]
  812.          If FileExists($lastprediro) Then
  813.             ; :)
  814.          Else
  815.             $lastprediro = "C:\"
  816.          EndIf
  817.          $txtfl = FileOpenDialog("Texture:", $lastprediro, "Supported Images(*.jpg;*.png)|JPEG (*.jpg*)|PNG (*.png*)")
  818.          If FileExists($txtfl) Then
  819.             GUICtrlSetData($sellaytxttxt,$txtfl)
  820.             $exten = StringRight($txtfl,4)
  821.             if $exten == ".png" Then
  822.                Local $itmss = lvGetItms($scriptslst)
  823.                $size = UBound($itmss)
  824.                $there = False
  825.                for $izzi = 0 to $size-1
  826.                   If $itmss[$izzi] == "alpha_support" Then
  827.                      $there = True
  828.                   EndIf
  829.                Next
  830.                if $there Then
  831.                   ;nupe
  832.                Else
  833.                   GUICtrlCreateListViewItem("alpha_support",$scriptslst)
  834.                EndIf
  835.             Else
  836.                Local $itmss = lvGetItms($scriptslst)
  837.                $size = UBound($itmss)
  838.                $there = False
  839.                $pos = 0
  840.                for $izzi = 0 to $size-1
  841.                   If $itmss[$izzi] == "alpha_support" Then
  842.                      $there = True
  843.                      $pos = $izzi
  844.                   EndIf
  845.                Next
  846.                
  847.                if $there Then
  848.                   _GUICtrlListView_DeleteItem(GUICtrlGetHandle($scriptslst),$pos-1)
  849.                EndIf
  850.             EndIf
  851.          Else
  852.             error("Failed to find texture "&$txtfl,0)
  853.          EndIf
  854.       EndIf
  855.      
  856.       if $msg == $saveprsbttn Then ;NFLU DONE :D
  857.          $dir = $selfd&"\saves"
  858.          if FileExists($dir)Then
  859.             ; :)
  860.          Else
  861.             DirCreate($dir)
  862.          EndIf
  863.          $savenam = InputBox("Save as", "Name:", "Untitled")
  864.          if $savenam == "" Then
  865.             if @error == 1 Then
  866.                error("Cancled saving",0)
  867.             Else
  868.                error("Invalid input",0)
  869.             EndIf
  870.          Else
  871.             $spath = $dir&"\"&$savenam
  872.             $cango = 0
  873.             if FileExists($spath) Then
  874.                $useranswer = InputBox("Overwrite?", "Are you sure you want to over write the file '"&$savenam&"'(Type 'yes' to confirm)")
  875.                if $useranswer == "yes" Then
  876.                   FileDelete($spath)
  877.                   $cango =1
  878.                Else
  879.                   error("Cancled saving",0)
  880.                EndIf
  881.             Else
  882.                $cango = 1
  883.             EndIf
  884.             If $cango == 1 Then
  885.                $savefileout = DirCreate($spath)
  886.                if $savefileout == 1 Then
  887.                   $saveerror = 0
  888.                   $lpath = $spath&"\layers"
  889.                   FCreateO($lpath)
  890.                   Local $sizer = UBound($bodypartsArray)
  891.                   for $i = 0 to $sizer-1
  892.                      FCreateO($lpath&"\"&StringLower($bodypartsArray[$i]))
  893.                   Next
  894.                   for $i = 0 to $sizer-1
  895.                       existsavee($tempd&"\layers\"&StringLower($bodypartsArray[$i]),$lpath&"\"&StringLower($bodypartsArray[$i]))
  896.                   Next
  897.                   $pathyy = $tempd&"\layers\sse.txt"
  898.                   $pathii = $spath&"\layers\sse.txt"
  899.                   if FileExists($pathyy) Then
  900.                      if FileExists($pathii) Then
  901.                         FileDelete($pathii)
  902.                      EndIf
  903.                      FileCopy($pathyy,$pathii)
  904.                   EndIf
  905.                   if $saveerror == 0 Then
  906.                      MsgBox(0,"Success","Layer information saved successfully :)")
  907.                   Else
  908.                      error("Error whilst saving layer data, some data may have not been saved",0)
  909.                   EndIf
  910.                Else
  911.                   error("Failed to save",0)
  912.                EndIf
  913.             EndIf
  914.          EndIf
  915.       EndIf
  916.      
  917.       if $msg == $loadprsbttn Then ;NFLU DONE :DD
  918.          $dir = $selfd&"\saves"
  919.          if FileExists($dir) Then
  920.  
  921.             $lopath = FileSelectFolder("Load file:", $dir,0)
  922.                if FileExists($lopath) Then
  923.                   $useranswer = InputBox("Load?", "Are you sure you want to load the save '"&$lopath&"' and replace your current layers?(Type 'yes' to confirm)")
  924.                   if $useranswer == "yes" Then
  925.                      $loaderror = 0
  926.                      $lpath = $lopath&"\layers"
  927.                      
  928.                      Local $sizer = UBound($bodypartsArray)
  929.                      for $i = 0 to $sizer-1
  930.                         existloade($lpath&"\"&StringLower($bodypartsArray[$i]),$tempd&"\layers\"&StringLower($bodypartsArray[$i]))
  931.                      Next
  932.                      
  933.                      $pathyy = $tempd&"\layers\sse.txt"
  934.                      $pathii = $lopath&"\layers\sse.txt"
  935.                      if FileExists($pathii) Then
  936.                         if FileExists($pathyy) Then
  937.                            FileDelete($pathyy)
  938.                         EndIf
  939.                         FileCopy($pathii,$pathyy)
  940.                      EndIf
  941.                      
  942.                      if $loaderror == 0 Then
  943.                         $lastselectedpart = ""
  944.                         MsgBox(0,"Success","Layer information loaded successfully :)")
  945.                      Else
  946.                         error("Error whilst loading layer data, some data may have not been loaded",0)
  947.                      EndIf
  948.                   Else
  949.                      error("Cancled loading",0)
  950.                   EndIf
  951.                Else
  952.                   error("Failed to load",0)
  953.                EndIf
  954.          Else
  955.             error("Failed to find saves folder",0)
  956.          EndIf
  957.       EndIf
  958.      
  959.       If $msg == $savelayerbttn Then ;NFLU NOTICE: Not really, just needs updating for codescodes update ;#CODESUPDATE
  960.          $selected = GUICtrlRead($bodypartslst)
  961.          If $selected == "" Then
  962.             ;nah
  963.          Else
  964.             $selected2 = GUICtrlRead($layerslst)
  965.             If $selected2 == "" Then
  966.                ;nah
  967.             Else
  968.                $f = $tempd&"\layers\"&StringLower($selected)&"\"&$selected2
  969.                $loc = GUICtrlRead($sellaytxttxt)
  970.                If FileExists($loc) Then
  971.                   if FileExists($f) Then
  972.                      FileDelete($f)
  973.                   EndIf
  974.                   $type = StringRight($loc,4)
  975.                   FileWriteLine($f,$type)
  976.                   FileWriteLine($f,$loc)
  977.                   FileWriteLine($f,GUICtrlRead($ambin1))
  978.                   FileWriteLine($f,GUICtrlRead($ambin2))
  979.                   FileWriteLine($f,GUICtrlRead($ambin3))
  980.                   FileWriteLine($f,GUICtrlRead($ambin4))
  981.                   FileWriteLine($f,GUICtrlRead($diff1))
  982.                   FileWriteLine($f,GUICtrlRead($diff2))
  983.                   FileWriteLine($f,GUICtrlRead($diff3))
  984.                   FileWriteLine($f,GUICtrlRead($diff4))
  985.                   FileWriteLine($f,GUICtrlRead($spec1))
  986.                   FileWriteLine($f,GUICtrlRead($spec2))
  987.                   FileWriteLine($f,GUICtrlRead($spec3))
  988.                   FileWriteLine($f,GUICtrlRead($spec4))
  989.                   FileWriteLine($f,GUICtrlRead($emit1))
  990.                   FileWriteLine($f,GUICtrlRead($emit2))
  991.                   FileWriteLine($f,GUICtrlRead($emit3))
  992.                   FileWriteLine($f,GUICtrlRead($emit4))
  993.                   FileWriteLine($f,GUICtrlRead($scrollaniminx))
  994.                   FileWriteLine($f,GUICtrlRead($scrollaniminy))
  995.                   FileWriteLine($f,GUICtrlRead($rotateanimin))
  996.                   FileWriteLine($f,"[scripts]")
  997.                   Local $scrps = lvGetItms($scriptslst)
  998.                   $siz = UBound($scrps)
  999.                   for $i = 1 To $siz-1
  1000.                      FileWriteLine($f, $scrps[$i])
  1001.                   Next
  1002.                   if GuiCTRLRead($singlesidechk) = $GUI_CHECKED Then
  1003.                   ;nope
  1004.                   Else
  1005.                      $fb = $f
  1006.                      $side = StringRight(StringLower($selected),1)
  1007.                      $ori = StringTrimRight(StringLower($selected),1)
  1008.                      if $side == "l" Then
  1009.                         $f = $tempd&"\layers\"&$ori&"r"&"\"&$selected2
  1010.                      Else
  1011.                         $f = $tempd&"\layers\"&$ori&"l"&"\"&$selected2
  1012.                      EndIf
  1013.                      If FileExists($f) Then
  1014.                         FileDelete($f)
  1015.                      EndIf
  1016.                      If FileExists($fb) Then
  1017.                         FileCopy($fb,$f)
  1018.                      EndIf
  1019.                   EndIf
  1020.                   MsgBox(0,"Saved","Layer saved successfully",2)
  1021.                Else
  1022.                   error("Could not find texture.",0)
  1023.                EndIf
  1024.                ;$lastselectedpart = ""
  1025.                ;$lselectedlayer = ""
  1026.             EndIf
  1027.          EndIf
  1028.       EndIf
  1029.      
  1030.       If $msg == $layercopybttn Then
  1031.          $selected = GUICtrlRead($bodypartslst)
  1032.          If $selected == "" Then
  1033.             ;nah
  1034.          Else
  1035.          $selected2 = GUICtrlRead($layerslst)
  1036.             If $selected2 == "" Then
  1037.                ;nah
  1038.             Else
  1039.                $f = $tempd&"\layers\"&StringLower($selected)&"\"&$selected2
  1040.                if FileExists($f) Then
  1041.                   $cf = $cboard&"\layer.txt"
  1042.                   if FileExists($cf) Then
  1043.                      FileDelete($cf)
  1044.                   EndIf
  1045.                   FileCopy($f,$cf)
  1046.                   MsgBox(0,"Copied","Copied layer successfully",0.3)
  1047.                EndIf
  1048.             EndIf
  1049.          EndIf
  1050.       EndIf
  1051.      
  1052.       if $msg = $layerpastebttn Then
  1053.          $selected = GUICtrlRead($bodypartslst)
  1054.          If $selected == "" Then
  1055.             ;nah
  1056.          Else
  1057.             $f = $tempd&"\layers\"&StringLower($selected)&"\"
  1058.             $csource = $cboard&"\layer.txt"
  1059.             if FileExists($f) Then
  1060.                If FileExists($csource) Then
  1061.                   $amo = CountFolder($f)
  1062.                   $fc = $f&"\layer"&String($amo+1)&".txt"
  1063.                   if FileExists($fc) Then
  1064.                      FileDelete($fc)
  1065.                   EndIf
  1066.                   FileCopy($csource,$fc)
  1067.                   if GuiCTRLRead($singlesidechk) = $GUI_CHECKED Then
  1068.                      ;nope
  1069.                   Else
  1070.                      $side = StringRight(StringLower($selected),1)
  1071.                      $ori = StringTrimRight(StringLower($selected),1)
  1072.                      if $side == "l" Then
  1073.                         $f = $tempd&"\layers\"&$ori&"r"&"\"
  1074.                      Else
  1075.                         $f = $tempd&"\layers\"&$ori&"l"&"\"
  1076.                      EndIf
  1077.                      $amo = CountFolder($f)
  1078.                      $fc = $f&"\layer"&String($amo+1)&".txt"
  1079.                      if FileExists($fc) Then
  1080.                         FileDelete($fc)
  1081.                      EndIf
  1082.                      FileCopy($csource,$fc)
  1083.                   EndIf
  1084.                   $lastselectedpart = ""
  1085.                   MsgBox(0,"Success","Layer pasted successfully",0.3)
  1086.                Else
  1087.                   error("Clipboard is empty",0)
  1088.                EndIf
  1089.             EndIf
  1090.          EndIf
  1091.       EndIf
  1092.      
  1093.       if $msg = $addscriptbttn Then
  1094.          $txtfl = FileOpenDialog("Scripts:", $scriptsd, "Text Document(*.txt*)",BitOR($FD_FILEMUSTEXIST,$FD_MULTISELECT))
  1095.          Local $txtfls = StringSplit($txtfl,"|")
  1096.          $size = UBound($txtfls)
  1097.          if $size == 2 Then
  1098.             $str = 1
  1099.          Else
  1100.             $str = 2
  1101.          EndIf
  1102.          for $ti = $str to $size-1
  1103.             If FileExists($txtfls[$ti]) Then
  1104.                Local $szDrive, $szDir, $szFName, $szExt
  1105.                Local $TestPath = _PathSplit($txtfls[$ti], $szDrive, $szDir, $szFName, $szExt)
  1106.                GUICtrlCreateListViewItem($szFName,$scriptslst)
  1107.             Else
  1108.                error("Failed to find script"&$txtfls[$ti],0)
  1109.             EndIf
  1110.          Next
  1111.       EndIf
  1112.      
  1113.       if $msg = $removescriptbttn Then
  1114.          _GUICtrlListView_DeleteItemsSelected($scriptslst)
  1115.       EndIf
  1116.      
  1117.       $selected = GUICtrlRead($layerslst)
  1118.       If $selected == $lastselectedlayer or $selected == "" Then
  1119.          if $lastselectedlayer == "" Then
  1120.            
  1121.          Else
  1122.             If $selected == "" Then
  1123.                resetLayerGUI()
  1124.                $lastselectedlayer = ""
  1125.                ;$lastselectedpart2 = $selected2
  1126.             EndIf
  1127.          EndIf
  1128.          ;nope
  1129.       Else
  1130.          $selected2 = GUICtrlRead($bodypartslst)
  1131.          ;error($selected2,0)
  1132.          ;error($lastselectedpart,0)
  1133.          If $selected2  == $lastselectedpart2 Then
  1134.             loadLayer($selected2,$selected)
  1135.             $lastselectedlayer = $selected
  1136.             $lastselectedpart2 = $selected2
  1137.          Else
  1138.             resetLayerGUI()
  1139.             $lastselectedlayer = ""
  1140.             ;error($selected2,0)
  1141.             $lastselectedpart2 = $selected2
  1142.          EndIf
  1143.       EndIf
  1144.      
  1145.       $selected = GUICtrlRead($bodypartslst)
  1146.       If $selected == $lastselectedpart Then
  1147.          ;nope
  1148.       Else
  1149.          loadLayers($selected)
  1150.          chkLoad($selected)
  1151.          $lastselectedpart = $selected
  1152.       EndIf
  1153.      
  1154.       $selected = GUICtrlRead($bodypartslst)
  1155.       If $selected == $prevselblast Then
  1156.          ;nuh
  1157.       Else
  1158.          $prevselblast = $selected
  1159.          GUICtrlSetImage($bpprevimg,$resd&"\"&StringLower($selected)&".jpg")
  1160.       endif
  1161.      
  1162.       $sele = GUICtrlRead($singlesidechk)
  1163.       $selected = GUICtrlRead($bodypartslst)
  1164.       if $sele == $lastchk Then
  1165.          
  1166.       Else
  1167.          $it = StringLower($selected)
  1168.          $sv = "0"
  1169.          $lastchk = $sele
  1170.          if $sele == $GUI_CHECKED Then
  1171.             $sv = "1"
  1172.          Else
  1173.             $sv = "0"
  1174.          EndIf
  1175.          Switch $it
  1176.             Case "bodyl"
  1177.                SaveSSE($sv,"","","")
  1178.             Case "bodyr"
  1179.                SaveSSE($sv,"","","")
  1180.             Case "equipl"
  1181.                SaveSSE("",$sv,"","")
  1182.             Case "equipr"
  1183.                SaveSSE("",$sv,"","")
  1184.             Case "eyel"
  1185.                SaveSSE("","",$sv,"")
  1186.             Case "eyer"
  1187.                SaveSSE("","",$sv,"")
  1188.             Case "headl"
  1189.                SaveSSE("","","",$sv)
  1190.             Case "headr"
  1191.                SaveSSE("","","",$sv)
  1192.          EndSwitch
  1193.       EndIf
  1194.       if $msg == $changeprsbttn Then ;NFLU, Main one have fun JBR :o this is like time travelling but also sad because you're speaking to yourself o3o ;#CODESUPDATE
  1195.          $selectedsl = GUICtrlRead($prsslotlst)
  1196.          If $selectedsl == "" Then
  1197.             error("No slot selected",0)
  1198.          Else
  1199.             $useranswer = InputBox("Change?", "Are you sure you want to remove everything in "&$selectedsl&" and replace it with the new textures and material file?(Type 'yes' to confirm)")
  1200.             if $useranswer == "yes" Then
  1201.                $error = 0
  1202.                $cngerr = 1
  1203.                $done = 0
  1204.                $tempmatdir = ""
  1205.                $presetloc = ""
  1206.                Local $sizer = UBound($bodypartsArray)
  1207.                for $i = 0 to $sizer-1
  1208.                   $lyrs = ScanFolder($tempd&"\layers\"&StringLower($bodypartsArray[$i]))
  1209.                   _ArraySort($lyrs)
  1210.                   $szs = UBound($lyrs)
  1211.                   If $szs < 2 Then
  1212.                      ;err
  1213.                   Else
  1214.                      $cngerr = 0
  1215.                      If $done == 0 Then
  1216.                         $done = 1
  1217.                         $presetloc = $fhpresetsdir&"\"&$selectedsl
  1218.                         ClearFolder($presetloc)
  1219.                         $tempmatdir = $tempd&"\tempmatfin.txt"
  1220.                         If FileExists($tempmatdir) Then
  1221.                            FileDelete($tempmatdir)
  1222.                         EndIf
  1223.                      EndIf
  1224.                      
  1225.                      $attm = StringRight($bodypartsArray[$i],1)
  1226.                      $attm = StringLower($attm)
  1227.                      
  1228.                      $single = 0
  1229.                      $nam = ""
  1230.                      If $attm == "l" Or $attm == "r" Then
  1231.                         if StringLower($bodypartsArray[$i]) == "tail" Then
  1232.                            $nam = $bodypartsArray[$i]
  1233.                            $attm = ""
  1234.                         Else
  1235.                            $nam = StringTrimRight($bodypartsArray[$i],1)
  1236.                            $single = 1
  1237.                         EndIf
  1238.                      Else
  1239.                         $nam = $bodypartsArray[$i]
  1240.                         $attm = ""
  1241.                      EndIf
  1242.                      $nam = StringLower($nam)
  1243.                      FileWriteLine($tempmatdir,"material "&$selectedsl&"_"&$nam&"Mat"&StringUpper($attm))
  1244.                      
  1245.                      FileWriteLine($tempmatdir,"{")
  1246.                      FileWriteLine($tempmatdir,"technique")
  1247.                      FileWriteLine($tempmatdir,"{")
  1248.                      For $i2 = 0 to $szs-1
  1249.                         If $i2 == 0 Then
  1250.                            ;nuh
  1251.                         Else
  1252.                            $read = $tempd&"\layers\"&StringLower($bodypartsArray[$i])&"\"&$lyrs[$i2]
  1253.                            Local $info
  1254.                            _FileReadToArray($read, $info)
  1255.                            $type =$info[1]
  1256.                            $loc = $info[2]
  1257.                            
  1258.                            If FileExists($loc) Then
  1259.                               Local $szDrive, $szDir, $szFName, $szExt
  1260.                               Local $TestPath = _PathSplit($loc, $szDrive, $szDir, $szFName, $szExt)
  1261.                               if ischecked(StringLower($bodypartsArray[$i])) Then
  1262.                                  $f = $presetloc&"\"&$selectedsl&StringLower($bodypartsArray[$i])&"layer_"&$i2&$szExt
  1263.                               Else
  1264.                                  $f = $presetloc&"\"&$selectedsl&$nam&"layer_"&$i2&$szExt
  1265.                               EndIf
  1266.                               if FileExists($f) Then
  1267.                                  FileDelete($f)
  1268.                               EndIf
  1269.  
  1270.                               FileCopy($loc, $f)
  1271.                              
  1272.                               if ischecked(StringLower($bodypartsArray[$i])) Then
  1273.                                  $txtvars = $selectedsl&StringLower($bodypartsArray[$i])&"layer_"&$i2&$szExt
  1274.                               Else
  1275.                                  $txtvars = $selectedsl&$nam&"layer_"&$i2&$szExt
  1276.                               EndIf
  1277.                               $exvars = $szExt
  1278.                               $pnumvars = StringTrimLeft($selectedsl,7)
  1279.                               $bpvars = StringLower($bodypartsArray[$i])
  1280.                               $lnumvars = $i2
  1281.                               $sidevars = $attm
  1282.                               $bpsvars = $nam
  1283.                              
  1284.                              
  1285.                               Local $s_pass[1]
  1286.                               Local $s_bpass[1]
  1287.                               Local $s_tu[1]
  1288.                               Local $s_a_tu[1]
  1289.                               Local $scriptslv = lfGetScripts($read)
  1290.                               $sizei = UBound($scriptslv)
  1291.                               for $izi = 0 to $sizei-1
  1292.                                  if $scriptslv[$izi] == "" Then
  1293.                                    
  1294.                                  Else
  1295.                                     $scriptloc = $scriptsd&"\"&$scriptslv[$izi]&".txt"
  1296.                                     if FileExists($scriptloc) then
  1297.                                        scriptRead($scriptloc)
  1298.                                     EndIf
  1299.                                  EndIf
  1300.                               Next
  1301.                              
  1302.                              
  1303.                               FileWriteLine($tempmatdir,"pass")
  1304.                               FileWriteLine($tempmatdir,"{")
  1305.                               ;ambient 1.000000 1.000000 1.000000 1.000000
  1306.                               ;diffuse 1.000000 1.000000 1.000000 1.000000
  1307.                               ;specular 0.050000 0.050000 0.050000 1.000000
  1308.                               ;emissive 1.000000 1.000000 1.000000 1.000000
  1309.                              
  1310.                               $sizey = UBound($s_bpass)
  1311.                               for $iri = 0 to $sizey -1
  1312.                                  $liney = $s_bpass[$iri]
  1313.                                  if $liney == "" Then
  1314.                                    
  1315.                                  Else
  1316.                                     $liney = InsertVars($liney,$txtvars,$exvars,$pnumvars,$bpvars,$bpsvars,$sidevars,$lnumvars) ;herreee
  1317.                                     FileWriteLine($tempmatdir,$liney)
  1318.                                  EndIf
  1319.                               Next
  1320.                              
  1321.                              
  1322.                               FileWriteLine($tempmatdir,"ambient "&$info[3]&" "&$info[4]&" "&$info[5]&" "&$info[6])
  1323.                               FileWriteLine($tempmatdir,"diffuse "&$info[7]&" "&$info[8]&" "&$info[9]&" "&$info[10])
  1324.                               FileWriteLine($tempmatdir,"specular "&$info[11]&" "&$info[12]&" "&$info[13]&" "&$info[14])
  1325.                               FileWriteLine($tempmatdir,"emissive "&$info[15]&" "&$info[16]&" "&$info[17]&" "&$info[18])
  1326.                              
  1327.                               $sizey = UBound($s_pass)
  1328.                               for $iri = 0 to $sizey -1
  1329.                                  $liney = $s_pass[$iri]
  1330.                                  if $liney == "" Then
  1331.                                    
  1332.                                  Else
  1333.                                     $liney = InsertVars($liney,$txtvars,$exvars,$pnumvars,$bpvars,$bpsvars,$sidevars,$lnumvars) ;herreee
  1334.                                     FileWriteLine($tempmatdir,$liney)
  1335.                                  EndIf
  1336.                               Next
  1337.                              
  1338.                              
  1339.                               FileWriteLine($tempmatdir,"texture_unit")
  1340.                               FileWriteLine($tempmatdir,"{")
  1341.                               if ischecked(StringLower($bodypartsArray[$i])) Then
  1342.                                  FileWriteLine($tempmatdir,"texture "&$selectedsl&StringLower($bodypartsArray[$i])&"layer_"&$i2&$szExt)
  1343.                               Else
  1344.                                  FileWriteLine($tempmatdir,"texture "&$selectedsl&$nam&"layer_"&$i2&$szExt)
  1345.                               EndIf
  1346.                               if $info[19] == "0" and $info[20] == "0" Then
  1347.                                  ;nope
  1348.                               Else
  1349.                                  FileWriteLine($tempmatdir,"scroll_anim "&$info[19]&" "&$info[20])
  1350.                               EndIf
  1351.                               if $info[21] == "0" Then
  1352.                                  ;nope
  1353.                               Else
  1354.                                  FileWriteLine($tempmatdir,"rotate_anim "&$info[21])
  1355.                               EndIf
  1356.                               $sizey = UBound($s_tu)
  1357.                               for $iri = 0 to $sizey -1
  1358.                                  $liney = $s_tu[$iri]
  1359.                                  if $liney == "" Then
  1360.                                    
  1361.                                  Else
  1362.                                     $liney = InsertVars($liney,$txtvars,$exvars,$pnumvars,$bpvars,$bpsvars,$sidevars,$lnumvars) ;herreee
  1363.                                     FileWriteLine($tempmatdir,$liney)
  1364.                                  EndIf
  1365.                               Next
  1366.                               FileWriteLine($tempmatdir,"}")
  1367.                               $sizey = UBound($s_a_tu)
  1368.                               for $iri = 0 to $sizey -1
  1369.                                  $liney = $s_a_tu[$iri]
  1370.                                  if $liney == "" Then
  1371.                                    
  1372.                                  Else
  1373.                                     $liney = InsertVars($liney,$txtvars,$exvars,$pnumvars,$bpvars,$bpsvars,$sidevars,$lnumvars) ;herreee
  1374.                                     FileWriteLine($tempmatdir,$liney)
  1375.                                  EndIf
  1376.                               Next
  1377.                               FileWriteLine($tempmatdir,"}")
  1378.                            Else
  1379.                               If $error == 0 Then
  1380.                                  error("Error loading textures",0)
  1381.                                  $error = 1
  1382.                               EndIf
  1383.                            EndIf
  1384.                            
  1385.                         EndIf
  1386.                      Next
  1387.                      FileWriteLine($tempmatdir,"}")
  1388.                      FileWriteLine($tempmatdir,"}")
  1389.                   EndIf
  1390.                Next
  1391.                
  1392.                
  1393.                if $cngerr == 1 Then
  1394.                   error("No textures found",0)
  1395.                EndIf
  1396.                
  1397.                If $error == 0 Then
  1398.                   FileCopy($tempmatdir, $fhpresetsdir&"\"&$selectedsl&"\"&$selectedsl&".material")
  1399.                
  1400.                   If FileExists($tempmatdir) Then
  1401.                      FileDelete($tempmatdir)
  1402.                   EndIf
  1403.                   MsgBox(0,"Done","Successfully changed "&$selectedsl)
  1404.                EndIf
  1405.                
  1406.             EndIf
  1407.          EndIf
  1408.       EndIf
  1409.    EndIf
  1410. WEnd
  1411. ;=========
  1412. ;=========
  1413. ;=========
  1414.  
  1415. Func loadLayers($part)
  1416.    Local $l = $tempd&"\layers\"&StringLower($part)
  1417.    Local $layers = ScanFolder($l)
  1418.    Local $size = UBound($layers)
  1419.    Local $curlnum = 0
  1420.    GUICtrlSetData($layerslst, "")
  1421.    If $size >0 Then
  1422.       For $i = 0 to $size -1
  1423.          ;MsgBox(0,"",String($curlnum))
  1424.          For $i2 = 0 to $size -1
  1425.             Local $trimmed = StringTrimLeft($layers[$i2],5)
  1426.             if StringTrimRight($trimmed,4) == String($curlnum) Then
  1427.                GUICtrlSetData($layerslst, $layers[$i2]&"|")
  1428.             EndIf
  1429.          Next
  1430.          $curlnum += 1
  1431.       Next
  1432.    Else
  1433.       GUICtrlSetData($layerslst, "")
  1434.    EndIf
  1435. EndFunc
  1436.  
  1437. Func loadLayer($part,$layer) ;#CODESUPDATE
  1438.    Local $l = $tempd&"\layers\"&StringLower($part)&"\"&$layer
  1439.    If FileExists($l) Then
  1440.       Local $layerinfo
  1441.       _FileReadToArray($l, $layerinfo)
  1442.       GUICtrlSetData($sellaytxttxt,$layerinfo[2])
  1443.       GUICtrlSetData($ambin1,$layerinfo[3])
  1444.       GUICtrlSetData($ambin2,$layerinfo[4])
  1445.       GUICtrlSetData($ambin3,$layerinfo[5])
  1446.       GUICtrlSetData($ambin4,$layerinfo[6])
  1447.      
  1448.       GUICtrlSetData($diff1,$layerinfo[7])
  1449.       GUICtrlSetData($diff2,$layerinfo[8])
  1450.       GUICtrlSetData($diff3,$layerinfo[9])
  1451.       GUICtrlSetData($diff4,$layerinfo[10])
  1452.      
  1453.       GUICtrlSetData($spec1,$layerinfo[11])
  1454.       GUICtrlSetData($spec2,$layerinfo[12])
  1455.       GUICtrlSetData($spec3,$layerinfo[13])
  1456.       GUICtrlSetData($spec4,$layerinfo[14])
  1457.      
  1458.       GUICtrlSetData($emit1,$layerinfo[15])
  1459.       GUICtrlSetData($emit2,$layerinfo[16])
  1460.       GUICtrlSetData($emit3,$layerinfo[17])
  1461.       GUICtrlSetData($emit4,$layerinfo[18])
  1462.      
  1463.       GUICtrlSetData($scrollaniminx,$layerinfo[19])
  1464.       GUICtrlSetData($scrollaniminy,$layerinfo[20])
  1465.      
  1466.       GUICtrlSetData($rotateanimin,$layerinfo[21])
  1467.       lvDelAll($scriptslst)
  1468.       Local $scriptslv = lfGetScripts($l)
  1469.       $sizei = UBound($scriptslv)
  1470.       for $izi = 0 to $sizei-1
  1471.          if $scriptslv[$izi] == "" Then
  1472.            
  1473.          Else
  1474.             GUICtrlCreateListViewItem($scriptslv[$izi],$scriptslst)
  1475.          EndIf
  1476.       Next
  1477.    EndIf
  1478. EndFunc
  1479.  
  1480. Func isTexture($ittxt,$word)
  1481.    $exit = stringRight($ittxt, 4)
  1482.    $findit = StringInStr($ittxt,$word,0)
  1483.    if $findit == 0 Then
  1484.       ; o.o
  1485.    Else
  1486.       if $exit == ".png" or $exit == ".jpg" Then
  1487.          return True ;it's a texture!!! :D paty!!
  1488.       EndIf
  1489.    EndIf
  1490.    return False ;de cake is a lie
  1491. EndFunc
  1492.  
  1493. Func error($msg,$crash) ;cuz you're just too lazy to keep writing msgbox and exit :D
  1494.    if $crash == 1 Then
  1495.       MsgBox(48,"Crash",$msg) ;CRASHHH AHH people gonna freak when day see dis :D hopefully they won't o3o
  1496.       Exit
  1497.    Else
  1498.       MsgBox(48,"Error",$msg) ;ERROR oh noez D:
  1499.    EndIf
  1500. EndFunc
  1501.  
  1502. Func SaveOptions($o1,$o2) ;why did I even make this function o.o eh Still need it though bro, don't delete
  1503.    Local $opsd2
  1504.    _FileReadToArray($opsf, $opsd2)
  1505.    If $o1 == "default" Then
  1506.       $o1 = $opsd2[1]
  1507.    EndIf
  1508.    If $o2 == "default" Then
  1509.       $o2 = $opsd2[2]
  1510.    EndIf
  1511.    If FileExists($opsf) Then
  1512.       FileDelete($opsf)
  1513.    EndIf
  1514.    FileWriteLine($opsf,$o1)
  1515.    FileWriteLine($opsf,$o2)
  1516. EndFunc
  1517.  
  1518. Func chkLoad($bitm)
  1519.    Local $seeo
  1520.    $se = $tempd&"\layers\sse.txt"
  1521.    $it = StringLower($bitm)
  1522.    _FileReadToArray($se, $seeo)
  1523.    $check = False
  1524.    $num = 0
  1525.    Switch $it
  1526.       Case "bodyl"
  1527.          $num = 1
  1528.       Case "bodyr"
  1529.          $num = 1
  1530.       Case "equipl"
  1531.          $num = 2
  1532.       Case "equipr"
  1533.          $num = 2
  1534.       Case "eyel"
  1535.          $num = 3
  1536.       Case "eyer"
  1537.          $num = 3
  1538.       Case "headl"
  1539.          $num = 4
  1540.       Case "headr"
  1541.          $num = 4
  1542.       Case Else
  1543.          $num = 0
  1544.          $check = True
  1545.    EndSwitch
  1546.    if $num == 0 Then
  1547.    
  1548.    Else
  1549.       if $seeo[$num] == "0" Then
  1550.          $check = False
  1551.       Else
  1552.          $check = True
  1553.       EndIf
  1554.    EndIf
  1555.    
  1556.    if $check Then
  1557.       GUICtrlSetState($singlesidechk, $GUI_CHECKED)
  1558.    Else
  1559.       GUICtrlSetState($singlesidechk, $GUI_UNCHECKED)
  1560.    EndIf
  1561.    
  1562. EndFunc
  1563.  
  1564. Func SaveSSE($a,$b,$c,$d) ;why did I even make this function o.o eh Still need it though bro, don't delete
  1565.    Local $seeo
  1566.    $se = $tempd&"\layers\sse.txt"
  1567.    _FileReadToArray($se, $seeo)
  1568.    If $a == "" Then
  1569.       $a = $seeo[1]
  1570.    EndIf
  1571.    If $b == "" Then
  1572.       $b = $seeo[2]
  1573.    EndIf
  1574.    If $c == "" Then
  1575.       $c = $seeo[3]
  1576.    EndIf
  1577.    If $d == "" Then
  1578.       $d = $seeo[4]
  1579.    EndIf
  1580.    If FileExists($se) Then
  1581.       FileDelete($se)
  1582.    EndIf
  1583.    FileWriteLine($se,$a)
  1584.    FileWriteLine($se,$b)
  1585.    FileWriteLine($se,$c)
  1586.    FileWriteLine($se,$d)
  1587. EndFunc
  1588.  
  1589. Func GetFile($SourceFolder,$gfwrd) ;dis is a handy dandy function :D
  1590.    Local $Search
  1591.    Local $File
  1592.    Local $FileAttributes
  1593.    Local $FullFilePath
  1594.    Local $scanfolderarray[1]
  1595.    $Search = FileFindFirstFile($SourceFolder & "\*.*")  
  1596.    Local $result = ""
  1597.    While 1
  1598.       If $Search = -1 Then
  1599.          ExitLoop
  1600.       EndIf
  1601.  
  1602.         $File = FileFindNextFile($Search)
  1603.         If @error Then ExitLoop
  1604.        
  1605.         $FullFilePath = $SourceFolder & "\" & $File
  1606.        
  1607.         If isTexture($File,$gfwrd) Then
  1608.            $result = $File
  1609.             ExitLoop
  1610.          EndIf
  1611.  
  1612.     WEnd
  1613.     FileClose($Search)
  1614.     Return $result
  1615.  EndFunc
  1616.  
  1617. Func ScanFolder($SourceFolder) ;returns an array of the folder items (File name only cuz you have to know the source to import anyway duh)
  1618.    Local $Search
  1619.    Local $File
  1620.    Local $FileAttributes
  1621.    Local $FullFilePath
  1622.    Local $scanfolderarray[1]
  1623.    $Search = FileFindFirstFile($SourceFolder & "\*.*")  
  1624.  
  1625.    While 1
  1626.       If $Search = -1 Then
  1627.          ExitLoop
  1628.       EndIf
  1629.  
  1630.         $File = FileFindNextFile($Search)
  1631.         If @error Then ExitLoop
  1632.        
  1633.         $FullFilePath = $SourceFolder & "\" & $File
  1634.         $FileAttributes = FileGetAttrib($FullFilePath)
  1635.        
  1636.          ;If StringInStr($FileAttributes,"D") Then
  1637.             _ArrayInsert($scanfolderarray, 1, $File)
  1638.          ;EndIf
  1639.  
  1640.     WEnd
  1641.     FileClose($Search)
  1642.     Return $scanfolderarray
  1643.  EndFunc
  1644.  
  1645. Func CopyFolderFiles($OldFolder, $NewFolder) ;handy dandy :D
  1646.    Local $files = ScanFolder($OldFolder)
  1647.    Local $size = UBound($files)
  1648.    If $size > 0 Then
  1649.       for $iz = 0 to $size-1
  1650.          $f = $NewFolder&"\"&$files[$iz]
  1651.          If FileExists($f) Then
  1652.             FileDelete($f)
  1653.          EndIf
  1654.          FileCopy($OldFolder&"\"&$files[$iz],$NewFolder) ;de oldy folder is old
  1655.       Next
  1656.    EndIf
  1657. EndFunc
  1658.  
  1659.  Func CountFolder($SourceFolder) ;how many things are in this folder? and no JBR it does not start at 0, get your numbers right xD
  1660.    Local $Search
  1661.    Local $File
  1662.    Local $FileAttributes
  1663.    Local $FullFilePath
  1664.    Local $count = 0
  1665.    $Search = FileFindFirstFile($SourceFolder & "\*.*")  
  1666.  
  1667.    While 1
  1668.       If $Search = -1 Then
  1669.          ExitLoop
  1670.       EndIf
  1671.  
  1672.         $File = FileFindNextFile($Search)
  1673.         If @error Then ExitLoop
  1674.        
  1675.         $FullFilePath = $SourceFolder & "\" & $File
  1676.         $FileAttributes = FileGetAttrib($FullFilePath)
  1677.        
  1678.          ;If StringInStr($FileAttributes,"D") Then
  1679.             $count += 1
  1680.          ;EndIf
  1681.  
  1682.     WEnd
  1683.     FileClose($Search)
  1684.     Return $count
  1685.  EndFunc
  1686.  
  1687.  Func ClearFolder($SourceFolder) ;bye bye D:
  1688.     Local $Search
  1689.     Local $File
  1690.     Local $FileAttributes
  1691.     Local $FullFilePath
  1692.    
  1693.     $Search = FileFindFirstFile($SourceFolder & "\*.*")  
  1694.  
  1695.     While 1
  1696.         If $Search = -1 Then
  1697.             ExitLoop
  1698.         EndIf
  1699.        
  1700.         $File = FileFindNextFile($Search)
  1701.         If @error Then ExitLoop
  1702.        
  1703.         $FullFilePath = $SourceFolder & "\" & $File
  1704.         $FileAttributes = FileGetAttrib($FullFilePath)
  1705.        
  1706.         If StringInStr($FileAttributes,"D") Then
  1707.             ScanFolder($FullFilePath)
  1708.         Else
  1709.             FileDelete($FullFilePath)
  1710.         EndIf
  1711.  
  1712.     WEnd
  1713.  
  1714.     FileClose($Search)
  1715.  EndFunc
  1716.  
  1717. Func FCreateO($fcodir) ;create a dir and remove and creat again if already exists
  1718.    if FileExists($fcodir) Then
  1719.       FileDelete($fcodir)
  1720.    EndIf
  1721.    DirCreate($fcodir)
  1722. EndFunc
  1723.  
  1724. Func existloade($a,$b) ;kinda inefficient coding but who's gonna question it :D
  1725.    if FileExists($a) AND FileExists($b) Then
  1726.       CopyFolderFiles($a,$b)
  1727.    Else
  1728.       $loaderror = 1
  1729.    EndIf
  1730. EndFunc
  1731.  
  1732. Func existsavee($a,$b) ;same as load but save duhh
  1733.    if FileExists($a) AND FileExists($b) Then
  1734.       CopyFolderFiles($a,$b)
  1735.    Else
  1736.       $saveerror = 1
  1737.    EndIf
  1738. EndFunc
  1739.  
  1740. Func ClearAllLayers() ; :O why dey removing all the layers like that o3o
  1741.    Local $size = UBound($bodypartsArray)
  1742.    for $i = 0 to $size-1
  1743.       ClearFolder($tempd&"\layers\"&StringLower($bodypartsArray[$i]))
  1744.    Next
  1745. EndFunc
  1746.  
  1747. Func resetLayerGUI() ;I prefered the default values better, let's reset them! :D
  1748.    GUICtrlSetData($sellaytxttxt,"")
  1749.    GUICtrlSetData($ambin1,"1.000000")
  1750.    GUICtrlSetData($ambin2,"1.000000")
  1751.    GUICtrlSetData($ambin3,"1.000000")
  1752.    GUICtrlSetData($ambin4,"1.000000")
  1753.    
  1754.    GUICtrlSetData($diff1,"1.000000")
  1755.    GUICtrlSetData($diff2,"1.000000")
  1756.    GUICtrlSetData($diff3,"1.000000")
  1757.    GUICtrlSetData($diff4,"1.000000")
  1758.    
  1759.    GUICtrlSetData($spec1,"0.050000")
  1760.    GUICtrlSetData($spec2,"0.050000")
  1761.    GUICtrlSetData($spec3,"0.050000")
  1762.    GUICtrlSetData($spec4,"1.000000")
  1763.    
  1764.    GUICtrlSetData($emit1,"0.000000")
  1765.    GUICtrlSetData($emit2,"0.000000")
  1766.    GUICtrlSetData($emit3,"0.000000")
  1767.    GUICtrlSetData($emit4,"1.000000")
  1768.    
  1769.    GUICtrlSetData($rotateanimin,0)
  1770.    
  1771.    GUICtrlSetData($scrollaniminx,0)
  1772.    GUICtrlSetData($scrollaniminy,0)
  1773.    lvDelAll($scriptslst)
  1774. EndFunc
  1775.  Func lvDelAll($lv)
  1776.    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($lv))
  1777. EndFunc
  1778.  
  1779. Func lvGetItms($lv)
  1780.    Local $arraytmp[1]
  1781.    $len = ControlListView("","",$lv,"GetItemCount")
  1782.    for $lvtmi = 0 to $len-1
  1783.       Local $txter = ControlListView("","",$lv,"GetText",$lvtmi,0)
  1784.       _ArrayAdd($arraytmp,$txter)
  1785.    Next
  1786.    return $arraytmp
  1787. EndFunc
  1788.  
  1789. Func lfGetScripts($lf)
  1790.    If FileExists($lf) Then
  1791.       Local $layerinfo
  1792.       Local $arraytmp[1]
  1793.       Local $strt
  1794.       _FileReadToArray($lf, $layerinfo)
  1795.       if FileReadLine($lf, 22) == "[scripts]" Then
  1796.          $strt = 22
  1797.       Else
  1798.          $strt = 0
  1799.          For $izy = 1 to _FileCountLines($lf)
  1800.             $line = FileReadLine($lf, $izy)
  1801.             if $izy == "[scripts]" Then
  1802.                $strt = $izy
  1803.             EndIf
  1804.          Next
  1805.       EndIf
  1806.      
  1807.       If $strt == 0 Then
  1808.          Return $arraytmp
  1809.       Else
  1810.          For $izy = $strt+1 to _FileCountLines($lf)
  1811.             $line = FileReadLine($lf, $izy)
  1812.             if $line == "" Then
  1813.                
  1814.             Else
  1815.                _ArrayAdd($arraytmp,$line)
  1816.             EndIf
  1817.          Next
  1818.          Return $arraytmp
  1819.       EndIf
  1820.    EndIf
  1821. EndFunc
  1822.  
  1823. Func scriptRead($scrpath)
  1824.    $section = "NULL"
  1825.    For $iyi = 1 to _FileCountLines($scrpath)
  1826.       $line = FileReadLine($scrpath, $iyi)
  1827.       if $line == "" Then
  1828.          ;no
  1829.       Else
  1830.          if StringLeft($line,9) == "[SECTION]" Then
  1831.             $section = StringTrimLeft($line,9)
  1832.          Else
  1833.             if $section == "NULL" Then
  1834.                
  1835.             Else
  1836.                Switch $section
  1837.                   Case "pass"
  1838.                      _ArrayAdd($s_pass,$line)
  1839.                   Case "bpass"
  1840.                      _ArrayAdd($s_bpass,$line)
  1841.                   Case "tu"
  1842.                      _ArrayAdd($s_tu,$line)
  1843.                   Case "a_tu"
  1844.                      _ArrayAdd($s_a_tu,$line)
  1845.                EndSwitch
  1846.             EndIf
  1847.          EndIf
  1848.       EndIf
  1849.    Next
  1850. EndFunc
  1851.  
  1852. Func FCap($stringy)
  1853.    Local $letteree = StringLeft($stringy,1)
  1854.    Local $trimee = StringTrimLeft($stringy,1)
  1855.    $letteree = StringUpper($letteree)
  1856.    Return $letteree&$trimee
  1857. EndFunc
  1858. Func ECap($stringy)
  1859.    Local $letteree = StringRight($stringy,1)
  1860.    Local $trimee = StringTrimRight($stringy,1)
  1861.    $letteree = StringUpper($letteree)
  1862.    Return $trimee&$letteree
  1863. EndFunc
  1864.  
  1865. Func InsertVars($stringer,$texture,$ex,$pnum,$bp,$bps,$sd,$lnum)
  1866.    $stringer = StringReplace($stringer,"{pnum}",$pnum)
  1867.    $stringer = StringReplace($stringer,"{bp}",$bp)
  1868.    Local $lowerbps = StringLower($bps)
  1869.    Local $fbps = FCap($bps)
  1870.    $stringer = StringReplace($stringer,"{bpc}",$fbps&StringUpper($sd))
  1871.    $stringer = StringReplace($stringer,"{bps}",$lowerbps)
  1872.    $stringer = StringReplace($stringer,"{bpsc}",$fbps)
  1873.    $stringer = StringReplace($stringer,"{sd}",StringLower($sd))
  1874.    $stringer = StringReplace($stringer,"{sdc}",StringUpper($sd))
  1875.    $stringer = StringReplace($stringer,"{texture}",$texture)
  1876.    $stringer = StringReplace($stringer,"{ex}",$ex)
  1877.    $stringer = StringReplace($stringer,"{lnum}",$lnum)
  1878.    Return $stringer
  1879. EndFunc
  1880.  
  1881. Func ischecked($part)
  1882.    Local $seeo
  1883.    $se = $tempd&"\layers\sse.txt"
  1884.    $it = StringLower($part)
  1885.    _FileReadToArray($se, $seeo)
  1886.    $check = False
  1887.    $num = 0
  1888.    Switch $it
  1889.       Case "bodyl"
  1890.          $num = 1
  1891.       Case "bodyr"
  1892.          $num = 1
  1893.       Case "equipl"
  1894.          $num = 2
  1895.       Case "equipr"
  1896.          $num = 2
  1897.       Case "eyel"
  1898.          $num = 3
  1899.       Case "eyer"
  1900.          $num = 3
  1901.       Case "headl"
  1902.          $num = 4
  1903.       Case "headr"
  1904.          $num = 4
  1905.       Case Else
  1906.          $num = 0
  1907.          $check = True
  1908.    EndSwitch
  1909.    if $num == 0 Then
  1910.    
  1911.    Else
  1912.       if $seeo[$num] == "0" Then
  1913.          $check = False
  1914.       Else
  1915.          $check = True
  1916.       EndIf
  1917.    EndIf
  1918.    Return $check
  1919. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement