Advertisement
ssccsscc

Tpt ingame brush editor

Jun 19th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.79 KB | None | 0 0
  1. unpack = unpack or table.unpack
  2. local a = {}
  3. local function add(...)
  4. local arg = {...}
  5. if arg[2]=='brusheditor_window' then
  6. arg[1][arg[3]]={}
  7. arg[1][arg[3]]['params']={}
  8. arg[1][arg[3]]['params']['show']=false
  9. arg[1][arg[3]]['params']['Type']=arg[2]
  10. arg[1][arg[3]]['params']['x1']=arg[4]
  11. arg[1][arg[3]]['params']['y1']=arg[5]
  12. arg[1][arg[3]]['params']['w']=arg[6]
  13. arg[1][arg[3]]['params']['h']=arg[7]
  14. arg[1][arg[3]]['params']['name']=arg[3]
  15. arg[1][arg[3]]['params']['movable']=arg[8]
  16. arg[1][arg[3]]['params']['active']=true
  17. arg[1][arg[3]]['items']={}
  18. else
  19. _G[arg[2]](2,arg)
  20. end
  21. end
  22.  
  23. function brusheditor_button(a,x,y,mx,my,e)
  24. if a==0 then
  25. graphics.fillRect(x.x1+y.x1,x.y1+y.y1,x.w,x.h,100,100,100)
  26. graphics.fillRect(x.x1+y.x1,x.y1+y.y1,x.w-1,x.h-1,200,200,200)
  27. if x.pressed==1 then
  28. graphics.fillRect(x.x1+y.x1+1,x.y1+y.y1+1,x.w-2,x.h-2,230,230,230)
  29. else
  30. graphics.fillRect(x.x1+y.x1+1,x.y1+y.y1+1,x.w-2,x.h-2,200,200,200)
  31. end
  32. graphics.drawText(x.x1 +(x.w-graphics.textSize(x.name))/2+y.x1, x.y1+y.y1+3 ,x.name,0,0,0)
  33. elseif a==1 then
  34. if x.pressed==1 and e==2 then
  35. x.pressed=0
  36. end
  37. if y.x1+x.x1<mx and y.x1+x.x1+x.w>mx and y.y1+x.y1<my and y.y1+x.y1+x.h>my then
  38. if e==2 then
  39. x.action(x.p1,x.p2)
  40. x.pressed=0
  41. elseif e==1 then
  42. x.pressed=1
  43. end
  44. end
  45. elseif a==2 then
  46. x[1][x[3]]['items'][x[4]]={}
  47. x[1][x[3]]['items'][x[4]]['params']={}
  48. x[1][x[3]]['items'][x[4]]['params']['Type']=x[2]
  49. x[1][x[3]]['items'][x[4]]['params']['show']=false
  50. x[1][x[3]]['items'][x[4]]['params']['x1']=x[5]
  51. x[1][x[3]]['items'][x[4]]['params']['y1']=x[6]
  52. x[1][x[3]]['items'][x[4]]['params']['w']=x[7]
  53. x[1][x[3]]['items'][x[4]]['params']['h']=x[8]
  54. x[1][x[3]]['items'][x[4]]['params']['action']=x[9]
  55. x[1][x[3]]['items'][x[4]]['params']['p1']=x[10]
  56. x[1][x[3]]['items'][x[4]]['params']['p2']=x[11]
  57. x[1][x[3]]['items'][x[4]]['params']['name']=x[4]
  58. elseif a==3 then
  59. end
  60. end
  61.  
  62. function brusheditor_window(a,x,mx,my,e)
  63. if a==0 then
  64. graphics.fillRect(x.x1,x.y1,x.w-1,x.h-1,200,200,200)
  65. graphics.fillRect(x.x1+1,x.y1+1,x.w-1,x.h-1,100,100,100)
  66. graphics.fillRect(x.x1+1,x.y1,x.w-2,x.h-2)
  67. if x.movable==true then
  68. graphics.fillRect(x.x1,x.y1,x.w,10,150,150,255)
  69. graphics.drawText(x.x1 +(x.w-graphics.textSize(x.name))/2 ,x.y1+2,x.name,0,0,0)
  70. end
  71. elseif a==1 then
  72. if x.pressed==1 and e==2 then
  73. x.pressed=0
  74. end
  75. if x.x1<mx and x.x1+x.w>mx and x.y1<my and x.y1+10>my and x.movable==true then
  76. if e==1 then
  77. x.pressed=1
  78. x.px=mx
  79. x.py=my
  80. end
  81. end
  82. if x.pressed==1 and e==3 then
  83. local nx=x.x1-x.px+mx
  84. local ny=x.y1-x.py+my
  85. if nx>-1 and nx+x.w<642 then
  86. x.x1=nx
  87. x.px=mx
  88. end
  89. if ny>0 and ny+x.h<424 then
  90. x.y1=ny
  91. x.py=my
  92. end
  93. end
  94. elseif a==2 then
  95. elseif a==3 then
  96. end
  97. end
  98.  
  99. function brusheditor_text(a,x,y)
  100. if a==0 then
  101. graphics.drawText(x.x1+y.x1,x.y1+y.y1,x.name,0,0,0)
  102. elseif a==1 then
  103. elseif a==2 then
  104. x[1][x[3]]['items'][x[4]]={}
  105. x[1][x[3]]['items'][x[4]]['params']={}
  106. x[1][x[3]]['items'][x[4]]['params']['Type']=x[2]
  107. x[1][x[3]]['items'][x[4]]['params']['show']=false
  108. x[1][x[3]]['items'][x[4]]['params']['x1']=x[5]
  109. x[1][x[3]]['items'][x[4]]['params']['y1']=x[6]x[1][x[3]]['items'][x[4]]['params']['name']=x[4]
  110. elseif a==3 then
  111. end
  112. end
  113.  
  114. function brusheditor_checkbox( a,x,y,mx,my,e )
  115. if a==0 then
  116. graphics.fillRect(x.x1+y.x1,x.y1+y.y1,10,10)
  117. graphics.drawRect(x.x1+y.x1,x.y1+y.y1,10,10,0,0,0)
  118. graphics.drawText(x.x1+y.x1+15,x.y1+y.y1+1,x.name,0,0,0)
  119. if x.checked==true then
  120. graphics.fillRect(x.x1+y.x1+2,x.y1+y.y1+2,6,6,80,200,80)
  121. end
  122. elseif a==1 then
  123. if x.x1+y.x1<mx and x.x1+y.x1+10>mx and x.y1+y.y1<my and x.y1+y.y1+10>my then
  124. if e==2 and x.checked==true then
  125. x.checked=false
  126. elseif e==2 and x.checked~=true then
  127. x.checked=true
  128. end
  129. end
  130. elseif a==2 then
  131. x[1][x[3]]['items'][x[4]]={}
  132. x[1][x[3]]['items'][x[4]]['params']={}
  133. x[1][x[3]]['items'][x[4]]['params']['Type']=x[2]
  134. x[1][x[3]]['items'][x[4]]['params']['show']=false
  135. x[1][x[3]]['items'][x[4]]['params']['x1']=x[5]
  136. x[1][x[3]]['items'][x[4]]['params']['y1']=x[6]x[1][x[3]]['items'][x[4]]['params']['action']=x[7]
  137. x[1][x[3]]['items'][x[4]]['params']['checked']=x[8]
  138. x[1][x[3]]['items'][x[4]]['params']['name']=x[4]
  139. elseif a==3 then
  140. end
  141. end
  142.  
  143. function brusheditor_textbox( a,x,y,mx,my,e,k )
  144. if a==0 then
  145. if x.pressed == 1 then
  146. graphics.drawRect(x.x1+y.x1,x.y1+y.y1,x.w,x.h,255,0,0)
  147. else
  148. graphics.drawRect(x.x1+y.x1,x.y1+y.y1,x.w,x.h,0,0,0)
  149. end
  150. graphics.drawText(x.x1+y.x1+2,x.y1+y.y1+3,x.text,0,0,0)
  151. elseif a==1 then
  152. if x.pressed==1 and e==1 then
  153. x.pressed=0
  154. end
  155. if y.x1+x.x1<mx and y.x1+x.x1+x.w>mx and y.y1+x.y1<my and y.y1+x.y1+x.h>my then
  156. if e==2 then
  157. x.active=true
  158. elseif e==1 then
  159. x.pressed=1
  160. end
  161. end
  162. elseif a==2 then
  163. x[1][x[3]]['items'][x[4]]={}
  164. x[1][x[3]]['items'][x[4]]['params']={}
  165. x[1][x[3]]['items'][x[4]]['params']['Type']=x[2]
  166. x[1][x[3]]['items'][x[4]]['params']['show']=false
  167. x[1][x[3]]['items'][x[4]]['params']['x1']=x[5]
  168. x[1][x[3]]['items'][x[4]]['params']['y1']=x[6]
  169. x[1][x[3]]['items'][x[4]]['params']['w']=x[7]
  170. x[1][x[3]]['items'][x[4]]['params']['h']=x[8]
  171. x[1][x[3]]['items'][x[4]]['params']['max']=x[9]
  172. x[1][x[3]]['items'][x[4]]['params']['name']=x[4]
  173. x[1][x[3]]['items'][x[4]]['params']['text']=''
  174. elseif a==3 then
  175. if string.len(x.text)<x.max and my>47 and my <123 and k==1 and my~=8 then
  176. x.text=x.text..mx
  177. elseif my==8 and k==1 then
  178. x.text=string.sub(x.text,0,string.len(x.text)-1)
  179. elseif my==13 and k==1 then
  180. x.active=false
  181. x.pressed=0
  182. end
  183. end
  184. end
  185.  
  186. function brusheditor_brushtable( a,x,y,mx,my,e,b )
  187. if a==0 then
  188. local l=math.sqrt( #x.table )
  189. local j=1
  190. local i=1
  191. xw=l*x.cellsize+1
  192. graphics.fillRect(x.x1+y.x1,x.y1+y.y1,xw,xw,0,0,0)
  193. for k=1,#x.table do
  194. i=i+1
  195. if x.table[k]==0 then
  196. graphics.fillRect(x.x1+y.x1+i*x.cellsize-x.cellsize*2+1,x.y1+y.y1+j*x.cellsize-x.cellsize+1,x.cellsize-1,x.cellsize-1,255,255,255)
  197. else
  198. graphics.fillRect(x.x1+y.x1+i*x.cellsize-x.cellsize*2+1,x.y1+y.y1+j*x.cellsize-x.cellsize+1,x.cellsize-1,x.cellsize-1,0,0,0)
  199. end
  200. if k%l==0 then
  201. j=j+1
  202. i=1
  203. end
  204. end
  205. elseif a==1 then
  206. if x.x1+y.x1<mx and x.x1+y.x1+xw>mx and x.y1+y.y1<my and x.y1+y.y1+xw>my then
  207. local click = math.floor((mx-x.x1)/x.cellsize)+math.sqrt( #x.table )*math.floor((my-x.y1)/x.cellsize)+1
  208. if x.tool=='brush0' and e==3 and x.press==1 then
  209.   if b==1 and click <= #x.table then
  210.     x.table[click]=255
  211.   elseif b==4 and click <= #x.table then
  212.     x.table[click]=0
  213.   end
  214. elseif x.tool=='brush0' and e==1 then
  215. x.history={unpack(x.table)}
  216. x.historyL=1
  217. x.press=1
  218. elseif x.tool=='brush0' and e==2 then
  219. x.press=0
  220. elseif (x.tool=="brush1" or x.tool=="brush2") and e==1 then
  221. local l=math.sqrt( #x.table )
  222.  if x.f~=true then
  223.   x.history={unpack(x.table)}
  224.   x.historyL=1
  225.   if b==1 and click <= #x.table then
  226.     x.f=true
  227.     x.f1= math.floor((mx-x.x1)/x.cellsize)
  228.     x.f2= math.floor((my-x.y1)/x.cellsize)
  229.   elseif b==4 and click <= #x.table then
  230.     x.f=true
  231.     x.f1= math.floor((mx-x.x1)/x.cellsize)
  232.     x.f2= math.floor((my-x.y1)/x.cellsize)
  233.   end
  234.  elseif x.f==true then
  235.   x.f=false
  236.   local cx=math.floor((mx-x.x1)/x.cellsize)
  237.   local cy=math.floor((my-x.y1)/x.cellsize)
  238.   if x.f1 < cx then
  239.   x.f1,cx=cx,x.f1
  240.   end
  241.   if x.f2 < cy then
  242.   x.f2,cy=cy,x.f2
  243.   end
  244.   if b==1 and click <= #x.table then
  245.     for i=0, math.sqrt( #x.table )-1 do
  246.     for j=0, math.sqrt( #x.table )-1 do
  247. if x.tool=="brush1" then
  248.      if cx<j+1 and x.f1+1>=j+1  and cy-1<i and x.f2>=i then
  249.        x.table[i*l+j+1]=255
  250.      end
  251. else
  252. if (cx<=j and x.f1>=j and (i==cy or i==x.f2))  or ( cy-1<i and x.f2>=i and ( cx==j or j==x.f1) ) then
  253.        x.table[i*l+j+1]=255
  254.      end
  255.      
  256. end
  257.     end
  258.     end
  259.   elseif b==4 and click <= #x.table then
  260.  
  261.    for i=0, math.sqrt( #x.table )-1 do
  262.     for j=0, math.sqrt( #x.table )-1 do
  263. if x.tool=="brush1" then
  264.      if cx<j+1 and x.f1+1>=j+1  and cy-1<i and x.f2>=i then
  265.        x.table[i*l+j+1]=0
  266.      end
  267. else
  268. if (cx<=j and x.f1>=j and (i==cy or i==x.f2))  or ( cy-1<i and x.f2>=i and ( cx==j or j==x.f1) ) then
  269.        x.table[i*l+j+1]=0
  270.      end
  271.      
  272. end
  273.     end
  274.     end
  275.   end
  276.  end
  277. end
  278. end
  279. elseif a==2 then
  280. x[1][x[3]]['items'][x[4]]={}
  281. x[1][x[3]]['items'][x[4]]['params']={}
  282. x[1][x[3]]['items'][x[4]]['params']['Type']=x[2]
  283. x[1][x[3]]['items'][x[4]]['params']['show']=false
  284. x[1][x[3]]['items'][x[4]]['params']['x1']=x[5]
  285. x[1][x[3]]['items'][x[4]]['params']['y1']=x[6]
  286. x[1][x[3]]['items'][x[4]]['params']['w']=x[7]
  287. x[1][x[3]]['items'][x[4]]['params']['h']=x[8]
  288. x[1][x[3]]['items'][x[4]]['params']['action']=x[9]
  289. x[1][x[3]]['items'][x[4]]['params']['name']=x[4]
  290. x[1][x[3]]['items'][x[4]]['params']['filename']=""
  291. x[1][x[3]]['items'][x[4]]['params']['table']={}
  292. for t=1,121 do
  293. x[1][x[3]]['items'][x[4]]['params']['table'][t]=0
  294. end
  295. x[1][x[3]]['items'][x[4]]['params']['history']={}
  296. x[1][x[3]]['items'][x[4]]['params']['historyR']={}
  297. x[1][x[3]]['items'][x[4]]['params']['historyL']=0
  298. x[1][x[3]]['items'][x[4]]['params']['tool']="brush0"
  299. x[1][x[3]]['items'][x[4]]['params']['cellsize']=11
  300. elseif a==3 then
  301. end
  302. end
  303.  
  304. local function hide(...)
  305. local arg = {...}
  306. if #arg==2 then
  307. arg[1][arg[2]].params.show=false
  308. elseif #arg==3 then
  309. arg[1][arg[2]].items[arg[3]].params.show=false
  310. end
  311. end
  312.  
  313. local function show(...)
  314. local arg = {...}
  315. if #arg==2 then
  316. arg[1][arg[2]].params.show=true
  317. elseif #arg==3 then
  318. arg[1][arg[2]].items[arg[3]].params.show=true
  319. end
  320. end
  321.  
  322. local function ShowAll(a,x)
  323. for i in pairs(a) do
  324. a[i].params.active=false
  325. end
  326. show(a,x)
  327. a[x].params.active=true
  328. for i in pairs(a[x].items) do
  329. show(a,x,i)
  330. end
  331. end
  332.  
  333. local function HideAll(a,x)
  334. for i in pairs(a) do
  335. if i~='name1' then
  336. hide(a,i)
  337. end
  338. end
  339. a[x].params.active=false
  340. a['name1'].params.active=true
  341. end
  342.  
  343.  
  344. local function screen()
  345. for i in pairs(a) do
  346.     if a[i].params.show==true and a[i].params.active==false then
  347.  
  348.         _G[a[i].params.Type](0,a[i].params)
  349.         for p in pairs(a[i].items) do
  350.             _G[a[i].items[p].params.Type] (0,a[i].items[p].params,a[i].params )
  351.         end
  352.     end
  353. end
  354. for i in pairs(a) do
  355.     if a[i].params.show==true and a[i].params.active==true then
  356.  
  357.         _G[a[i].params.Type](0,a[i].params)
  358.         for p in pairs(a[i].items) do
  359.             _G[a[i].items[p].params.Type] (0,a[i].items[p].params,a[i].params )
  360.         end
  361.     end
  362. end
  363. end
  364.  
  365. local function keypress( mousex, mousey, button, event )
  366. for i in pairs(a) do
  367. if a[i].params.show==true and a[i].params.active==true then
  368. _G[a[i].params.Type](1,a[i].params,mousex,mousey,event)
  369. for j in pairs(a[i].items) do
  370. if a[i].items[j].params.show==true then
  371. _G[a[i].items[j].params.Type]( 1,a[i].items[j].params,a[i].params,mousex,mousey,event,button )
  372. end
  373. end
  374. end
  375. end
  376. return false
  377. end
  378.  
  379. local function keyp( key, nkey, modifier, event )
  380. for i in pairs(a) do
  381. if a[i].params.show==true and a[i].params.active==true then
  382. for j in pairs(a[i].items) do
  383. if a[i].items[j].params.show==true and a[i].items[j].params.pressed==1 then
  384. _G[a[i].items[j].params.Type]( 3,a[i].items[j].params,a[i].params,key,nkey,modifer,event )
  385. end
  386. end
  387. end
  388. end
  389. return false
  390. end
  391.  
  392. local function load(b,k)
  393. HideAll(a,"Open")
  394. local name = "Brushes/"..b.text..".ptb"
  395. local f=io.open(name,"r")
  396. if f==nil then
  397. tpt.throw_error("Cannot open file")
  398. else
  399. local t = {}
  400. ii = 1
  401. repeat
  402. current_byte = f:read(1)
  403. if current_byte~= nil then
  404. t[ii]= string.byte(current_byte)
  405. ii=ii+1
  406. end
  407. until current_byte == nil
  408. k.params['table']=t
  409. end
  410. end
  411.  
  412. local function createnew(x,y)
  413. HideAll(a,'New Brush')
  414. a['name1'].items.bt.params['table']={}
  415. for t=1,tonumber(x.text)*tonumber(x.text) do
  416. a['name1'].items.bt.params['table'][t]=0
  417. end
  418. a['name1'].items.bt.params['cellsize']=y.text
  419. end
  420.  
  421. local save
  422.  
  423. local function SaveAs(k,d)
  424. d.params.filename=k.text..".ptb"
  425. save(d)
  426. HideAll(a,'Save As')
  427. end
  428.  
  429. save = function(t)
  430. if t.params.filename~="" and t.params.filename~=nil then
  431. local out = io.open("Brushes/"..t.params.filename, "wb")
  432. local str = string.char(unpack(t.params.table))
  433. out:write(str)
  434. out:close()
  435. else
  436. ShowAll(a,'Save As')
  437. end
  438. end
  439.  
  440. local function changeb(x,y)
  441. x.tool=y
  442. x.f=false
  443. end
  444.  
  445. local function Undo(x)
  446. if x.params.historyL==1 then
  447. x.params.historyR={unpack(x.params.table)}
  448. x.params.table = {unpack(x.params.history)}
  449. x.params.historyL=2
  450. end
  451. end
  452.  
  453. local function Redo(x)
  454. if x.params.historyL==2 then
  455. x.params.history={unpack(x.params.table)}
  456. x.params.table = {unpack(x.params.historyR)}
  457. x.params.historyL=1
  458. end
  459. end
  460.  
  461. function BrushEditor()
  462. tpt.register_step(screen)
  463. tpt.register_mouseclick(keypress)
  464. tpt.register_keypress(keyp)
  465. ShowAll(a,'name1')
  466. end
  467.  
  468. local function ExitEditor()
  469. tpt.unregister_step(screen)
  470. tpt.unregister_mouseclick(keypress)
  471. tpt.unregister_keypress(keyp)
  472. for i in pairs(a) do
  473. hide(a,i)
  474. end
  475. end
  476.  
  477. add(a,'brusheditor_window','name1',-1,0,643,426,false)
  478. add(a,'brusheditor_window','File_dialog',0,12,50,72,false)
  479. add(a,'brusheditor_window','Edit_dialog',29,12,50,36,false)
  480. add(a,'brusheditor_window','About_dialog',58,12,50,24,false)
  481. add(a,'brusheditor_window','New Brush',200,200,100,70,true)
  482. add(a,'brusheditor_window','Tools',50,50,30,100,true)
  483. add(a,'brusheditor_window','Open',200,200,100,70,true)
  484. add(a,'brusheditor_window','Save As',200,200,100,70,true)
  485. add(a,'brusheditor_window','Info',200,200,150,150,true)
  486. ------------------------------------------
  487. --      Main            --
  488. ------------------------------------------
  489. add(a,'brusheditor_button','name1','File',0,0,30,12,ShowAll,a,'File_dialog')
  490. add(a,'brusheditor_brushtable','name1','bt',100,0)
  491. add(a,'brusheditor_button','name1','Edit',30,0,30,12,ShowAll,a,'Edit_dialog')
  492. add(a,'brusheditor_button','name1','About',60,0,30,12,ShowAll,a,'About_dialog')
  493. add(a,'brusheditor_text','name1','Tools',10,40)
  494. add(a,'brusheditor_button','name1','Filled\nSquare',10,55,35,30,changeb,a['name1'].items.bt.params,'brush1')
  495. add(a,'brusheditor_button','name1','Square',10,90,35,15, changeb,a['name1'].items.bt.params,'brush2')
  496. add(a,'brusheditor_button','name1','Point',10,110,35,15, changeb,a['name1'].items.bt.params,'brush0')
  497. ------------------------------------------
  498. --      New dialog      --
  499. ------------------------------------------
  500. add(a,'brusheditor_textbox','New Brush','File1',60,16,30,12,4,3)
  501. add(a,'brusheditor_textbox','New Brush','size',60,31,30,12,4,3)
  502. add(a,'brusheditor_button','New Brush','Ok',10,50,35,13,createnew,a['New Brush'].items.File1.params,a['New Brush'].items.size.params)
  503. add(a,'brusheditor_button','New Brush','Cancel',55,50,35,13,HideAll,a,'New Brush')
  504. add(a,'brusheditor_text','New Brush','Width',10,19)
  505. add(a,'brusheditor_text','New Brush','Cell size',10,34)
  506. ------------------------------------------
  507. --      File dialog             --
  508. ------------------------------------------
  509. add(a,'brusheditor_button','File_dialog','New',0,0,50,12,ShowAll,a,'New Brush')
  510. add(a,'brusheditor_button','File_dialog','Open',0,12,50,12,ShowAll,a,'Open')
  511. add(a,'brusheditor_button','File_dialog','Save',0,24,50,12,save,a['name1'].items.bt)
  512. add(a,'brusheditor_button','File_dialog','Save As',0,36,50,12,ShowAll,a,'Save As')
  513. add(a,'brusheditor_button','File_dialog','Exit',0,48,50,12,ExitEditor)
  514. add(a,'brusheditor_button','File_dialog','Close',0,60,50,12,HideAll,a,'File_dialog')
  515. ------------------------------------------
  516. --      Edit dialog             --
  517. ------------------------------------------
  518. add(a,'brusheditor_button','Edit_dialog','Undo',0,0,50,12,Undo,a['name1'].items.bt)
  519. add(a,'brusheditor_button','Edit_dialog','Redo',0,12,50,12,Redo,a['name1'].items.bt)
  520. add(a,'brusheditor_button','Edit_dialog','Close',0,24,50,12,HideAll,a,'Edit_dialog')
  521. ------------------------------------------
  522. --      About dialog            --
  523. ------------------------------------------
  524. add(a,'brusheditor_button','About_dialog','Info',0,0,50,12,ShowAll,a,'Info')
  525. add(a,'brusheditor_button','About_dialog','Close',0,12,50,12,HideAll,a,'About_dialog')
  526. ------------------------------------------
  527. --      Info            --
  528. ------------------------------------------
  529. add(a,'brusheditor_text','Info','Tpt ingame brush editor\nVersion: 1\nAuthor: ssccsscc\n\nIf you have question post it\nin the thread on the tpt\nforum.',10,24)
  530. add(a,'brusheditor_button','Info','Go to tpt forum',5,111,140,13,os.execute,"start http://powdertoy.co.uk/Discussions/Thread/View.html?Thread=21788")
  531. add(a,'brusheditor_button','Info','Ok',5,130,140,13,HideAll,a,'Info')
  532. ------------------------------------------
  533. --      Open            --
  534. ------------------------------------------
  535. add(a,'brusheditor_textbox','Open','File1',52,16,45,12,8,3)
  536. add(a,'brusheditor_button','Open','Ok',10,50,35,13,load,a['Open'].items.File1.params, a['name1'].items.bt )
  537. add(a,'brusheditor_button','Open','Cancel',55,50,35,13,HideAll,a,'Open')
  538. add(a,'brusheditor_text','Open','Filename\nWithout ".ptb"',10,19)
  539. ------------------------------------------
  540. --      Save As         --
  541. ------------------------------------------
  542. add(a,'brusheditor_textbox','Save As','File1',52,16,45,12,8,3)
  543. add(a,'brusheditor_button','Save As','Ok',10,50,35,13,SaveAs,a['Save As'].items.File1.params, a['name1'].items.bt )
  544. add(a,'brusheditor_button','Save As','Cancel',55,50,35,13,HideAll,a,'Save As')
  545. add(a,'brusheditor_text','Save As','Filename\nWithout ".ptb"',10,19)
  546. ------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement