Advertisement
DavidJSGardner

Farjad's Alchemizer 5.03

Apr 13th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 48.69 KB | None | 0 0
  1. ;====================================================
  2. ; Script Name: Farjad's Alchemy Lab
  3. ; Author: Cyrus Tegyr
  4. ; Version: 5.0
  5. ; Client Tested with: 5.0.9.1
  6. ; Shard OSI / FS: Pangaea
  7. ; Purpose: To be a one stop shop for alchemists on Pangaea
  8. ; Thanks to: CEO from Easyuo for some superb subs
  9. ; Those who willingly jumped at the chance
  10. ; to test this out and for those patient enough
  11. ; to wait for my slow ass to fix things.
  12. ;
  13. ; ToDo
  14. ; Might need more food types, I have a good many
  15. ; but chiefly food types made by cooks is what I
  16. ; think it needs more of.
  17. ;
  18. ; New 5.02
  19. ; Added some troubleshooting messages to the grind
  20. ; Essence maker portion of the script to pinpoint
  21. ; a known issue. Feedback needed as soon as a
  22. ; disturbance occurs.
  23. ;
  24. ; New 5.01
  25. ; Fixed an issue where if you set your healto option
  26. ; to less than 0 or greater than 100 it wouldn't
  27. ; default to a proper percentage
  28. ;
  29. ; New 5.0
  30. ; Added a Settings Section:
  31. ; - On Death Sound
  32. ; - On Job Completion Sound
  33. ; - Auto Feed Option
  34. ; - Use Strength Potions
  35. ; - Death Sound Path
  36. ; - Job's Done Path
  37. ; - Heal until Percentage
  38. ; Added colored messages
  39. ; Auto Feeder Added
  40. ;
  41. ; New 4.0
  42. ; Reworked the normal Potion menu again!
  43. ; Added ToWait sub for better handled waits!
  44. ; Added a stop button for tile charging.
  45. ;====================================================
  46. ;Simple Item Setup
  47. Set %Essence DUF_IUF_EUF_LZF_PZF_QZF_DAG
  48. Set %Powderables OZF_UZF_HUF_XZF_VZF_VWL_YZF_EAG_TZF_GUF_NZF_FUF
  49. Set %NormRegs RZF_KUF_JZF_JUF_KZF_MZF_WZF_SZF
  50. Set %FoodTypes VQE_MQE_KPE_AXI_YWI_YBF_FWI_TWI_UWI_QQD_ZPE_
  51. +HND_NRD_RGG_QRD_ZBG_END_BND_ACG_JQE_CWE_
  52. +YRD_GND
  53. ;--Do Not Edit Beyond This Point Unless You Don't Mind Possibly Breaking Things
  54. set %_worldsavejournalindex #jindex
  55. set *CEOWorldSaving #false
  56.  
  57. FindItem RQF C_ , #BACKPACKID
  58. if #FindCNT < 1
  59. {
  60. GoSub SendSysMessage Warning Couldn't_find_your_Mortar_&_Pestle,_make_sure_it_is_in_your_main_backpack,_halting.
  61. ; halt
  62. }
  63. Set %Mortar #FINDID
  64.  
  65.  
  66. set %RecipeVerification #False
  67. call PotionRecipes.txt VerifyRecipeList
  68.  
  69. GoSub InitialAlchemyMenu
  70. GoSub ListenToTheButtons
  71. ;===================================================
  72. ; Subs Name: Grinder/Essence Subs
  73. ; Author: Callum O'Lyre
  74. ; Purpose: These Subs are for use on Pangaea for Manufacturing of powders and essences alike.
  75. ;====================================================
  76. Sub GrindHouse
  77. Set %RegType %1
  78.  
  79. Set %TimeToWait #SCNT
  80. if %RegType in %Essence
  81. {
  82. FindItem EHJ G_2
  83. if #FindCNT < 1
  84. {
  85. GoSub SendSysMessage Warning You_call_yourself_an_alchemist_with_no_Alembic?!
  86. GoSub GrinderMenu
  87. return
  88. }
  89. else
  90. {
  91. Set %ToolID #FindID
  92. set %GrindTimer 7
  93. Set %ReqAmt 3
  94. }
  95. }
  96. if %RegType in %Powderables
  97. {
  98. Set %ToolID %Mortar
  99. Set %GrindTimer 5
  100. Set %ReqAmt 2
  101. }
  102. if %RegType notin %Essence && %RegType notin %Powderables
  103. {
  104. GoSub SendSysMessage Warning This_is_neither_a_powderable_reagent_or_a_reagent_that_can_be_turned_into_an_essence!
  105. GoSub GrinderMenu
  106. Return
  107. }
  108.  
  109. if %RegType <> VWL
  110. {
  111. FindItem %RegType
  112. set %RegID #FindID
  113. Repeat
  114. {
  115. if %AutoFeed <> #False && %FoodTimer < #SCNT || %FoodTimer = N/A
  116. {
  117. GoSub EatFood
  118. }
  119.  
  120. While #SCNT < %TimeToWait
  121. {
  122. if #menubutton <> N/A
  123. {
  124. GoSub SendSysMessage Warning You_seem_to_have_clicked_the_stop_button!
  125. return
  126. }
  127.  
  128. GoSub ToWait SCNT2 2
  129. }
  130.  
  131. Set #LOBJECTID %ToolID
  132. Event Macro 17 0
  133. Set #LTARGETID %RegID
  134. Target 5s
  135. Event Macro 22 0
  136. Set %TimeToWait #SCNT + %GrindTimer
  137.  
  138. FindItem %RegID
  139. }
  140. Until #FINDSTACK < %ReqAmt
  141. GoSub SendSysMessage Warning You_seem_to_have_run_out_of_reagents_to_grind_or_essence!
  142. GoSub PlaySound %JobSound %JobPath
  143. GoSub GrinderMenu
  144. }
  145. else
  146. {
  147. FindItem %RegType
  148. For #FindIndex 1 #FindCNT
  149. {
  150. if %AutoFeed <> #False && %FoodTimer < #SCNT || %FoodTimer = N/A
  151. {
  152. GoSub EatFood
  153. }
  154.  
  155. While #SCNT < %TimeToWait
  156. {
  157. GoSub ToWait SCNT2 2
  158.  
  159. if #menubutton <> N/A
  160. {
  161. GoSub SendSysMessage Warning You_seem_to_have_clicked_the_stop_button!
  162. return
  163. }
  164. }
  165.  
  166. Set #LOBJECTID %ToolID
  167. Event Macro 17 0
  168. Set #LTARGETID #FINDID
  169. Target 5s
  170. Event Macro 22 0
  171. Set %TimeToWait #SCNT + %GrindTimer
  172. }
  173. GoSub SendSysMessage Warning You_seem_to_have_run_out_of_foci_to_grind!
  174. GoSub PlaySound %JobSound %JobPath
  175. GoSub GrinderMenu
  176. }
  177. Return
  178.  
  179. ;===================================================
  180. ; Subs Name: Normal Potion Making Subs
  181. ; Author: Callum O'Lyre
  182. ; Purpose: These Subs are for use on Pangaea when macroing up some normal potion types
  183. ;====================================================
  184. ;GoSub BeginNormalPotionMakingProcess %ReagentToGrindType %ReagentToGrindID %PotionIndex
  185. Sub BeginNormalPotionMakingProcess
  186. Set %RTGT %1
  187. Set %RTGID %2
  188. Set %PotionIndex %3
  189.  
  190. GoSub DetermineReagentCounts %RTGT %PotionIndex
  191. While #True
  192. {
  193. if #menubutton = StopNormPotions
  194. {
  195. return
  196. }
  197. FindItem %RTGID
  198. if #FindStack < %RN
  199. {
  200. GoSub SendSysMessage Warning You_Have_Run_Out_of_Reagents!
  201. GoSub PlaySound %JobSound %JobPath
  202. GoSub NormalPotionMakingMenu
  203. Return
  204. }
  205. if %HealTime <> N/A && %HealTime > #SCNT && %StrTimer < #SCNT || %StrTimer = N/A
  206. {
  207. While %HealTime > #SCNT
  208. {
  209. GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30
  210. }
  211. }
  212. if %HealTime < #SCNT || %HealTime = N/A && %StrPot = #True
  213. {
  214. GoSub RefreshStrengthPotion
  215. }
  216. if %AutoFeed <> #False && %FoodTimer < #SCNT || %FoodTimer = N/A
  217. {
  218. GoSub EatFood
  219. }
  220. UseMP:
  221. set #LOBJECTID %Mortar
  222. Event Macro 17 0
  223. Set %CursTimer #SCNT + 5
  224. While #TArgCurs <> 1
  225. {
  226. GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30
  227. If %CursTimer < #SCNT
  228. {
  229. GoTo UseMP
  230. }
  231. }
  232.  
  233. set #LTARGETID %RTGID
  234. Event Macro 22 0
  235.  
  236. Set %GumpTimer #SCNT + 5
  237. While #contName <> objpicker_gump
  238. {
  239. if %GumpTimer < #SCNT
  240. {
  241. goto UseMP
  242. }
  243. GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30
  244. }
  245.  
  246. Click %P_X %P_Y dmc d f
  247.  
  248. Set %GumpTimer #SCNT + 5
  249. While #contName <> Stringquery_gump
  250. {
  251. if %GumpTimer < #SCNT
  252. {
  253. goto UseMP
  254. }
  255. GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30
  256. }
  257.  
  258. Click 200 244 dmc d f
  259. msg 30 $
  260.  
  261. set !lpc #lpc
  262. set #lpc 500
  263. set %pjrnl #jindex
  264. set %break #false
  265. While %break <> #true
  266. {
  267. If #menubutton <> N/A
  268. {
  269. set #lpc !lpc
  270. set %break #true
  271. }
  272. if #jindex > %pjrnl
  273. {
  274. set %pjrnl %pjrnl + 1
  275. scanjournal %pjrnl
  276. if with_no_bottles,_you_are_forced_to_store in #journal
  277. {
  278. set #lpc !lpc
  279. set %break #true
  280. GoSub PlaySound %JobSound %JobPath
  281. set #menubutton StopNormPotions
  282. }
  283. if You_stop_grinding_reagents in #journal
  284. {
  285. set #lpc !lpc
  286. set %break #true
  287. }
  288. if The_mixture_sends_out_a_shocking_gas in #journal
  289. {
  290. gosub CheckUp
  291. set #lpc !lpc
  292. set %break #true
  293. }
  294. if The_mixture_explodes in #journal
  295. {
  296. gosub CheckUp
  297. set #lpc !lpc
  298. set %break #true
  299. }
  300. if #menubutton = StopNormPotions
  301. {
  302. set #lpc !lpc
  303. set %break #true
  304. }
  305. if #Hits < #MaxHits || C in #CharStatus
  306. {
  307. gosub CheckUp
  308. }
  309. }
  310. if #Hits < #MaxHits || C in #CharStatus
  311. {
  312. gosub CheckUp
  313. }
  314. }
  315. }
  316. return
  317.  
  318. Sub DeterminePotionTypes
  319. set !lpc #lpc
  320. set #lpc 30
  321. if %1 = RZF
  322. {
  323. GoSub AddPotionButtons NightSight , #spc , Potion Lesser , #spc , Wisdom , #spc , Potion Normal , #spc , Wisdom , #spc , potion Greater , #spc , Wisdom , #spc , Potion
  324. menu Set RegCost1 3
  325. menu Set RegCost2 1
  326. menu Set RegCost3 3
  327. menu Set RegCost4 7
  328. }
  329. if %1 = KUF
  330. {
  331. GoSub AddPotionButtons Refresh , #spc , Potion Full , #spc , Refresh , #spc , Potion
  332. menu Set RegCost1 1
  333. menu Set RegCost2 9
  334. }
  335. if %1 = JZF
  336. {
  337. GoSub AddPotionButtons Lesser , #spc , Heal , #spc , Potion Normal , #spc , Heal , #spc , Potion Greater , #spc , Heal , #spc , Potion
  338. menu Set RegCost1 1
  339. menu Set RegCost2 4
  340. menu Set RegCost3 9
  341. }
  342. if %1 = JUF
  343. {
  344. GoSub AddPotionButtons Lesser , #spc , Agility , #spc , Potion Normal , #spc , Agility , #spc , Potion Greater , #spc , Agility , #spc , Potion
  345. menu Set RegCost1 1
  346. menu Set RegCost2 3
  347. menu Set RegCost3 9
  348. }
  349. if %1 = KZF
  350. {
  351. GoSub AddPotionButtons Lesser , #spc , Cure , #spc , Potion Normal , #spc , Cure , #spc , Potion Greater , #spc , Cure , #spc , Potion
  352. menu Set RegCost1 1
  353. menu Set RegCost2 4
  354. menu Set RegCost3 9
  355. }
  356. if %1 = MZF
  357. {
  358. GoSub AddPotionButtons Lesser , #spc , Strength , #spc , Potion Normal , #spc , Strength , #spc , Potion Greater , #spc , Strength , #spc , Potion
  359. menu Set RegCost1 1
  360. menu Set RegCost2 3
  361. menu Set RegCost3 7
  362. }
  363. if %1 = WZF
  364. {
  365. GoSub AddPotionButtons Lesser , #spc , Poison , #spc , Potion Normal , #spc , Poison , #spc , Potion Greater , #spc , Poison , #spc , Potion
  366. menu Set RegCost1 1
  367. menu Set RegCost2 4
  368. menu Set RegCost3 12
  369. }
  370. if %1 = SZF
  371. {
  372. GoSub AddPotionButtons Lesser , #spc , Explosion , #spc , potion Normal , #spc , Explosion , #spc , Potion Greater , #spc , Explosion , #spc , Potion
  373. menu Set RegCost1 3
  374. menu Set RegCost2 6
  375. menu Set RegCost3 20
  376. }
  377. GoSub PotionCount %1
  378. return
  379.  
  380. Sub AddPotionButtons
  381. if %0 = 3
  382. Set %llength 81
  383. if %0 = 4
  384. Set %llength 103
  385. Set !lpc #lpc
  386. Set #lpc 30
  387. menu Clear
  388. menu Font Color Yellow
  389. menu Window Title Normal Potion
  390. menu Font BGColor Yellow
  391. menu Font BGColor Black
  392. menu Window Color Black
  393. menu Button NormRegSelection 40 10 20 20 _
  394. menu Button BackButton 5 5 20 30 <
  395. menu Window Size 213 190
  396. menu Font Transparent #true
  397. menu Font Name MS Sans Serif
  398. menu Font Size 8
  399. menu Font Style
  400. menu Font Align Center
  401. menu Window Transparent 80
  402. menu Text NormReagentText 65 13 %name
  403. for %AB 1 %0
  404. {
  405. set %LMulti %AB - 1
  406. set %LineY 65 + ( 23 * ( %LMulti % 10 ) )
  407. menu button NP . %AB 5 %LineY 19 20 *
  408. menu Shape Line 5 %LineY 203 20 3 7 1 $111111 7 $111111
  409. Set %TextLine %LineY + 3
  410. menu Text PotName . %AB 28 %TextLine % . %AB
  411. menu Text RegCost . %AB 175 %TextLine #spc
  412. }
  413. menu Text RegCostHeader 28 50 Potion Name
  414. menu Text RegCostHeader 155 50 Reg Req.
  415. menu Shape Line 150 50 2 %llength 3 7 1 yellow 7 yellow
  416. ;menu Text PotionCntHeader 208 50 Potion Cnt.
  417. menu Shape Line 203 50 2 %llength 3 7 1 yellow 7 yellow
  418. Set #LPC !LPC
  419. return
  420.  
  421. Sub DetermineReagentCounts
  422. set !lpc #lpc
  423. set #lpc 30
  424. if %1 = RZF
  425. {
  426. if %2 = 1
  427. {
  428. Set %RN 3
  429. }
  430. if %2 = 2
  431. {
  432. Set %RN 1
  433. }
  434. if %2 = 3
  435. {
  436. Set %RN 3
  437. }
  438. if %2 = 4
  439. {
  440. Set %RN 7
  441. }
  442. }
  443. if %1 = KUF
  444. {
  445. if %2 = 1
  446. {
  447. Set %RN 1
  448. }
  449. if %2 = 2
  450. {
  451. Set %RN 9
  452. }
  453. }
  454. if %1 = JZF
  455. {
  456. if %2 = 1
  457. {
  458. Set %RN 1
  459. }
  460. if %2 = 2
  461. {
  462. Set %RN 4
  463. }
  464. if %2 = 3
  465. {
  466. Set %RN 9
  467. }
  468. }
  469. if %1 = JUF
  470. {
  471. if %2 = 1
  472. {
  473. Set %RN 1
  474. }
  475. if %2 = 2
  476. {
  477. Set %RN 3
  478. }
  479. if %2 = 3
  480. {
  481. Set %RN 9
  482. }
  483. }
  484. if %1 = KZF
  485. {
  486. if %2 = 1
  487. {
  488. Set %RN 1
  489. }
  490. if %2 = 2
  491. {
  492. Set %RN 4
  493. }
  494. if %2 = 3
  495. {
  496. Set %RN 9
  497. }
  498. }
  499. if %1 = MZF
  500. {
  501. if %2 = 1
  502. {
  503. Set %RN 1
  504. }
  505. if %2 = 2
  506. {
  507. Set %RN 3
  508. }
  509. if %2 = 3
  510. {
  511. Set %RN 7
  512. }
  513. }
  514. if %1 = WZF
  515. {
  516. if %2 = 1
  517. {
  518. Set %RN 1
  519. }
  520. if %2 = 2
  521. {
  522. Set %RN 4
  523. }
  524. if %2 = 3
  525. {
  526. Set %RN 12
  527. }
  528. }
  529. if %1 = SZF
  530. {
  531. if %2 = 1
  532. {
  533. Set %RN 3
  534. }
  535. if %2 = 2
  536. {
  537. Set %RN 6
  538. }
  539. if %2 = 3
  540. {
  541. Set %RN 20
  542. }
  543. }
  544. set %Potion %2 - 1
  545. set %P_X 55 + ( 49 * ( %Potion % 4 ) )
  546. set %P_Y 65
  547. set #lpc !lpc
  548. return
  549.  
  550. ;===================================================
  551. ; Subs Name: Special Potion Making Subs
  552. ; Author: Callum O'Lyre
  553. ; Purpose: These Subs are for use on Pangaea when macroing up some special potion types
  554. ;====================================================
  555. sub ReagentSelection
  556. {
  557. Set %VarName %1
  558. GoSub SendSysMessage Normal Select_your_reagent_type
  559. set #targcurs 1
  560.  
  561. while #targcurs = 1
  562. wait 1
  563.  
  564. set % . %VarName #LTARGETID
  565. return
  566. }
  567.  
  568. sub BeginAlchemization
  569. While #True
  570. {
  571. if %HealTime <> N/A && %HealTime > #SCNT && %StrTimer < #SCNT || %StrTimer = N/A
  572. {
  573. While %HealTime > #SCNT
  574. {
  575. GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30
  576. }
  577. }
  578. if %HealTime < #SCNT || %HealTime = N/A && %StrPot = #True
  579. {
  580. GoSub RefreshStrengthPotion
  581. }
  582. if %AutoFeed <> #False && %FoodTimer < #SCNT || %FoodTimer = N/A
  583. {
  584. GoSub EatFood
  585. }
  586. gosub CycleThroughReagents
  587. GoSub ToWait SCNT2 1
  588. gosub CheckUp
  589. GoSub ToWait SCNT2 1
  590. if #menubutton = stop
  591. {
  592. GoSub ListenToTheButtons
  593. }
  594. }
  595.  
  596. sub CycleThroughReagents
  597. FindItem WUF C
  598. For #FindIndex 1 #FindCNT
  599. {
  600. if #FindCol = 0
  601. {
  602. Set %EmptyBottles #FindID
  603. }
  604. }
  605.  
  606. If %EmptyBottles = N/A
  607. {
  608. GoSub SendSysMessage Warning You_Have_No_Empty_Bottles_in_Your_Pack!
  609. GoSub PlaySound %JobSound %JobPath
  610. set #menubutton stop
  611. GoSub ListenToTheButtons
  612. }
  613.  
  614. for %ReagCounter 1 10
  615. {
  616. if %ReagentType . %ReagCounter <> N/A
  617. {
  618. finditem %ReagentType . %ReagCounter
  619. if #FINDCNT = 0
  620. {
  621. GoSub SendSysMessage Warning You_are_out_of_the_number_ , %ReagCounter , _ingredient.
  622. GoSub PlaySound %JobSound %JobPath
  623. set #menubutton stop
  624. GoSub ListenToTheButtons
  625. }
  626. }
  627. }
  628.  
  629. GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30
  630.  
  631. Set #LOBJECTID %EmptyBottles
  632. Event Macro 17 0
  633. for %Counter 1 10
  634. {
  635. if %ReagentType . %Counter <> N/A
  636. {
  637. gosub CheckReagentTargetCursor
  638. set #ltargetid %ReagentType . %Counter
  639. event macro 22 0
  640. }
  641. else
  642. {
  643. gosub CheckReagentTargetCursor
  644. key ESC
  645. return
  646. }
  647. }
  648.  
  649. sub CheckReagentTargetCursor
  650.  
  651. while #targcurs <> 1
  652. {
  653. GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30
  654. }
  655.  
  656. return
  657.  
  658. ;===================================================
  659. ; Subs Name: Tile Charging Subs
  660. ; Author: Callum O'Lyre
  661. ; Purpose: These Subs are for use on Pangaea for charging Alchemical Symbols which are
  662. ; then used by scribes to make wands
  663. ;====================================================
  664. Sub TileTypeSetup
  665. if %1 = 0
  666. {
  667. GoSub SendSysMessage Warning You_need_to_select_a_wand_type_before_continuing..
  668. GoSub ShowTileChargerMenu
  669. GoSub ListenToTheButtons
  670. }
  671. if %1 = 1
  672. {
  673. ;Blessing
  674. set %TileType JGJ
  675. set %GemType OVF
  676. }
  677. if %1 = 2
  678. {
  679. ;Daemons
  680. set %TileType ZFJ
  681. set %GemType HVF
  682. }
  683. if %1 = 3
  684. {
  685. ;Firewall
  686. set %TileType UGJ
  687. set %GemType GVF
  688. }
  689. if %1 = 4
  690. {
  691. ;Healing
  692. set %TileType OGJ
  693. set %GemType RVF
  694. }
  695. if %1 = 5
  696. {
  697. ;Hellfire
  698. set %TileType BGJ
  699. set %GemType MWF
  700. }
  701. if %1 = 6
  702. {
  703. ;Life
  704. set %TileType KGJ
  705. set %GemType GVF
  706. }
  707. if %1 = 7
  708. {
  709. ;Lightning
  710. set %TileType CGJ
  711. set %GemType FVF
  712. }
  713. if %1 = 8
  714. {
  715. ;Magic Resist
  716. set %TileType HGJ
  717. set %GemType FVF
  718. }
  719. if %1 = 9
  720. {
  721. ;Meteor
  722. set %TileType LGJ
  723. set %GemType NNN
  724. }
  725. if %1 = 10
  726. {
  727. ;Protection
  728. set %TileType NGJ
  729. set %GemType BVF
  730. }
  731. if %1 = 11
  732. {
  733. ;Venom
  734. set %TileType IGJ
  735. set %GemType EVF
  736. }
  737. return
  738.  
  739. ;GoSub ChargeTile %TileType %GemType
  740. Sub ChargeTile
  741. Set %TileType %1
  742. Set %GemType %2
  743.  
  744. while #True
  745. {
  746. if %AutoFeed <> #False && %FoodTimer < #SCNT || %FoodTimer = N/A
  747. {
  748. GoSub EatFood
  749. }
  750. GoSub ToWait SCNT2 3
  751. GoSub TargetTile
  752. GoSub ToWait SCNT2 3
  753. GoSub TargetGem
  754. GoSub ToWait SCNT2 3
  755. if #menubutton = StopTileCharging
  756. {
  757. return
  758. }
  759. }
  760. Return
  761.  
  762. Sub TargetGem
  763. FindItem %GemType C
  764. if #FindCNT > 0
  765. {
  766. Set #LTARGETID #FINDID
  767. GoSub CheckReagentTargetCursor
  768. Event Macro 22 0
  769. }
  770. else
  771. {
  772. GoSub SendSysMessage Warning You_are_out_of_gems.
  773. GoSub PlaySound %JobSound %JobPath
  774. GoSub ShowTileChargerMenu
  775. Set #menubutton N/A
  776. GoSub ListenToTheButtons
  777. }
  778. return
  779.  
  780. Sub TargetTile
  781. FindItem %TileType C
  782. if #FindCNT > 0
  783. {
  784. Set #LOBJECTID %Mortar
  785. Event Macro 17 0
  786. Set #LTARGETID #FINDID
  787. GoSub CheckReagentTargetCursor
  788. Event Macro 22 0
  789. IgnoreItem #LTARGETID
  790. }
  791. else
  792. {
  793. GoSub SendSysMessage Warning You_are_out_of_tiles.
  794. key esc
  795. GoSub PlaySound %JobSound %JobPath
  796. GoSub ShowTileChargerMenu
  797. Set #menubutton N/A
  798. GoSub ListenToTheButtons
  799. }
  800. Return
  801. ;===================================================
  802. ; Subs Name: Shared Subs Between Them
  803. ; Author: Callum O'Lyre
  804. ; Purpose: These Subs are used by the three different sections of this script.
  805. ;====================================================
  806. sub CheckUp
  807. Set %BreakHPC #False
  808. While %BreakHPC = #False
  809. {
  810. GoSub ToWait SCNT 1
  811. if #charGhost = yes
  812. {
  813. Event Macro 6 0
  814. While #charGhost = yes
  815. {
  816. GoSub PlaySound %DeathSound %DeathPath
  817. wait 5s
  818. }
  819. }
  820. if %HealTime < #SCNT || %HealTime = N/A
  821. {
  822. if C in #charstatus
  823. {
  824. event macro 1 0 .Use AnyCure
  825. set %HealTime #SCNT + 15
  826. }
  827. if #Hits < #MaxHits
  828. {
  829. Event Macro 1 0 .Use AnyHeal
  830. set %HealTime #SCNT + 15
  831. }
  832. }
  833. Set %HPP ABS ( ( #HITS * 100 ) / #MAXHITS ) )
  834. if %HPP > %HealTo && C notin #charstatus
  835. {
  836. Set %BreakHPC #True
  837. }
  838. }
  839. GoSub ToWait SCNT 1
  840. return
  841.  
  842. Sub RefreshStrengthPotion
  843. if %StrTimer < #SCNT || %StrTimer = N/A
  844. {
  845. GoSub UsePotion 906 905 904 Strength
  846. if #Result = 1
  847. {
  848. Set %StrTimer #SCNT + 900
  849. }
  850. if #Result = 2
  851. {
  852. Set %StrTimer #SCNT + 600
  853. }
  854. if #Result = 3
  855. {
  856. Set %StrTimer #SCNT + 300
  857. }
  858. }
  859. return
  860.  
  861. sub ItemProps
  862. finditem #ltargetid
  863. event property #findid
  864. GoSub ToWait SCNT2 1
  865.  
  866. str pos #property $
  867. set %tmp #strres - 1
  868. str left #property %tmp
  869. set %name #strres
  870.  
  871. if #findstack > 1
  872. {
  873. str len #findstack
  874. set %tmp #strres + 1
  875. str del %name 1 %tmp
  876. set %name #strres
  877. }
  878. return
  879.  
  880. ;GoSub PlaySound <Sound Approval> <Sound Path>
  881. Sub PlaySound
  882. if %1 <> #False
  883. {
  884. Sound %2
  885. }
  886. return
  887. ;========================================
  888. ; Script Name: Improved Wait
  889. ; Author: Callum O'Lyre
  890. ; Version: 2.0
  891. ; Client Tested with: 5.0.9.1
  892. ; Shard OSI / FS: Pangaea
  893. ; Public Release: 08-09-2013
  894. ; Revision Date: 08-09-2013
  895. ; Purpose: Allows for waits in which you can scan for Save world States thanks to CEO,
  896. ; other checks can also be added but for right now only SWS's are in place.
  897. ; Params:
  898. ; %1 = SCNT or SCNT2
  899. ; %2 = Integer to wait
  900. ;=========================================
  901. Sub ToWait
  902. set %Func %1
  903. set %Delay %2
  904. set %TTW # . %Func + %Delay
  905. While %TTW > # . %Func
  906. {
  907. GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30
  908. }
  909. return
  910.  
  911. Sub SendSysMessage
  912. if %1 = Warning
  913. Set %TC 1939
  914. if %1 = Normal
  915. Set %TC 2984
  916. SET %lpc #LPC
  917. linesPerCycle 500
  918. SET %st 1
  919. SET %str %2
  920. STR LEN _
  921. SET %findlen #STRRES
  922. STR LEN #SPC
  923. SET %replen #STRRES
  924. STR LEN %str
  925. SET %len #STRRES
  926. clean:
  927. FOR %i %st %len
  928. {
  929.  
  930. STR MID %str %i %findlen
  931. SET %find #STRRES
  932. IF %find = _
  933. {
  934. STR DEL %str %i %findlen
  935. SET %str #STRRES
  936. IF #SPC <> _BLANK_
  937. {
  938. STR INS %str #SPC %i
  939. SET %str #STRRES
  940. SET %st %st + %findlen
  941. STR LEN %str
  942. SET %len #STRRES
  943. GOTO clean
  944. }
  945. else
  946. {
  947. STR LEN %str
  948. SET %len #STRRES
  949. SET %st %i
  950. GOTO clean
  951. }
  952. }
  953. else
  954. {
  955. SET %st %st + 1
  956. }
  957. }
  958. set #sysmsgcol %TC
  959. Event SysMessage %str
  960. set #sysmsgcol 0
  961. linesPerCycle %lpc
  962. RETURN
  963.  
  964.  
  965. ;GoSub UsePotion <PotionColor>
  966. ;=============================
  967. ; Potion Color Table
  968. ; The list order is potion type
  969. ; then next to it the potion colors
  970. ; for each potion strength. Ex:
  971. ; Mana Regen : 2974/2989/2088
  972. ;=============================
  973. ; Normal Potions
  974. ;=============================
  975. ; Agility : 1328/1331/1334
  976. ; Cure : 46/45/44
  977. ; Explosion : 625/624/125
  978. ; Heal : 356/354/2125
  979. ; Poison : 1419/1422/1425
  980. ; Strength : 904/905/906
  981. ; Wisdom : 1375/1374/1373
  982. ; Nightsight : 1109
  983. ; Refresh : 1642/1635
  984. ;=============================
  985. ; Custom Potions
  986. ;=============================
  987. ; Deadly Poison : 2060
  988. ; Equalizer : 1967
  989. ; Magic Reflect : 2027
  990. ; Paralyze : 1957
  991. ; Plague : 2071
  992. ; Paralyze Protection : 1998
  993. ; Holy Water : 1953
  994. ; Clumsy : 2033/2087/2988
  995. ; Flashbang : 2058/1155/1992
  996. ; Incognito : 2984/1947/2050
  997. ; Invisibility : 2048/2053/2051
  998. ; Mana Regen : 2974/2989/2088
  999. ; Mana Vampire : 2020/1941/2060
  1000. ; Poison Shield : 2054/2032/2094
  1001. ; Protection : 1995/2098/2070
  1002. ; Reactive Armor : 2037/2988/2074
  1003. ; Regeneration : 1945/1948/2021
  1004. ; Shockwave : 1959/1914/2083
  1005. ; TrueSight : 288/286/285
  1006. ; Weaken : 856/855/854
  1007. ;=============================
  1008. Sub UsePotion
  1009. Set %PotName %4
  1010. Set %Ct %0 - 1
  1011. For %Col 1 %Ct
  1012. {
  1013. FindItem WUF C
  1014. For #FindIndex 1 #FindCnt
  1015. {
  1016. event Property #FindID
  1017. if #FindCol = % . %Col && %PotName in #Property
  1018. {
  1019. Set #LObjectID #FindID
  1020. Event Macro 17 0
  1021. GoSub ToWait scnt2 5
  1022. set %HealTime #SCNT + 15
  1023. return %Col
  1024. }
  1025. }
  1026. }
  1027. GoSub ToWait scnt2 5
  1028. return
  1029.  
  1030. ;========================================
  1031. ; Script Name: Red Warrior Needs Food Badly
  1032. ; Author: Callum O'Lyre
  1033. ; Version: 1.5
  1034. ; Client Tested with: 5.0.9.1
  1035. ; Shard OSI / FS: Pangaea
  1036. ; Public Release: 23-05-2012
  1037. ; Revision Date: 29-05-2012
  1038. ; Purpose: Automatically feeds your character
  1039. ;=========================================
  1040. Sub EatFood
  1041. set !lpc #lpc
  1042. set #lpc 50
  1043. set %fjrnl #jindex
  1044. set %Break #False
  1045. While %Break <> #True
  1046. {
  1047. if #jindex > %fjrnl
  1048. {
  1049. set %fjrnl %fjrnl + 1
  1050. scanjournal %fjrnl
  1051. if You're_stuffed! in #journal || You_cannot_eat_anymore in #journal
  1052. {
  1053. set #lpc !lpc
  1054. set %FoodTimer #SCNT + 1200
  1055. GoSub ToWait scnt2 5
  1056. set %Break #True
  1057. }
  1058. }
  1059. FindItem %FoodTypes C
  1060. if #FindCNT < 1
  1061. {
  1062. GoSub SendSysMessage Warning You_are_out_of_Food.
  1063. set %FoodTimer #SCNT + 1200
  1064. set #lpc !lpc
  1065. set %Break #True
  1066. }
  1067. if %EatTimer < #SCNT || %EatTimer = N/A
  1068. {
  1069. Set #LOBJECTID #FindID
  1070. Event Macro 17 0
  1071. set %EatTimer #SCNT + 2
  1072. }
  1073. }
  1074. return
  1075.  
  1076. ;Currently GetSettings and SaveSettings do nothing!
  1077. ;Gearing up for a change though
  1078. Sub GetSettings
  1079. Set %DeathSound #True
  1080. Set %DeathPath Death.wav
  1081. Set %JobSound #True
  1082. Set %JobPath JobDone.wav
  1083. Set %AutoFeed #True
  1084. Set %StrPot #False
  1085. Set %HealTo 67
  1086.  
  1087. gosub getGlobalVar 45 FarjadAlchemy #charid DeathSound NOLOCK
  1088. gosub getGlobalVar 45 FarjadAlchemy #charid DeathPath NOLOCK
  1089. gosub getGlobalVar 45 FarjadAlchemy #charid JobSound NOLOCK
  1090. gosub getGlobalVar 45 FarjadAlchemy #charid JobPath NOLOCK
  1091. gosub getGlobalVar 45 FarjadAlchemy #charid AutoFeed NOLOCK
  1092. gosub getGlobalVar 45 FarjadAlchemy #charid StrPot NOLOCK
  1093. gosub getGlobalVar 45 FarjadAlchemy #charid HealTo NOLOCK
  1094. return
  1095.  
  1096. Sub ResetSettings
  1097. menu List Add DefaultBox Resetting back to default
  1098. gosub delGlobalVar 45 FarjadAlchemy #charid DeathSound
  1099. gosub delGlobalVar 45 FarjadAlchemy #charid DeathPath
  1100. gosub delGlobalVar 45 FarjadAlchemy #charid JobSound
  1101. gosub delGlobalVar 45 FarjadAlchemy #charid JobPath
  1102. gosub delGlobalVar 45 FarjadAlchemy #charid AutoFeed
  1103. gosub delGlobalVar 45 FarjadAlchemy #charid StrPot
  1104. gosub delGlobalVar 45 FarjadAlchemy #charid HealTo
  1105.  
  1106. GoSub GetSettings
  1107. Set %lpc #lpc
  1108. Set #lpc 60
  1109. menu Set DeathSoundCheckBox %DeathSound
  1110. menu Set JobSoundCheckBox %JobSound
  1111. menu Set AutoFeedCheckBox %AutoFeed
  1112. menu Set StrengthPotionCheckBox %StrPot
  1113. menu Set DeathSoundPath %DeathSound
  1114. menu Set JobSoundPath %JobSound
  1115. menu Set HealToEditBox %HealTo
  1116. menu List Add DefaultBox Settings are now their default
  1117. Set #lpc %lpc
  1118. return
  1119.  
  1120. Sub SaveSettings
  1121. menu Get DeathSoundCheckBox
  1122. if #menuRes <> %DeathSound
  1123. {
  1124. menu List Add DefaultBox Saving Death Sound Toggle
  1125. Set %DeathSound #menuRes
  1126. gosub putGlobalVar 45 FarjadAlchemy #charid DeathSound
  1127. }
  1128. menu Get DeathSoundPath
  1129. if #menuRes <> %DeathPath
  1130. {
  1131. menu List Add DefaultBox Saving Death Sound Path
  1132. Set %DeathPath #menuRes
  1133. gosub putGlobalVar 45 FarjadAlchemy #charid DeathPath
  1134. }
  1135. menu Get JobSoundCheckBox
  1136. if #menuRes <> %JobSound
  1137. {
  1138. menu List Add DefaultBox Saving Job Sound Toggle
  1139. Set %JobSound #menuRes
  1140. gosub putGlobalVar 45 FarjadAlchemy #charid JobSound
  1141. }
  1142. menu Get JobSoundPath
  1143. if #menuRes <> %JobPath
  1144. {
  1145. menu List Add DefaultBox Saving Job Sound Path
  1146. Set %JobPath #menuRes
  1147. gosub putGlobalVar 45 FarjadAlchemy #charid JobPath
  1148. }
  1149. menu Get AutoFeedCheckBox
  1150. if #menuRes <> %AutoFeed
  1151. {
  1152. menu List Add DefaultBox Saving Auto Feeder Toggle
  1153. Set %AutoFeed #menuRes
  1154. gosub putGlobalVar 45 FarjadAlchemy #charid AutoFeed
  1155. }
  1156. menu Get StrengthPotionCheckBox
  1157. if #menuRes <> %StrPot
  1158. {
  1159. menu List Add DefaultBox Saving Strength Potion Toggle
  1160. Set %StrPot #menuRes
  1161. gosub putGlobalVar 45 FarjadAlchemy #charid StrPot
  1162. }
  1163. menu GetNum HealToEditBox
  1164. if #menuRes <> %HealTo
  1165. {
  1166. menu List Add DefaultBox Saving Heal Percentage Setting
  1167. Set %HealTo #menuRes
  1168. if %HealTo > 100
  1169. Set %HealTo 100
  1170. if %HealTo < 1
  1171. Set %HealTo 1
  1172. gosub putGlobalVar 45 FarjadAlchemy #charid HealTo
  1173. }
  1174. GoSub GetSettings
  1175. return
  1176.  
  1177. ;===================================================
  1178. ; Sub Name: Menu Subs
  1179. ; Author: Callum O'Lyre
  1180. ; Purpose: The building of menus that the script uses at various times, this section also includes the button listener sub.
  1181. ;---------------------
  1182. ;Subs: InitialAlchemyMenu, NormalPotionMakingMenu, ShowSpecialPotionMakingMenu, ShowTileChargerMenu, ListenToTheButtons
  1183. ;====================================================
  1184. Sub InitialAlchemyMenu
  1185. GoSub GetSettings
  1186. menu Clear
  1187. menu Window Title Farjad's Lab
  1188. menu Window Size 250 180
  1189. menu window color Black
  1190. menu font bgcolor Black
  1191. menu Font Transparent #true
  1192. menu Font Align Right
  1193. menu Font Name MS Sans Serif
  1194. menu Font Size 8
  1195. menu Font Style
  1196. menu Font Color yellow
  1197. menu Font Transparent #false
  1198. menu Font Align center
  1199. menu Text EUOLabel1 5 5 What are you looking to do my friend?
  1200. menu Button GrindHouseButton 5 25 240 30 Grindhouse
  1201. menu Button NormalPotionMaking 5 65 240 30 Normal Potion Brewing
  1202. menu Button SpecialPotionMaking 5 105 240 30 Special Potion Brewing
  1203. menu Button TileCharging 5 145 240 30 Tile Charging
  1204. menu Button SettingsButton 224 2 20 20 S
  1205. Set #menubutton N/A
  1206. menu Window Transparent 100
  1207. menu Show
  1208. return
  1209.  
  1210. Sub BuildSettingsMenu
  1211. menu Shape SettingsBox 260 5 249 214 3 7 1 Yellow 7 None
  1212. menu Font Name MS Sans Serif
  1213. menu Font Size 8
  1214. menu Font Style
  1215. menu Font Color Yellow
  1216. menu Font Transparent #false
  1217. menu Font Align Center
  1218. menu Font BGColor Black
  1219. menu Font Align Left
  1220. menu Text SettingsTitle 268 -1 Settings
  1221. menu Font Transparent #true
  1222. menu List Create DefaultBox 5 180 240 65
  1223. menu Text DeathSoundTitle 264 92 Where is your Death Sound located?
  1224. menu Text JobSoundTitle 264 132 Where is your Job's Done Sound Located?
  1225. menu Text HealToText 264 176 At what health should I return to making potions?
  1226. menu Check DeathSoundCheckBox 264 12 109 17 %DeathSound On Death Sound?
  1227. menu Check JobSoundCheckBox 264 32 113 17 %JobSound Job's Done Sound?
  1228. menu Check AutoFeedCheckBox 264 52 150 17 %AutoFeed Auto Feed Me?
  1229. menu Check StrengthPotionCheckBox 264 72 130 17 %StrPot Use Strength Potions?
  1230. menu Edit DeathSoundPath 264 108 121 %DeathPath
  1231. menu Edit JobSoundPath 264 148 121 %JobPath
  1232. menu Edit HealToEditBox 264 192 121 %HealTo
  1233. menu Button SaveSettingsButton 260 220 122 25 Save Settings
  1234. menu Button ResetSettingsButton 388 220 122 25 Reset Button
  1235. menu Window Size 515 250
  1236. return
  1237. ;Normal Potion Brewing Menu
  1238. Sub NormalPotionMakingMenu
  1239. Set %NormalPotionMakingMenu #True
  1240. menu Clear
  1241. menu Window Title Normal Potion
  1242. menu Window Color Black
  1243. menu Window Size 200 50
  1244. menu Font Transparent #true
  1245. menu Font Name MS Sans Serif
  1246. menu Font Size 8
  1247. menu Font Style
  1248. menu Font Color Yellow
  1249. menu Font Align center
  1250. menu Text NormReagentText 65 13 Select Reagent Type!
  1251. menu Font BGColor Yellow
  1252. menu Font BGColor Black
  1253. menu Button NormRegSelection 40 10 20 20 _
  1254. menu Button BackButton 5 5 20 30 <
  1255. menu Show
  1256. return
  1257.  
  1258. ;Special Potion Making Menu
  1259. Sub ShowSpecialPotionMakingMenu
  1260. set !lpc #lpc
  1261. set #lpc 300
  1262. menu clear
  1263. menu Window Title Farjad's Potion Brewer
  1264. menu window size 230 328
  1265. menu show
  1266. menu window color Black
  1267. menu font bgcolor Black
  1268. menu Font Color Yellow
  1269. menu font size 10
  1270. menu Font Transparent #true
  1271. menu Text Title 55 5 Farjad's Potion Mixer
  1272. for %LN 1 10
  1273. {
  1274. set %LMulti %LN - 1
  1275. set %LineY 35 + ( 23 * ( %LMulti % 10 ) )
  1276. menu button %LN 5 %LineY 19 20 %LN
  1277. menu Shape Line 5 %LineY 220 20 3 7 1 $111111 7 $111111
  1278. }
  1279. for %TN 1 10
  1280. {
  1281. set %TMulti %TN - 1
  1282. set %TextY 36 + ( 23 * ( %TMulti % 10 ) )
  1283. menu Text Reg . %TN 30 %TextY #SPC
  1284. }
  1285. menu button BeginSpecialPotionMakingButton 5 298 220 25 Start
  1286. menu button ResetAllValues 5 270 220 25 Reset All Values
  1287. menu button BackButton 5 5 19 20 <
  1288. if %RecipeVerification = #True
  1289. {
  1290. menu button RecipeButton 206 5 19 20 R
  1291. }
  1292. menu Window Transparent 80
  1293. menu Show
  1294. set #lpc !lpc
  1295. return
  1296.  
  1297. ;Tile Charger Menu
  1298. Sub ShowTileChargerMenu
  1299. menu Clear
  1300. menu Window Title Farjad's Tile Supercharger
  1301. menu Window Color Black
  1302. menu Window Size 210 109
  1303. menu Font Transparent #true
  1304. menu Font Align Right
  1305. menu Font Name MS Sans Serif
  1306. menu Font Size 8
  1307. menu Font Style
  1308. menu Font Color WindowText
  1309. menu Font Transparent #false
  1310. menu Font Align Left
  1311. menu Font BGColor Black
  1312. menu Font Color Yellow
  1313. menu Text WandTypeText 4 28 What Type of Wand do you wish to make?
  1314. menu Combo Create WandType 4 50 201
  1315. menu Combo Add WandType Wand of Blessing
  1316. menu Combo Add WandType Wand of Daemons
  1317. menu Combo Add WandType Wand of Firewall
  1318. menu Combo Add WandType Wand of Healing
  1319. menu Combo Add WandType Wand of Hellfire
  1320. menu Combo Add WandType Wand of Life
  1321. menu Combo Add WandType Wand of Lightning
  1322. menu Combo Add WandType Wand of Magic Reflection
  1323. menu Combo Add WandType Wand of Meteors
  1324. menu Combo Add WandType Wand of Protection
  1325. menu Combo Add WandType Wand of Venom
  1326. menu Combo Select WandType 1
  1327. menu Font Size 10
  1328. menu Button BeginTileCharging 4 80 203 25 Start
  1329. menu button BackButton 4 4 19 19 <
  1330. menu Font Size 8
  1331. menu Window Transparent 100
  1332. menu Show
  1333. return
  1334.  
  1335. sub GrinderMenu
  1336. Set %RegType N/A
  1337. Set %NormalPotionMakingMenu #False
  1338. menu Clear
  1339. menu Window Title Grindhouse
  1340. menu Window Color Black
  1341. menu Window Size 210 120
  1342. menu Font Transparent #true
  1343. menu Font Align Right
  1344. menu Font Name MS Sans Serif
  1345. menu Font Size 8
  1346. menu Font Style
  1347. menu Font Color Yellow
  1348. menu Font Align Left
  1349. menu Text NormReagentText 62 32 Select Reagent Type!
  1350. menu Font BGColor Yellow
  1351. menu Font BGColor Black
  1352. menu Button NormRegSelection 37 29 20 20 _
  1353. menu Button BackButton 5 5 20 20 <
  1354. menu Button StartGrindHouse 36 78 145 21 Start
  1355. menu Show
  1356. return
  1357.  
  1358. Sub ListenToTheButtons
  1359. while #true
  1360. {
  1361. while #menubutton = N/A
  1362. {
  1363. }
  1364.  
  1365. ;Selection Menu Buttons
  1366. if #menuButton = SettingsButton
  1367. {
  1368. Set !lpc #lpc
  1369. Set #lpc 60
  1370. if %Expanded <> #True
  1371. {
  1372. GoSub BuildSettingsMenu
  1373. Set %Expanded #True
  1374. }
  1375. else
  1376. {
  1377. GoSub InitialAlchemyMenu
  1378. Set %Expanded #False
  1379. }
  1380. Set #lpc !lpc
  1381. Set #menubutton N/A
  1382. }
  1383. if #menubutton = ResetSettingsButton
  1384. {
  1385. GoSub ResetSettings
  1386. Set #menubutton N/A
  1387. }
  1388. if #menubutton = SaveSettingsButton
  1389. {
  1390. GoSub SaveSettings
  1391. Set #menubutton N/A
  1392. }
  1393. if #menuButton = NormalPotionMaking
  1394. {
  1395. GoSub NormalPotionMakingMenu
  1396. Set #menubutton N/A
  1397. }
  1398. if #menuButton = SpecialPotionMaking
  1399. {
  1400. GoSub ShowSpecialPotionMakingMenu
  1401. Set #menubutton N/A
  1402. }
  1403. if #menubutton = TileCharging
  1404. {
  1405. GoSub ShowTileChargerMenu
  1406. Set #menubutton N/A
  1407. }
  1408. if #menubutton = GrindHouseButton
  1409. {
  1410. Gosub GrinderMenu
  1411. Set #menubutton N/A
  1412. }
  1413. ;GrindHouse Buttons
  1414. if #menubutton = StartGrindHouse
  1415. {
  1416. menu Delete NormalRegSelection
  1417. menu Delete StartGrindHouse
  1418. menu Delete BackButton
  1419. menu Button StopGrindHouse 36 78 145 21 Stop
  1420. Set #menubutton N/A
  1421. GoSub GrindHouse %ReagentToGrindType
  1422. }
  1423. if #menubutton = StopGrindHouse
  1424. {
  1425. menu Delete StopGrindHouse
  1426. menu Button NormRegSelection 37 29 20 20 _
  1427. menu Button BackButton 5 5 20 20 <
  1428. menu Button StartGrindHouse 36 78 145 21 Start
  1429. Set #menubutton N/A
  1430. }
  1431. ;Normal Potion Making Buttons
  1432. If #MenuButton = NP1
  1433. {
  1434. for %i 1 4
  1435. {
  1436. menu delete NP . %i
  1437. }
  1438. Set #menubutton N/A
  1439. menu Button StopNormPotions 5 165 205 20 Stop
  1440. menu Delete BackButton
  1441. GoSub BeginNormalPotionMakingProcess %ReagentToGrindType %ReagentToGrindID 1
  1442. }
  1443. If #MenuButton = NP2
  1444. {
  1445. for %i 1 4
  1446. {
  1447. menu delete NP . %i
  1448. }
  1449. Set #menubutton N/A
  1450. menu Button StopNormPotions 5 165 205 20 Stop
  1451. menu Delete BackButton
  1452. GoSub BeginNormalPotionMakingProcess %ReagentToGrindType %ReagentToGrindID 2
  1453. }
  1454. If #MenuButton = NP3
  1455. {
  1456. for %i 1 4
  1457. {
  1458. menu delete NP . %i
  1459. }
  1460. Set #menubutton N/A
  1461. menu Button StopNormPotions 5 165 205 20 Stop
  1462. menu Delete BackButton
  1463. GoSub BeginNormalPotionMakingProcess %ReagentToGrindType %ReagentToGrindID 3
  1464. }
  1465. If #MenuButton = NP4
  1466. {
  1467. for %i 1 4
  1468. {
  1469. menu delete NP . %i
  1470. }
  1471. Set #menubutton N/A
  1472. menu Button StopNormPotions 5 165 205 20 Stop
  1473. menu Delete BackButton
  1474. GoSub BeginNormalPotionMakingProcess %ReagentToGrindType %ReagentToGrindID 4
  1475. }
  1476. if #menubutton = StopNormPotions
  1477. {
  1478. menu Delete StopNormPotions
  1479. menu Button NormRegSelection 37 29 20 20 _
  1480. menu Button BackButton 5 5 20 20 <
  1481. GoSub DeterminePotionTypes %ReagentToGrindType
  1482. Set #menubutton N/A
  1483. }
  1484. ;Special Potion Brewing Buttons
  1485. if #menubutton >= 1 && #menubutton <= 10
  1486. {
  1487. gosub ReagentSelection ReagentType , #menubutton
  1488. gosub ItemProps
  1489. menu Set Reg . #menubutton %name
  1490. Set #menubutton N/A
  1491. }
  1492. if #menubutton = ResetAllValues
  1493. {
  1494. for %TN 1 10
  1495. {
  1496. set %TMulti %TN - 1
  1497. set %TextY 36 + ( 23 * ( %TMulti % 10 ) )
  1498. set %ReagentType . %TN N/A
  1499. menu Delete Reg . %TN
  1500. menu Text Reg . %TN 30 %TextY #SPC
  1501. }
  1502. GoSub SendSysMessage Normal All_values_reset!
  1503. Set #menubutton N/A
  1504. }
  1505. if #menubutton = BeginSpecialPotionMakingButton
  1506. {
  1507. for %DB 1 10
  1508. {
  1509. menu Delete %DB
  1510. }
  1511. menu Delete RecipeButton
  1512. menu Delete BackButton
  1513. menu Delete BeginSpecialPotionMakingButton
  1514. menu Delete ResetAllValues
  1515. menu button Stop 5 298 220 25 Stop
  1516. Set #menubutton N/A
  1517. gosub BeginAlchemization
  1518. }
  1519. if #menubutton = stop
  1520. {
  1521. menu Delete Stop
  1522. for %LN 1 10
  1523. {
  1524. set %LMulti %LN - 1
  1525. set %LineY 35 + ( 23 * ( %LMulti % 10 ) )
  1526. menu button %LN 5 %LineY 19 20 %LN
  1527. }
  1528. if %RecipeVerification = #True
  1529. {
  1530. menu button RecipeButton 206 5 19 19 R
  1531. }
  1532. menu button BackButton 5 5 19 19 <
  1533. menu button BeginSpecialPotionMakingButton 5 298 220 25 Start
  1534. menu button ResetAllValues 5 270 220 25 Reset All Values
  1535. Set #menubutton N/A
  1536. }
  1537. if #menubutton = RecipeButton
  1538. {
  1539. if %RecipesExtended <> #True
  1540. {
  1541. set %RecipesExtended #True
  1542. menu Window Size 460 328
  1543. call PotionRecipes.txt GetRecipeTable
  1544. Set #menubutton N/A
  1545. }
  1546. else
  1547. {
  1548. set %RecipesExtended #False
  1549. menu Delete RecipeList
  1550. menu Window Size 230 328
  1551. Set #menubutton N/A
  1552. }
  1553. }
  1554. ;Tile Charging Buttons and Dropdown stuff
  1555. if #menubutton = BeginTileCharging
  1556. {
  1557. Set #menubutton N/A
  1558. menu Get WandType
  1559. GoSub TileTypeSetup #menuRes
  1560. menu Delete StartTileCharging
  1561. menu Button StopTileCharging 4 80 203 25 Stop
  1562. GoSub ChargeTile %TileType %GemType
  1563. }
  1564. if #menubutton = StopTileCharging
  1565. {
  1566. Set #menubutton N/A
  1567. GoSub ShowTileChargerMenu
  1568. }
  1569. ;Shared Buttons
  1570. if #menubutton = closed 1
  1571. {
  1572. halt
  1573. }
  1574. if #menubutton = BackButton
  1575. {
  1576. for %RTD 1 10
  1577. {
  1578. set %ReagentType . %RTD N/A
  1579. }
  1580. set %NormalPotionMakingMenu #False
  1581.  
  1582. GoSub InitialAlchemyMenu
  1583. Set #menubutton N/A
  1584. }
  1585. if #menubutton = NormRegSelection
  1586. {
  1587. gosub ReagentSelection ReagentTarget
  1588. finditem %ReagentTarget
  1589. set %ReagentToGrindID %ReagentTarget
  1590. Set %ReagentToGrindType #FindType
  1591. gosub ItemProps
  1592. if %NormalPotionMakingMenu = #True
  1593. GoSub DeterminePotionTypes %ReagentToGrindType
  1594. else
  1595. menu Set NormReagentText %name
  1596. Set #menubutton N/A
  1597. }
  1598. }
  1599.  
  1600. ;-----------------------------------------------------------
  1601. ; Script Name: CEOWorldSaveChecker
  1602. ; Author: CEO
  1603. ; Version: 1.0
  1604. ; Client Tested with: 4.0.10b
  1605. ; EUO version tested with: 1.42.00A5
  1606. ; Shard OSI / FS: OSI
  1607. ; Revision Date: 060105
  1608. ; Public Release: 060105
  1609. ; Global Variables Used: *CEOWorldSaving
  1610. ; Purpose: Used to catch the world save message for freeshards and temporarily pause mainscript during save.
  1611. ; Link : http://www.easyuo.com/forum/viewtopic.php?p=3585#3585
  1612. ;-------------------------------------------------------------
  1613. sub CEOWorldSaveChecker
  1614. ; sub to pause a script during a RunUO world save.
  1615. set %_text1 %1
  1616. set %_text2 %2
  1617. set %_text3 %3
  1618. if %_worldsaveupcoming
  1619. {
  1620. if %_worldsavetimer < #scnt
  1621. {
  1622. set %_worldsavetimer #scnt + %5
  1623. gosub popupworldsave 5 270 blue
  1624. goto _WSC_WAIT1
  1625. }
  1626. return
  1627. }
  1628. _WSC1:
  1629. if %_worldsavejournalindex > #jindex
  1630. return
  1631. scanjournal %_worldsavejournalindex
  1632. if %_text1 in #journal
  1633. {
  1634. set %_worldsaveupcoming #true
  1635. set %_worldsavetimer #scnt + %4
  1636. set %_worldsavejournalindex %_worldsavejournalindex + 1
  1637. return
  1638. }
  1639. set %_worldsavejournalindex %_worldsavejournalindex + 1
  1640. goto _WSC1
  1641. _WSC_WAIT1:
  1642. if %_worldsavetimer < #scnt
  1643. goto _WSC_Complete
  1644. wait 5
  1645. set *CEOWorldSaving #true
  1646. if %_worldsavejournalindex > #jindex
  1647. goto _WSC_WAIT1
  1648. scanjournal %_worldsavejournalindex
  1649. if %_text2 in #journal
  1650. {
  1651. gosub popupworldsave 5 270 yellow
  1652. set %_worldsavejournalindex %_worldsavejournalindex + 1
  1653. goto _WSC_WAIT2
  1654. }
  1655. set %_worldsavejournalindex %_worldsavejournalindex + 1
  1656. goto _WSC_WAIT1
  1657. _WSC_WAIT2:
  1658. if %_worldsavetimer < #scnt
  1659. goto _WSC_Complete
  1660. wait 5
  1661. if %_worldsavejournalindex > #jindex
  1662. goto _WSC_WAIT2
  1663. scanjournal %_worldsavejournalindex
  1664. if %_text3 notin #journal
  1665. {
  1666. set %_worldsavejournalindex %_worldsavejournalindex + 1
  1667. goto _WSC_WAIT2
  1668. }
  1669. _WSC_Complete:
  1670. set %_worldsavejournalindex #jindex
  1671. set %_worldsaveupcoming #false
  1672. set *CEOWorldSaving #false
  1673. menu delete worldsave
  1674. return
  1675.  
  1676. sub popupworldsave
  1677. set %x %1
  1678. set %y %2
  1679. set %worldcolor %3
  1680. menu shape worldsave %x %y 25 25 1 7 2 yellow 7 %worldcolor
  1681. menu font bgcolor black
  1682. menu font color yellow
  1683. menu font type b
  1684. menu font size 10
  1685. set %x %x + 30
  1686. set %y %y + 5
  1687. menu text worldsave %x %y World Save State
  1688. menu font size 10
  1689. menu font bgcolor black
  1690. menu font color yellow
  1691. menu font type n
  1692. return
  1693.  
  1694. ;==================================
  1695. ; Script Name: CEO*FileSystem (pseudo filesystem)
  1696. ; Author: CEO
  1697. ; Version: 1.1
  1698. ; Client Tested with: 4.0.1b
  1699. ; EUO version tested with: 1_41_103
  1700. ; Shard OSI / FS: OSI
  1701. ; Revision Date: 040219
  1702. ; Public Release: 040219
  1703. ; Globals Used: User specified (2 total)
  1704. ; Purpose: Allows you to use a * variable as a pseudo-filesystem
  1705. ; Link: http://www.easyuo.com/forum/viewtopic.php?p=3585#3585
  1706. ;=======================================
  1707. ; CEO's global variable management subs:
  1708. ; getGlobalVar . putGlobalVar . delGlobalVar
  1709. ;=======================================
  1710. ;
  1711. ;ver 1.1
  1712. ;changed the lock file to use *variablename_lock so it'll work with any named *variable
  1713. ;
  1714. Sub getGlobalVar
  1715.  
  1716. ;ver 1.0 posted 19Feb04 by CEO
  1717. ;purpose: Allows you to store multiple variables in one global variable unique to
  1718. ; each player and script. getGlobaVar retrieves a value from a global variable.
  1719. ;@returns: #result = #false if variable not found, #true if found
  1720. ; % . %3 contains variable value
  1721. ;%1 is the global/persistant variable to use ( %1 + 1 is used for locking)
  1722. ;%2 is the script identifer or pseudo filename
  1723. ;%3 is #charid or pseudo filename
  1724. ;%4 is the variable to search for and return in %. %3
  1725. ;%5 is for lock control. By default getGlobalVar uses a lock to return a value. In some cases you may want to
  1726. ; retrieve a variable (mostly for speed) without needing a lock as long as you are aware of
  1727. ; any potentional conflicts, that very rarely may occur. Set this param to NOLOCK to access
  1728. ; global storage without a lock.
  1729. ;sample usage:
  1730. ; gosub getGlobalVar 50 MyScript #charid backpackid
  1731. ; Using global var *50 finds the variable labeled MyScript#charidbackpackid and returns it in %backpackid
  1732. ;
  1733. ; gosub getGlobalVar 50 MyScript #charid clothstat NOLOCK
  1734. ; Using global var *50 find the variable labeled MyScript#charidclothstat and returns it in %clothstat without using a lock
  1735. ; Warning: do not use *1000. * %1 + 1 is used for locking and there is no *1001!
  1736. nameSpace push
  1737. nameSpace local #systime , _ , %2 , _ , %3 , _ , %4 , _ , GET
  1738. set !lpc #lpc
  1739. set #lpc 1000
  1740. set !lock %1 , _lock
  1741. if ( %0 = 5 ) && ( %5 = NOLOCK )
  1742. goto getGlobalVar_skiplock
  1743. set !lockcount 0
  1744. getGlobalVar_waitforlock:
  1745. if * . !lock <> N/A && * . !lock <> #nsname
  1746. {
  1747. wait 1 4
  1748. set !lockcount !lockcount + 1
  1749. if !lockcount < 10
  1750. goto getGlobalVar_waitforlock
  1751. if * . !lock <> N/A
  1752. {
  1753. set !currentlock * . !lock
  1754. if !currentlock = N/A
  1755. goto getGlobalVar_waitforlock
  1756. str pos !currentlock _
  1757. set !strres #strres - 1
  1758. str left !currentlock !strres
  1759. set !systime #systime - #strres
  1760. if !systime < 10000 ; if over 10 seconds assume a broken lock and take it
  1761. {
  1762. set !lockcount 0
  1763. goto getGlobalVar_waitforlock
  1764. }
  1765. }
  1766. }
  1767. set * . !lock #nsname
  1768. wait 3 2
  1769. if * . !lock <> #nsname
  1770. {
  1771. set !lockcount 0
  1772. goto getGlobalVar_waitforlock
  1773. }
  1774. getGlobalVar_skiplock:
  1775. set !global * . %1
  1776. set !varName %2 , ^ , %3 , ^ , %4 , |
  1777. str pos !global !varName
  1778. set #result #strres <> 0
  1779. if #result
  1780. {
  1781. set !varNamePos #strres
  1782. str len !varName
  1783. set !delString !varNamePos + #strres - 1
  1784. str del !global 1 !delString
  1785. set !global #strres
  1786. str pos !global |
  1787. set !varNamePos #strres - 1
  1788. str left !global !varNamePos
  1789. set % . %4 #strres
  1790. }
  1791. if ( %0 < 5 || %5 <> NOLOCK ) && * . !lock = #nsname
  1792. set * . !lock N/A
  1793. set #lpc !lpc
  1794. nameSpace Clear
  1795. nameSpace Pop
  1796. return #result
  1797.  
  1798. Sub putGlobalVar
  1799. ;ver 1.0 posted 19Feb04 by CEO
  1800. ;purpose: Allows you to store multiple variables in one global variable unique to
  1801. ; each player and script. putGlobaVar stores a value into a global variable.
  1802.  
  1803. ;@returns: #result = #false if variable not found, #true if found
  1804. ; % . %3 contains variable
  1805. ;%1 is the global/persistant variable to use
  1806. ;%2 is the script identifer or pseudo filename
  1807. ;%3 #charid or other identifier
  1808. ;%4 is the variable name of the variable to save into the* variable identified in %1
  1809. ;sample usage:
  1810. ; gosub putGlovalVar 50 MyScript #chardid backpackid
  1811. ; Using global var *50 stores/updates the variable labeled MyScript#charidbackpackid with %backpackid
  1812. ; Warning: do not use *1000. * %1 + 1 is used for locking and there is no *1001!
  1813. nameSpace push
  1814. nameSpace local #systime , _ , %2 , _ , %3 , _ , %4 , _ , PUT
  1815. set !lpc #lpc
  1816. set #lpc 1000
  1817. set !lock %1 , _lock
  1818. set !lockcount 0
  1819. putGlobalVar_waitforlock:
  1820. if * . !lock <> N/A && * . !lock <> #nsname
  1821. {
  1822. wait 1 4
  1823. set !lockcount !lockcount + 1
  1824. if !lockcount < 10
  1825. goto putGlobalVar_waitforlock
  1826. if * . !lock <> N/A
  1827. {
  1828. set !currentlock * . !lock
  1829. if !currentlock = N/A
  1830. goto putGlobalVar_waitforlock
  1831. str pos !currentlock _
  1832. set !strres #strres - 1
  1833. str left !currentlock !strres
  1834. set !systime #systime - #strres
  1835. if !systime < 10000 ; if over 10 seconds assume a hung lock and take it
  1836. {
  1837. set !lockcount 0
  1838. goto putGlobalVar_waitforlock
  1839. }
  1840. }
  1841. }
  1842. set * . !lock #nsname
  1843. wait 4
  1844. set !global * . %1
  1845. set !varName %2 , ^ , %3 , ^ , %4 , |
  1846. str pos !global !varName
  1847. if #strres = 0
  1848. {
  1849. if * . !lock <> #nsname
  1850. {
  1851. set !lockcount 0
  1852. goto putGlobalVar_waitforlock
  1853. }
  1854. if |CEO*FILESYSTEM| notin !global
  1855. set !global |CEO*FILESYSTEM|
  1856. set * . %1 !global , !varName , % . %4 , |
  1857. set * . !lock N/A
  1858. set #lpc !lpc
  1859. nameSpace clear
  1860. nameSpace pop
  1861. return #true
  1862. }
  1863. set !varNamePos #strres
  1864. str len !varName
  1865. set !splitString !varNamePos + #strres - 1
  1866. str left !global !splitstring
  1867. set !globalPart1 #strres
  1868. str del !global 1 !splitString
  1869. set !global #strres
  1870. str len !global
  1871. set !globalLen #strres
  1872. str pos !global |
  1873. set !splitString !globalLen - #strres + 1
  1874. str right !global !splitstring
  1875. set !global #strres
  1876. if * . !lock <> #nsname
  1877. {
  1878. set !lockcount 0
  1879. goto putGlobalVar_waitforlock
  1880. }
  1881. set * . %1 !globalPart1 , % . %4 , !global
  1882. set * . !lock N/A
  1883. set #lpc !lpc
  1884. nameSpace clear
  1885. nameSpace pop
  1886. return #true
  1887.  
  1888.  
  1889. Sub delGlobalVar
  1890. ;ver 1.0 posted 19Feb04 by CEO
  1891. ;purpose: Allows you to delete a variable out of the globalvar pool unique to
  1892. ; each player and script. delGlobaVar deletes a global variable in a * variable.
  1893.  
  1894. ;@returns: #result = #false if variable not found, #true if deleted
  1895. ;
  1896. ;%1 is the global/persistant variable to use
  1897. ;%2 is the script identifer or pseudo filename
  1898. ;%3 is #charid or other identifier
  1899. ;%4 is the variable name of the variable to save into the* variable identified in %1
  1900. ;sample usage:
  1901. ; gosub delGlovalVar 50 MyScript #charid backpackid
  1902. ; Using global var *50 deletes the variable label MyScript#charidbackpackid and it's associated value.
  1903. ; Warning: do not use *1000. * %1 + 1 is used for locking and there is no *1001!
  1904. nameSpace push
  1905. nameSpace local #systime , _ , %2 , _ , %3 , _ , %4 , _ , DEL
  1906. set !lpc #lpc
  1907. set #lpc 1000
  1908. set !lock %1 , _lock
  1909. set !lockcount 0
  1910. delGlobalVar_waitforlock:
  1911. if * . !lock <> N/A && * . !lock <> #nsname
  1912. {
  1913. wait 1 4
  1914. set !lockcount !lockcount + 1
  1915. if !lockcount < 10
  1916. goto delGlobalVar_waitforlock
  1917.  
  1918. if * . !lock <> N/A
  1919. {
  1920. set !currentlock * . !lock
  1921. if !currentlock = N/A
  1922. goto delGlobalVar_waitforlock
  1923. str pos !currentlock _
  1924. set !strres #strres - 1
  1925. str left !currentlock !strres
  1926. set !systime #systime - #strres
  1927. if !systime < 10000 ; if over 10 seconds assume a broken lock and take it
  1928. {
  1929. set !lockcount 0
  1930. goto delGlobalVar_waitforlock
  1931. }
  1932. }
  1933.  
  1934. }
  1935. set * . !lock #nsname
  1936. wait 4
  1937. set !global * . %1
  1938. set !varName %2 , ^ , %3 , ^ , %4 , |
  1939. str pos !global !varName
  1940. set #result #strres <> 0
  1941. if #result
  1942. {
  1943. set !varNamePos #strres
  1944. str len !varName
  1945. set !splitString !varNamePos + #strres - 1
  1946. set !delString !varNamePos - 1
  1947. str left !global !delString
  1948. set !globalPart1 #strres
  1949. str del !global 1 !splitString
  1950. set !global #strres
  1951. str pos !global |
  1952. set !delString #strres
  1953. str del !global 1 !delString
  1954. if * . !lock <> #nsname
  1955. {
  1956. set !lockcount 0
  1957. goto delGlobalVar_waitforlock
  1958. }
  1959. set * . %1 !globalPart1 , #strres
  1960. }
  1961. if * . !lock = #nsname
  1962. set * . !lock N/A
  1963. set #lpc !lpc
  1964. nameSpace clear
  1965. nameSpace pop
  1966. return #result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement