nefthon

Untitled

Jan 21st, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.88 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////////////////////////
  2. //New .add dialog (SQLite version) version 1.0
  3. //The first you have to check is that you have this in your sphere.ini:
  4. //
  5. //[RESOURCELIST]
  6. // ITEMDEF
  7. // CHARDEF
  8. //
  9. //To install it type .f_add_setup
  10. //To see the dialog type .add
  11. //To 'reset' data, type .f_add_clear and then .f_add_setup again
  12. //
  13. //Note: As it is reading items/chars placed not even placed in the world, you may get some errors in console regarding to these items/chars and script issues related to them.
  14. ////////////////////////////////////////////////////////////////////////////////////////////
  15.  
  16.  
  17.  
  18. [DEFNAME adddef]
  19. //Search disabled ATM, not converted to SQLite
  20. adddialog_search=0 //Set this to 0 if you do not want the dialog to be able to search items.
  21.  
  22. [FUNCTION f_oncommand]
  23. if (STRMATCH("add","<args>")==1)
  24. dialogclose d_add
  25. dialog d_add
  26. add1
  27. return 1
  28. elseif (STRMATCH("add *","<args>")==1) //old .add i_whatever behaviour.
  29. return 0
  30. endif
  31.  
  32. [function add1]
  33. dialogclose d_add
  34. dialog d_add
  35.  
  36. [function f_add_setup]
  37. if !(<ldb.connected>)
  38. ldb.connect "adddialog.db"
  39. // serv.log Connecting to table adddialog
  40. endif
  41. ldb.EXECUTE DROP TABLE IF EXISTS 'items'
  42. ldb.EXECUTE DROP TABLE IF EXISTS 'chars'
  43. ref1=<uid>
  44. if (<ldb.connected>)
  45. ldb.execute CREATE TABLE 'items' ('id' TEXT PRIMARY KEY NOT NULL,'defname' TEXT, 'name' TEXT,'category' TEXT,'subsection' TEXT,'description' TEXT)
  46. ldb.execute CREATE TABLE 'chars' ('id' TEXT PRIMARY KEY NOT NULL,'defname' TEXT, 'name' TEXT)
  47. local.hour=<serv.rticks>
  48. LDB.EXECUTE BEGIN
  49. if !(<db.connected>)
  50. serv.log Error, DB (MySQL) must be connected to use the <db.escapedata > function.
  51. return 0
  52. endif
  53. for 0 100//<eval <serv.deflist.itemdef.count>-1>
  54. local.item=<serv.deflist.itemdef.<dlocal._for>>
  55. if (<local.item>) //All code placed here to avoid problems with serv.deflist.itemdef.1029 (in my case) wich leads to itemdef.0 and empty data
  56. local.name=<serv.itemdef.<local.item>.name>
  57. local.defname=<qval <isempty <serv.itemdef.<local.item>.defname>>?NULL:<serv.itemdef.<local.item>.defname>>
  58. if (<isempty <serv.itemdef.<local.item>.category>>)
  59. local.category=Uncategorized
  60. else
  61. // local.category=<serv.itemdef.<local.item>.category>
  62. local.category=<EscapeData <serv.itemdef.<local.item>.category>>
  63. endif
  64. // local.category=<qval <isempty <serv.itemdef.<local.item>.category>>?Uncategorized:<serv.itemdef.<local.item>.category>>
  65. local.subsection=<qval <isempty <serv.itemdef.<local.item>.subsection>>?Uncategorized:<serv.itemdef.<local.item>.subsection>>
  66. local.description=<qval <isempty <serv.itemdef.<local.item>.description>>?Undefined:<serv.itemdef.<local.item>.description>>
  67. serv.log ldb.QUERY INSERT INTO 'items' ('id','defname','name','category','subsection','description') VALUES ("<local.item>","<local.defname>","<local.name>","<local.category>","<local.subsection>","<local.description>")
  68. endif
  69. endfor
  70. for 0 <eval <serv.deflist.chardef.count>-1>
  71. local.char=<serv.deflist.chardef.<dlocal._for>>
  72. local.name=<serv.chardef.<local.char>.name>
  73. local.defname=<qval <isempty <serv.chardef.<local.item>.defname>>?NULL:<serv.chardef.<local.item>.defname>>
  74. local.category=<qval <isempty <serv.chardef.<local.item>.category>>?Uncategorized:<serv.chardef.<local.item>.category>>
  75. local.subsection=<qval <isempty <serv.chardef.<local.item>.subsection>>?Uncategorized:<serv.chardef.<local.item>.subsection>>
  76. local.description=<qval <isempty <serv.chardef.<local.item>.description>>?Uncategorized:<serv.chardef.<local.item>.description>>
  77. endfor
  78. LDB.EXECUTE COMMIT
  79. serv.log Output done in <eval <serv.rticks>-<local.hour>> seconds.
  80. endfor
  81. ldb.close
  82.  
  83.  
  84. [function f_add_clear]
  85. ldb.EXECUTE DROP TABLE IF EXISTS 'items'
  86. ldb.EXECUTE DROP TABLE IF EXISTS 'chars'
  87.  
  88. [function f_add_search]
  89. local.items=itemdef
  90. local.chars=chardef
  91. local.list=<local.<ctag.adddialog_mode>>
  92. if (<isnum <args>>)
  93. local.id=<argn>
  94. args=<ctag.adddialog_search>
  95. local.obj=<argv[<dlocal.id>]>
  96. if <local.obj>
  97. ctag.adddialog_search_id=<local.id>
  98. local.cat=<serv.list.<ctag.adddialog_mode>.findelem "<serv.<local.list>.<local.obj>.category>">
  99. ctag.adddialog_page=<eval <local.cat>/14>
  100. ctag.adddialog_cat=<local.cat>
  101. local.sub=<serv.list.<ctag.adddialog_mode>_<dlocal.cat>.findelem "<serv.<local.list>.<local.obj>.subsection>">
  102. ctag.adddialog_cat_page=<eval <local.sub>/14>
  103. ctag.adddialog_sub=<local.sub>
  104. local.desc=<serv.list.<ctag.adddialog_mode>_<dlocal.cat>_<dlocal.sub>.findelem <local.obj>>
  105. ctag.adddialog_sub_page=<eval <local.desc>/14>
  106. ctag.adddialog_show=<local.desc>
  107. if (<ctag.adddialog_page>==0)
  108. ctag.adddialog_page
  109. endif
  110. if (<ctag.adddialog_cat_page>==0)
  111. ctag.adddialog_cat_page
  112. endif
  113. if (<ctag.adddialog_sub_page>==0)
  114. ctag.adddialog_sub_page
  115. endif
  116. dialogclose d_Add
  117. dialog d_add
  118. endif
  119. else
  120. local.string=<args>
  121. local.ret=0
  122. local.count=0
  123. for 0 <eval <deflist.<local.list>.count>-1>
  124. local.item=<deflist.<local.list>.<dlocal._for>>
  125. // serv.log <local.item> (<serv.<local.list>.<local.item>.name>) == STRMATCH("<serv.<local.list>.<local.item>.name>","<local.string>")
  126. if (STRMATCH("<serv.<local.list>.<local.item>.name>","<local.string>")==1)
  127. local.ret=<local.ret>,<local.item>
  128. local.count ++
  129. endif
  130. endfor
  131. if (<local.count>>0)
  132. ctag.adddialog_search=<streat <local.ret>>
  133. f_add_search 0
  134. endif
  135. dialogclose d_Add
  136. dialog d_add
  137. endif
  138.  
  139. [function f_add_generate_main]
  140. //Img
  141. resizepic 0 0 9200 230 137 // background border
  142. gumppictiled 10 10 210 117 2624 // darker background
  143. checkertrans 10 10 210 117 // transparency layer
  144. //Modes
  145. dtext 90 30 0480 Items
  146. LDB.Query "SELECT id from items WHERE ROWID = 1"
  147. button 50 30 4005 4007 <qval <LDB.Row.NumRows>?1:0> 0 1 //No references in list? no click on buttons
  148.  
  149. dtext 90 90 0480 Npcs
  150. LDB.Query "SELECT id from chars WHERE ROWID = 1"
  151. button 50 90 4005 4007 <qval <LDB.Row.NumRows>?1:0> 0 2
  152.  
  153. [function f_add_generate_background]
  154. //img
  155. if !(<isempty <ctag.add_show>>)
  156. resizepic 0 0 9200 800 587 // background border
  157. gumppictiled 10 10 780 567 2624 // darker background
  158. gumppictiled 10 32 780 5 5058 // 1 grey separators - start here
  159. gumppictiled 230 37 5 400 5058 // 1
  160. gumppictiled 510 37 5 400 5058 // 2
  161. gumppictiled 10 32 510 5 5058 // 4
  162. gumppictiled 10 432 780 5 5058 // 5
  163. gumppictiled 120 432 5 150 5058 // 5
  164. checkertrans 10 10 780 567 // transparency layer
  165. elseif !(<isempty <ctag.add_sub>>) //Dynamic gump, more info = more gump, no modules, no different dialogs for the same.
  166. resizepic 0 0 9200 800 437 // background border
  167. gumppictiled 10 10 780 417 2624 // darker background
  168. gumppictiled 10 32 780 5 5058 // 1 grey separators - start here
  169. gumppictiled 230 37 5 400 5058 // 1
  170. gumppictiled 510 37 5 400 5058 // 2
  171. gumppictiled 10 32 510 5 5058 // 4
  172. checkertrans 10 10 780 417 // transparency layer
  173. elseif !(<isempty <ctag.add_cat>>)
  174. resizepic 0 0 9200 530 437 // background/border
  175. gumppictiled 10 10 510 417 2624 // darker background
  176. gumppictiled 10 32 510 5 5058 // 1 grey separators - start here
  177. gumppictiled 230 37 5 400 5058 // 2
  178. checkertrans 10 10 510 417 // transparency layer
  179. else
  180. resizepic 0 0 9200 250 437 // background/border
  181. gumppictiled 10 10 230 417 2624 // darker background
  182. gumppictiled 10 32 230 5 5058 // 1 grey separators - start here
  183. checkertrans 10 10 230 417 // transparency layer
  184. endif
  185.  
  186. [function f_Add_generate_topbar]
  187. dtext 40 10 0480 <ctag.add_mode>
  188. button 10 10 4014 4045 1 0 3 //Change between items/npcs
  189. if (<def.adddialog_search>==1)
  190. dtext 170 10 0480 Search
  191. button 140 10 4011 4012 1 0 10 //Change between items/npcs
  192. endif
  193. if !(<isempty <ctag.add_search>>)
  194. local.max=<eval <f_argv <ctag.add_search>>-1>
  195. if (<ctag.add_search_id><<local.max>)
  196. dtext 480 10 0480 Search Next
  197. button 555 10 4005 4007 1 0 11
  198. endif
  199. if (<ctag.add_search_id>>0)
  200. dtext 350 10 0480 Search Previous
  201. button 310 10 4014 4045 1 0 12
  202. endif
  203. endif
  204.  
  205. [function f_add_generate_categories]
  206. LDB.Query "SELECT category FROM <ctag.add_mode> GROUP BY category"
  207. local.cat=<LDB.Row.<dctag.add_cat>.category>
  208. local.cx=41 //Category X
  209. local.cy=70 //Category Y
  210. local.header=<local.cat>
  211. if (<eval STRLEN(<local.header>)>>25)
  212. local.header=<strsub 0 25 <local.header>>
  213. endif
  214. dtext 10 45 0480 <qval <isempty <ctag.add_cat>>==0?<local.cat> (<eval <ctag0.add_cat>+1>/<dLDB.Row.Numrows>):>
  215. local.index=<eval 14*<ctag0.add_page>>//We get FOR data from items_per_page*page_number
  216. for 0 13
  217. local.num=<local.index>+<local._for>
  218. if !(<isempty <LDB.ROW.<dlocal.num>.category>>)
  219. local.text=<ldb.row.<dlocal.num>.category>
  220. if (<eval STRLEN(<local.text>)>>28)
  221. local.text=<strsub 0 28 <local.text>>
  222. endif
  223. dtext <dlocal.cx> <dlocal.cy> 0480 <local.text>
  224. button <eval <local.cx>-30> <dlocal.cy> 4005 4007 1 0 <eval 100+<dlocal._for>>
  225. local.cy +=23
  226. endif
  227. endfor
  228. if <LDB.Row.Numrows> //I check this alone first to avoid console errors
  229. IF (<LDB.Row.Numrows> > <eval <local.index>+13>)
  230. button 200 400 4005 4007 1 0 4
  231. dtext 130 400 0480 Next Page
  232. endif
  233. endif
  234. if (<ctag0.add_page>> 0)
  235. button 10 400 4014 4045 1 0 5
  236. dtext 40 400 0480 Previous Page
  237. endif
  238.  
  239.  
  240. [function f_add_generate_subsections]
  241. IF !(<isempty <ctag.add_cat>>)
  242. local.sx=266 //Subsection X
  243. local.sy=70 //Subsection Y
  244. // LDB.Query "SELECT category FROM <ctag.add_mode> GROUP BY category"
  245. local.cat=<LDB.Row.<dctag.add_cat>.category>
  246. LDB.query "SELECT subsection FROM <ctag.add_mode> WHERE category = '<local.cat>' GROUP BY subsection"
  247. local.header=<LDB.Row.<dctag.add_sub>.subsection>
  248. dtext 236 45 0480 <qval <isempty <ctag.add_sub>>==0?<local.header> (<eval <ctag0.add_sub>+1>/<dLDB.Row.NumRows>):>
  249. local.index=<eval 14*<ctag.add_cat_page>>
  250. for 0 13
  251. local.num=<local.index>+<local._for>
  252. if !(<isempty <LDB.ROW.<dlocal.num>.subsection>>)
  253. local.text=<ldb.row.<dlocal.num>.subsection>
  254. if (<eval STRLEN(<local.text>)>>38)
  255. local.text=<strsub 0 38 <local.text>>
  256. endif
  257. dtext <dlocal.sx> <dlocal.sy> 0480 <local.text>
  258. button <eval <dlocal.sx>-30> <dlocal.sy> 4005 4007 1 0 <eval 200+<dlocal._for>> //boton aceptar
  259. local.sy +=23
  260. endif
  261. endfor
  262. if <LDB.Row.Numrows>
  263. IF (<LDB.Row.Numrows> > <eval <local.index>+13>)
  264. button 480 400 4005 4007 1 0 6
  265. dtext 410 400 0480 Next Page
  266. endif
  267. endif
  268. if (<ctag0.add_cat_page>> 0)
  269. button 236 400 4014 4045 1 0 7
  270. dtext 271 400 0480 Previous Page
  271. endif
  272. endif
  273.  
  274. [function f_Add_generate_descriptions]
  275. IF !(<isempty <ctag.add_sub>>)
  276. local.dx=546 //Subsection X
  277. local.dy=70 //Subsection Y
  278. if (<ctag0.add_sub_page>)
  279. local.index=<eval 14*<ctag.add_sub_page>>
  280. else
  281. local.index=0
  282. endif
  283. // LDB.Query "SELECT category FROM <ctag.add_mode> GROUP BY category"
  284. // local.cat=<LDB.Row.<dctag.add_cat>.category>
  285. // LDB.query "SELECT subsection FROM <ctag.add_mode> WHERE category = '<local.cat>' GROUP BY subsection"
  286. local.sub=<LDB.Row.<dctag.add_sub>.subsection>
  287. LDB.query "SELECT id,description FROM <ctag.add_mode> WHERE subsection = '<local.sub>' GROUP BY description"
  288. dtext 516 45 0480 Page (<eval <ctag0.add_sub_page>+1>/<eval (<ldb.row.numrows>/14)+1>)
  289. for 0 13
  290. local.num=<local.index>+<local._for>
  291. local.id=<LDB.row.<dlocal.num>.id>
  292. IF (STRMATCH("items","<ctag.add_mode>")==1)
  293. local.pic <serv.itemdef.<local.id>.id>
  294. else
  295. local.pic <serv.itemdef.<serv.chardef.<local.id>.icon>.id>
  296. local.char=1
  297. endif
  298. local.desc=<ldb.row.<dlocal.num>.description>
  299. if (<dlocal.num>< <ldb.row.numrows>)
  300. dtext <dlocal.dx> <dlocal.dy> 0480 <local.desc>
  301. button 760 <dlocal.dy> 4005 4007 1 0 <eval 1000+<dlocal._for>>
  302. button 516 <dlocal.dy> 4011 4012 1 0 <eval 1100+<dlocal._for>>
  303. local.dy +=23
  304. endif
  305. endfor
  306. if (<ldb.row.numrows>)
  307. IF (<ldb.row.numrows> > <eval <local.index>+14>)
  308. button 760 400 4005 4007 1 0 8
  309. dtext 690 400 0480 Next Page
  310. endif
  311. endif
  312. if !(<isempty <ctag.add_sub_page>>)
  313. button 515 400 4014 4045 1 0 9
  314. dtext 550 400 0480 Previous page
  315. endif
  316. endif
  317.  
  318. [function f_add_generate_views]
  319. IF !(<isempty <ctag.add_show>>)
  320. if (<ctag0.add_sub_page>)
  321. local.index=<eval 14*<ctag.add_sub_page>>
  322. else
  323. local.index=0
  324. endif
  325. local.id=<ldb.row.<dctag.add_show>.id>
  326. if (STRMATCH("<ctag.add_mode>","items")==1)
  327. dtext 126 440 0480 ID: <local.id> <qval <serv.itemdef.<local.id>.defname>?(<serv.itemdef.<local.id>.defname>):>
  328. dtext 126 460 0480 Name: <serv.itemdef.<local.id>.name>
  329. dtext 126 480 0480 Type: <serv.itemdef.<local.id>.type>
  330. if !(<isempty <serv.itemdef.<local.id>.tevents>>)
  331. dtext 126 500 0480 Tevents: <serv.itemdef.<local.id>.tevents>
  332. endif
  333. local.y=440
  334. if !(<isempty <serv.itemdef.<local.id>.skillmake>>)
  335. dtext 366 <dlocal.y> 0480 Skillmake: <serv.itemdef.<local.id>.skillmake>
  336. local.y +=20
  337. endif
  338. if !(<isempty <serv.itemdef.<local.id>.resources>>)
  339. dtext 366 <dlocal.y> 0480 Resources: <serv.itemdef.<local.id>.resources>
  340. local.y +=20
  341. endif
  342. if (<serv.itemdef.<local.id>.tag0.GargoyleOnly>==1)
  343. dtext 366 <dlocal.y> 0480 Gargoyle Item
  344. local.y +=20
  345. endif
  346. tilepic 30 440 <serv.itemdef.<local.id>.id>
  347. button 126 554 4005 4007 1 0 <eval 1000+<ctag.add_show>>
  348. dtext 156 554 0480 Create
  349. else
  350. dtext 126 440 0480 ID: <local.id>
  351. dtext 126 460 0480 Name: <serv.chardef.<local.id>.name>
  352. dtext 126 480 0480 //Tevents: <serv.chardef.<local.id>.tevents>
  353. dtext 126 500 0480
  354. local.y=440
  355. tilepic 30 440 <serv.chardef.<local.id>.icon>
  356. button 126 554 4005 4007 1 0 <eval 1000+<ctag.add_show>>
  357. dtext 156 554 0480 Create
  358. dtext 626 440 0480 Create spawn
  359. dtext 600 460 0480 Amount
  360. dtextentry 680 460 20 20 33 1 1
  361. dtext 600 480 0480 Min Time
  362. dtextentry 680 480 20 20 33 2 5
  363. dtext 600 500 0480 Max Time
  364. dtextentry 680 500 20 20 33 3 15
  365. dtext 600 520 0480 Max Distance
  366. dtextentry 680 520 20 20 33 4 15
  367. button 600 554 4005 4007 1 0 <eval 1200+<ctag.add_show>>
  368. dtext 630 554 0480 Create Spawn
  369. endif
  370. endif
  371.  
  372. [dialog d_add]
  373. 6,32
  374. ldb.close
  375. ldb.connect adddialog.db
  376. IF (<isempty <ctag.add_mode>>)
  377. f_add_generate_main //Dialog shown when no item or npc view is selected yet.
  378. else
  379. f_add_generate_background //Dynamic background increasing/decreasing according to the amount of menus we are seeing.
  380. f_add_generate_topbar //Displaying top bar
  381. f_add_generate_categories //Filling categories menu (if selected items or npcs)
  382. f_add_generate_subsections //Filling subsections menu (if looking into any)
  383. f_add_generate_descriptions //Final list of items or npcs of the selected category+subsection
  384. f_add_generate_views //Showing detailed information about the selected item or npc
  385. endif
  386.  
  387. [DIALOG d_add BUTTON]
  388. ON=1
  389. ctag.add_mode=items
  390. dialog d_add
  391.  
  392. ON=2
  393. ctag.add_mode=chars
  394. dialog d_Add
  395.  
  396. ON=3
  397. ctag.add_show
  398. ctag.add_page
  399. ctag.add_mode
  400. ctag.add_cat
  401. ctag.add_sub
  402. ctag.add_cat_page
  403. ctag.add_sub_page
  404. ctag.add_search
  405. ctag.add_search_id
  406. dialog d_add
  407.  
  408. ON=4
  409. ctag0.add_page +=1
  410. dialog d_add
  411. ON=5
  412. ctag0.add_page -=1
  413. dialog d_add
  414.  
  415. ON=6
  416. ctag0.add_cat_page +=1
  417. dialog d_add
  418. ON=7
  419. ctag0.add_cat_page -=1
  420. dialog d_add
  421.  
  422. ON=8
  423. ctag0.add_sub_page +=1
  424. dialog d_add
  425. ON=9
  426. ctag0.add_sub_page -=1
  427. dialog d_add
  428. ON=10
  429. sysmessage=Type the text to search.
  430. promptconsole f_add_search
  431.  
  432. ON=11
  433. f_add_search <eval <ctag.add_search_id>+1>
  434. ON=12
  435. f_add_search <eval <ctag.add_search_id>-1>
  436.  
  437. ON=100 115 //categories
  438. if (<ctag0.add_page>)
  439. local.index=<eval 14*<ctag.add_page>>
  440. else
  441. local.index=0
  442. endif
  443. local.num=<eval (<argn>-100)+<local.index>>
  444. ctag.add_cat=<local.num>
  445. ctag.add_cat_page
  446. ctag.add_sub
  447. ctag.add_sub_page
  448. ctag.add_show
  449. ctag.add_search
  450. ctag.add_search_id
  451. dialog d_Add
  452.  
  453. ON=200 215
  454. if (<ctag0.add_cat_page>)
  455. local.index=<eval 14*<ctag.add_cat_page>>
  456. else
  457. local.index=0
  458. endif
  459. local.num=<eval (<argn>-200)+<local.index>>
  460. ctag.add_sub=<local.num>
  461. ctag.add_sub_page
  462. ctag.add_show
  463. ctag.add_search
  464. ctag.add_search_id
  465. dialog d_Add
  466.  
  467. ON=1000 1015
  468. if (<ctag0.add_sub_page>)
  469. local.index=<eval 14*<ctag.add_sub_page>>
  470. else
  471. local.index=0
  472. endif
  473. local.listid=<ctag.add_mode>_<dctag.add_cat>_<dctag.add_sub>
  474. local.id=<serv.list.<local.listid>.<eval <local.index>+(<argn>-1000)>>
  475. if (STRMATCH("ITEMS","<ctag.add_mode>")==1)
  476. if (<serv.itemdef.<local.id>.id>)
  477. add <local.id>
  478. endif
  479. elseif (STRMATCH("chars","<ctag.add_mode>")==1)
  480. if (<serv.chardef.<local.id>>)
  481. addnpc <local.id>
  482. endif
  483. endif
  484.  
  485. ON=1100 1115
  486. if (<ctag0.add_sub_page>)
  487. local.index=<eval 14*<ctag.add_sub_page>>
  488. else
  489. local.index=0
  490. endif
  491. ctag.add_show=<eval <argn>-1100>
  492. dialog d_add
  493.  
  494. ON=1200 1215
  495. if (<ctag0.add_sub_page>)
  496. local.index=<eval 14*<ctag.add_sub_page>>
  497. else
  498. local.index=0
  499. endif
  500. local.listid=<ctag.add_mode>_<dctag.add_cat>_<dctag.add_sub>
  501. local.id=<serv.list.<local.listid>.<eval <local.index>+(<argn>-1200)>>
  502. targetfg f_createspawn <local.id>,<argtxt[1]>,<argtxt[2]>,<argtxt[3]>,<argtxt[4]>
  503. sysmessage=Where do you want to place the spawn?
  504.  
  505. [FUNCTION f_argv]
  506. RETURN <ARGV>
  507.  
  508. [function f_createspawn]
  509. serv.newitem=i_worldgem_bit
  510. new.more=<argv[0]>
  511. new.amount=<argv[1]>
  512. new.morep=<argv[2]>,<argv[3]>,<argv[4]>
  513. new.p=<p>
  514. new.p=<targp>
  515. new.dclick
  516.  
  517. [function EscapeData]
  518. local.text=<args>
  519. local.text=<asciireplace 40,[,<local.text>> //Replacing ( for [
  520. local.text=<asciireplace 41,],<local.text>> //Replacing ) for ]
  521. return <local.text>
  522.  
  523. [function asciireplace]
  524. local.ascii=<argv[0]>
  525. local.new=<argv[1]>
  526. local.text=<streat <streat <args>>>
  527. local.a=<strpos 0 <dlocal.ascii> <args>>
  528. while <local.a>>0
  529. local.len=<eval STRLEN(<local.text>)>
  530. local.pos=<strpos 0 <dlocal.ascii> <local.text>>
  531. if (<local.pos>==0)
  532. local.text=<local.new><strsub <eval <local.pos>+1> <local.len> <local.text>>
  533. else
  534. local.text=<strsub 0 <local.pos> <local.text>><local.new><strsub <eval <local.pos>+1> <local.len> <local.text>>
  535. endif
  536. if (<strpos 0 <dlocal.ascii> <local.text>>==-1)
  537. local.a=0
  538. endif
  539. endwhile
  540. return <local.text>
  541.  
  542. [EOF]
Advertisement
Add Comment
Please, Sign In to add comment