;==================================================== ; Script Name: Farjad's Alchemy Lab ; Author: Cyrus Tegyr ; Version: 5.0 ; Client Tested with: 5.0.9.1 ; Shard OSI / FS: Pangaea ; Purpose: To be a one stop shop for alchemists on Pangaea ; Thanks to: CEO from Easyuo for some superb subs ; Those who willingly jumped at the chance ; to test this out and for those patient enough ; to wait for my slow ass to fix things. ; ; ToDo ; Might need more food types, I have a good many ; but chiefly food types made by cooks is what I ; think it needs more of. ; ; New 5.02 ; Added some troubleshooting messages to the grind ; Essence maker portion of the script to pinpoint ; a known issue. Feedback needed as soon as a ; disturbance occurs. ; ; New 5.01 ; Fixed an issue where if you set your healto option ; to less than 0 or greater than 100 it wouldn't ; default to a proper percentage ; ; New 5.0 ; Added a Settings Section: ; - On Death Sound ; - On Job Completion Sound ; - Auto Feed Option ; - Use Strength Potions ; - Death Sound Path ; - Job's Done Path ; - Heal until Percentage ; Added colored messages ; Auto Feeder Added ; ; New 4.0 ; Reworked the normal Potion menu again! ; Added ToWait sub for better handled waits! ; Added a stop button for tile charging. ;==================================================== ;Simple Item Setup Set %Essence DUF_IUF_EUF_LZF_PZF_QZF_DAG Set %Powderables OZF_UZF_HUF_XZF_VZF_VWL_YZF_EAG_TZF_GUF_NZF_FUF Set %NormRegs RZF_KUF_JZF_JUF_KZF_MZF_WZF_SZF Set %FoodTypes VQE_MQE_KPE_AXI_YWI_YBF_FWI_TWI_UWI_QQD_ZPE_ +HND_NRD_RGG_QRD_ZBG_END_BND_ACG_JQE_CWE_ +YRD_GND ;--Do Not Edit Beyond This Point Unless You Don't Mind Possibly Breaking Things set %_worldsavejournalindex #jindex set *CEOWorldSaving #false FindItem RQF C_ , #BACKPACKID if #FindCNT < 1 { GoSub SendSysMessage Warning Couldn't_find_your_Mortar_&_Pestle,_make_sure_it_is_in_your_main_backpack,_halting. halt } Set %Mortar #FINDID set %RecipeVerification #False call PotionRecipes.txt VerifyRecipeList GoSub InitialAlchemyMenu GoSub ListenToTheButtons ;=================================================== ; Subs Name: Grinder/Essence Subs ; Author: Callum O'Lyre ; Purpose: These Subs are for use on Pangaea for Manufacturing of powders and essences alike. ;==================================================== Sub GrindHouse Set %RegType %1 Set %TimeToWait #SCNT if %RegType in %Essence { FindItem EHJ G_2 if #FindCNT < 1 { GoSub SendSysMessage Warning You_call_yourself_an_alchemist_with_no_Alembic?! GoSub GrinderMenu return } else { Set %ToolID #FindID set %GrindTimer 7 Set %ReqAmt 3 } } if %RegType in %Powderables { Set %ToolID %Mortar Set %GrindTimer 5 Set %ReqAmt 2 } if %RegType notin %Essence && %RegType notin %Powderables { GoSub SendSysMessage Warning This_is_neither_a_powderable_reagent_or_a_reagent_that_can_be_turned_into_an_essence! GoSub GrinderMenu Return } if %RegType <> VWL { FindItem %RegType set %RegID #FindID Repeat { if %AutoFeed <> #False && %FoodTimer < #SCNT || %FoodTimer = N/A { GoSub EatFood } While #SCNT < %TimeToWait { if #menubutton <> N/A { GoSub SendSysMessage Warning You_seem_to_have_clicked_the_stop_button! return } GoSub ToWait SCNT2 2 } Set #LOBJECTID %ToolID Event Macro 17 0 Set #LTARGETID %RegID Target 5s Event Macro 22 0 Set %TimeToWait #SCNT + %GrindTimer FindItem %RegID } Until #FINDSTACK < %ReqAmt GoSub SendSysMessage Warning You_seem_to_have_run_out_of_reagents_to_grind_or_essence! GoSub PlaySound %JobSound %JobPath GoSub GrinderMenu } else { FindItem %RegType For #FindIndex 1 #FindCNT { if %AutoFeed <> #False && %FoodTimer < #SCNT || %FoodTimer = N/A { GoSub EatFood } While #SCNT < %TimeToWait { GoSub ToWait SCNT2 2 if #menubutton <> N/A { GoSub SendSysMessage Warning You_seem_to_have_clicked_the_stop_button! return } } Set #LOBJECTID %ToolID Event Macro 17 0 Set #LTARGETID #FINDID Target 5s Event Macro 22 0 Set %TimeToWait #SCNT + %GrindTimer } GoSub SendSysMessage Warning You_seem_to_have_run_out_of_foci_to_grind! GoSub PlaySound %JobSound %JobPath GoSub GrinderMenu } Return ;=================================================== ; Subs Name: Normal Potion Making Subs ; Author: Callum O'Lyre ; Purpose: These Subs are for use on Pangaea when macroing up some normal potion types ;==================================================== ;GoSub BeginNormalPotionMakingProcess %ReagentToGrindType %ReagentToGrindID %PotionIndex Sub BeginNormalPotionMakingProcess Set %RTGT %1 Set %RTGID %2 Set %PotionIndex %3 GoSub DetermineReagentCounts %RTGT %PotionIndex While #True { if #menubutton = StopNormPotions { return } FindItem %RTGID if #FindStack < %RN { GoSub SendSysMessage Warning You_Have_Run_Out_of_Reagents! GoSub PlaySound %JobSound %JobPath GoSub NormalPotionMakingMenu Return } if %HealTime <> N/A && %HealTime > #SCNT && %StrTimer < #SCNT || %StrTimer = N/A { While %HealTime > #SCNT { GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30 } } if %HealTime < #SCNT || %HealTime = N/A && %StrPot = #True { GoSub RefreshStrengthPotion } if %AutoFeed <> #False && %FoodTimer < #SCNT || %FoodTimer = N/A { GoSub EatFood } UseMP: set #LOBJECTID %Mortar Event Macro 17 0 Set %CursTimer #SCNT + 5 While #TArgCurs <> 1 { GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30 If %CursTimer < #SCNT { GoTo UseMP } } set #LTARGETID %RTGID Event Macro 22 0 Set %GumpTimer #SCNT + 5 While #contName <> objpicker_gump { if %GumpTimer < #SCNT { goto UseMP } GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30 } Click %P_X %P_Y dmc d f Set %GumpTimer #SCNT + 5 While #contName <> Stringquery_gump { if %GumpTimer < #SCNT { goto UseMP } GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30 } Click 200 244 dmc d f msg 30 $ set !lpc #lpc set #lpc 500 set %pjrnl #jindex set %break #false While %break <> #true { If #menubutton <> N/A { set #lpc !lpc set %break #true } if #jindex > %pjrnl { set %pjrnl %pjrnl + 1 scanjournal %pjrnl if with_no_bottles,_you_are_forced_to_store in #journal { set #lpc !lpc set %break #true GoSub PlaySound %JobSound %JobPath set #menubutton StopNormPotions } if You_stop_grinding_reagents in #journal { set #lpc !lpc set %break #true } if The_mixture_sends_out_a_shocking_gas in #journal { gosub CheckUp set #lpc !lpc set %break #true } if The_mixture_explodes in #journal { gosub CheckUp set #lpc !lpc set %break #true } if #menubutton = StopNormPotions { set #lpc !lpc set %break #true } if #Hits < #MaxHits || C in #CharStatus { gosub CheckUp } } if #Hits < #MaxHits || C in #CharStatus { gosub CheckUp } } } return Sub DeterminePotionTypes set !lpc #lpc set #lpc 30 if %1 = RZF { GoSub AddPotionButtons NightSight , #spc , Potion Lesser , #spc , Wisdom , #spc , Potion Normal , #spc , Wisdom , #spc , potion Greater , #spc , Wisdom , #spc , Potion menu Set RegCost1 3 menu Set RegCost2 1 menu Set RegCost3 3 menu Set RegCost4 7 } if %1 = KUF { GoSub AddPotionButtons Refresh , #spc , Potion Full , #spc , Refresh , #spc , Potion menu Set RegCost1 1 menu Set RegCost2 9 } if %1 = JZF { GoSub AddPotionButtons Lesser , #spc , Heal , #spc , Potion Normal , #spc , Heal , #spc , Potion Greater , #spc , Heal , #spc , Potion menu Set RegCost1 1 menu Set RegCost2 4 menu Set RegCost3 9 } if %1 = JUF { GoSub AddPotionButtons Lesser , #spc , Agility , #spc , Potion Normal , #spc , Agility , #spc , Potion Greater , #spc , Agility , #spc , Potion menu Set RegCost1 1 menu Set RegCost2 3 menu Set RegCost3 9 } if %1 = KZF { GoSub AddPotionButtons Lesser , #spc , Cure , #spc , Potion Normal , #spc , Cure , #spc , Potion Greater , #spc , Cure , #spc , Potion menu Set RegCost1 1 menu Set RegCost2 4 menu Set RegCost3 9 } if %1 = MZF { GoSub AddPotionButtons Lesser , #spc , Strength , #spc , Potion Normal , #spc , Strength , #spc , Potion Greater , #spc , Strength , #spc , Potion menu Set RegCost1 1 menu Set RegCost2 3 menu Set RegCost3 7 } if %1 = WZF { GoSub AddPotionButtons Lesser , #spc , Poison , #spc , Potion Normal , #spc , Poison , #spc , Potion Greater , #spc , Poison , #spc , Potion menu Set RegCost1 1 menu Set RegCost2 4 menu Set RegCost3 12 } if %1 = SZF { GoSub AddPotionButtons Lesser , #spc , Explosion , #spc , potion Normal , #spc , Explosion , #spc , Potion Greater , #spc , Explosion , #spc , Potion menu Set RegCost1 3 menu Set RegCost2 6 menu Set RegCost3 20 } GoSub PotionCount %1 return Sub AddPotionButtons if %0 = 3 Set %llength 81 if %0 = 4 Set %llength 103 Set !lpc #lpc Set #lpc 30 menu Clear menu Font Color Yellow menu Window Title Normal Potion menu Font BGColor Yellow menu Font BGColor Black menu Window Color Black menu Button NormRegSelection 40 10 20 20 _ menu Button BackButton 5 5 20 30 < menu Window Size 213 190 menu Font Transparent #true menu Font Name MS Sans Serif menu Font Size 8 menu Font Style menu Font Align Center menu Window Transparent 80 menu Text NormReagentText 65 13 %name for %AB 1 %0 { set %LMulti %AB - 1 set %LineY 65 + ( 23 * ( %LMulti % 10 ) ) menu button NP . %AB 5 %LineY 19 20 * menu Shape Line 5 %LineY 203 20 3 7 1 $111111 7 $111111 Set %TextLine %LineY + 3 menu Text PotName . %AB 28 %TextLine % . %AB menu Text RegCost . %AB 175 %TextLine #spc } menu Text RegCostHeader 28 50 Potion Name menu Text RegCostHeader 155 50 Reg Req. menu Shape Line 150 50 2 %llength 3 7 1 yellow 7 yellow ;menu Text PotionCntHeader 208 50 Potion Cnt. menu Shape Line 203 50 2 %llength 3 7 1 yellow 7 yellow Set #LPC !LPC return Sub DetermineReagentCounts set !lpc #lpc set #lpc 30 if %1 = RZF { if %2 = 1 { Set %RN 3 } if %2 = 2 { Set %RN 1 } if %2 = 3 { Set %RN 3 } if %2 = 4 { Set %RN 7 } } if %1 = KUF { if %2 = 1 { Set %RN 1 } if %2 = 2 { Set %RN 9 } } if %1 = JZF { if %2 = 1 { Set %RN 1 } if %2 = 2 { Set %RN 4 } if %2 = 3 { Set %RN 9 } } if %1 = JUF { if %2 = 1 { Set %RN 1 } if %2 = 2 { Set %RN 3 } if %2 = 3 { Set %RN 9 } } if %1 = KZF { if %2 = 1 { Set %RN 1 } if %2 = 2 { Set %RN 4 } if %2 = 3 { Set %RN 9 } } if %1 = MZF { if %2 = 1 { Set %RN 1 } if %2 = 2 { Set %RN 3 } if %2 = 3 { Set %RN 7 } } if %1 = WZF { if %2 = 1 { Set %RN 1 } if %2 = 2 { Set %RN 4 } if %2 = 3 { Set %RN 12 } } if %1 = SZF { if %2 = 1 { Set %RN 3 } if %2 = 2 { Set %RN 6 } if %2 = 3 { Set %RN 20 } } set %Potion %2 - 1 set %P_X 55 + ( 49 * ( %Potion % 4 ) ) set %P_Y 65 set #lpc !lpc return ;=================================================== ; Subs Name: Special Potion Making Subs ; Author: Callum O'Lyre ; Purpose: These Subs are for use on Pangaea when macroing up some special potion types ;==================================================== sub ReagentSelection { Set %VarName %1 GoSub SendSysMessage Normal Select_your_reagent_type set #targcurs 1 while #targcurs = 1 wait 1 set % . %VarName #LTARGETID return } sub BeginAlchemization While #True { if %HealTime <> N/A && %HealTime > #SCNT && %StrTimer < #SCNT || %StrTimer = N/A { While %HealTime > #SCNT { GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30 } } if %HealTime < #SCNT || %HealTime = N/A && %StrPot = #True { GoSub RefreshStrengthPotion } if %AutoFeed <> #False && %FoodTimer < #SCNT || %FoodTimer = N/A { GoSub EatFood } gosub CycleThroughReagents GoSub ToWait SCNT2 1 gosub CheckUp GoSub ToWait SCNT2 1 if #menubutton = stop { GoSub ListenToTheButtons } } sub CycleThroughReagents FindItem WUF C For #FindIndex 1 #FindCNT { if #FindCol = 0 { Set %EmptyBottles #FindID } } If %EmptyBottles = N/A { GoSub SendSysMessage Warning You_Have_No_Empty_Bottles_in_Your_Pack! GoSub PlaySound %JobSound %JobPath set #menubutton stop GoSub ListenToTheButtons } for %ReagCounter 1 10 { if %ReagentType . %ReagCounter <> N/A { finditem %ReagentType . %ReagCounter if #FINDCNT = 0 { GoSub SendSysMessage Warning You_are_out_of_the_number_ , %ReagCounter , _ingredient. GoSub PlaySound %JobSound %JobPath set #menubutton stop GoSub ListenToTheButtons } } } GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30 Set #LOBJECTID %EmptyBottles Event Macro 17 0 for %Counter 1 10 { if %ReagentType . %Counter <> N/A { gosub CheckReagentTargetCursor set #ltargetid %ReagentType . %Counter event macro 22 0 } else { gosub CheckReagentTargetCursor key ESC return } } sub CheckReagentTargetCursor while #targcurs <> 1 { GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30 } return ;=================================================== ; Subs Name: Tile Charging Subs ; Author: Callum O'Lyre ; Purpose: These Subs are for use on Pangaea for charging Alchemical Symbols which are ; then used by scribes to make wands ;==================================================== Sub TileTypeSetup if %1 = 0 { GoSub SendSysMessage Warning You_need_to_select_a_wand_type_before_continuing.. GoSub ShowTileChargerMenu GoSub ListenToTheButtons } if %1 = 1 { ;Blessing set %TileType JGJ set %GemType OVF } if %1 = 2 { ;Daemons set %TileType ZFJ set %GemType HVF } if %1 = 3 { ;Firewall set %TileType UGJ set %GemType GVF } if %1 = 4 { ;Healing set %TileType OGJ set %GemType RVF } if %1 = 5 { ;Hellfire set %TileType BGJ set %GemType MWF } if %1 = 6 { ;Life set %TileType KGJ set %GemType GVF } if %1 = 7 { ;Lightning set %TileType CGJ set %GemType FVF } if %1 = 8 { ;Magic Resist set %TileType HGJ set %GemType FVF } if %1 = 9 { ;Meteor set %TileType LGJ set %GemType NNN } if %1 = 10 { ;Protection set %TileType NGJ set %GemType BVF } if %1 = 11 { ;Venom set %TileType IGJ set %GemType EVF } return ;GoSub ChargeTile %TileType %GemType Sub ChargeTile Set %TileType %1 Set %GemType %2 while #True { if %AutoFeed <> #False && %FoodTimer < #SCNT || %FoodTimer = N/A { GoSub EatFood } GoSub ToWait SCNT2 3 GoSub TargetTile GoSub ToWait SCNT2 3 GoSub TargetGem GoSub ToWait SCNT2 3 if #menubutton = StopTileCharging { return } } Return Sub TargetGem FindItem %GemType C if #FindCNT > 0 { Set #LTARGETID #FINDID GoSub CheckReagentTargetCursor Event Macro 22 0 } else { GoSub SendSysMessage Warning You_are_out_of_gems. GoSub PlaySound %JobSound %JobPath GoSub ShowTileChargerMenu Set #menubutton N/A GoSub ListenToTheButtons } return Sub TargetTile FindItem %TileType C if #FindCNT > 0 { Set #LOBJECTID %Mortar Event Macro 17 0 Set #LTARGETID #FINDID GoSub CheckReagentTargetCursor Event Macro 22 0 IgnoreItem #LTARGETID } else { GoSub SendSysMessage Warning You_are_out_of_tiles. key esc GoSub PlaySound %JobSound %JobPath GoSub ShowTileChargerMenu Set #menubutton N/A GoSub ListenToTheButtons } Return ;=================================================== ; Subs Name: Shared Subs Between Them ; Author: Callum O'Lyre ; Purpose: These Subs are used by the three different sections of this script. ;==================================================== sub CheckUp Set %BreakHPC #False While %BreakHPC = #False { GoSub ToWait SCNT 1 if #charGhost = yes { Event Macro 6 0 While #charGhost = yes { GoSub PlaySound %DeathSound %DeathPath wait 5s } } if %HealTime < #SCNT || %HealTime = N/A { if C in #charstatus { event macro 1 0 .Use AnyCure set %HealTime #SCNT + 15 } if #Hits < #MaxHits { Event Macro 1 0 .Use AnyHeal set %HealTime #SCNT + 15 } } Set %HPP ABS ( ( #HITS * 100 ) / #MAXHITS ) ) if %HPP > %HealTo && C notin #charstatus { Set %BreakHPC #True } } GoSub ToWait SCNT 1 return Sub RefreshStrengthPotion if %StrTimer < #SCNT || %StrTimer = N/A { GoSub UsePotion 906 905 904 Strength if #Result = 1 { Set %StrTimer #SCNT + 900 } if #Result = 2 { Set %StrTimer #SCNT + 600 } if #Result = 3 { Set %StrTimer #SCNT + 300 } } return sub ItemProps finditem #ltargetid event property #findid GoSub ToWait SCNT2 1 str pos #property $ set %tmp #strres - 1 str left #property %tmp set %name #strres if #findstack > 1 { str len #findstack set %tmp #strres + 1 str del %name 1 %tmp set %name #strres } return ;GoSub PlaySound Sub PlaySound if %1 <> #False { Sound %2 } return ;======================================== ; Script Name: Improved Wait ; Author: Callum O'Lyre ; Version: 2.0 ; Client Tested with: 5.0.9.1 ; Shard OSI / FS: Pangaea ; Public Release: 08-09-2013 ; Revision Date: 08-09-2013 ; Purpose: Allows for waits in which you can scan for Save world States thanks to CEO, ; other checks can also be added but for right now only SWS's are in place. ; Params: ; %1 = SCNT or SCNT2 ; %2 = Integer to wait ;========================================= Sub ToWait set %Func %1 set %Delay %2 set %TTW # . %Func + %Delay While %TTW > # . %Func { GoSub CEOWorldSaveChecker 10_seconds Saving_World_State Carry_on,_then 8 30 } return Sub SendSysMessage if %1 = Warning Set %TC 1939 if %1 = Normal Set %TC 2984 SET %lpc #LPC linesPerCycle 500 SET %st 1 SET %str %2 STR LEN _ SET %findlen #STRRES STR LEN #SPC SET %replen #STRRES STR LEN %str SET %len #STRRES clean: FOR %i %st %len { STR MID %str %i %findlen SET %find #STRRES IF %find = _ { STR DEL %str %i %findlen SET %str #STRRES IF #SPC <> _BLANK_ { STR INS %str #SPC %i SET %str #STRRES SET %st %st + %findlen STR LEN %str SET %len #STRRES GOTO clean } else { STR LEN %str SET %len #STRRES SET %st %i GOTO clean } } else { SET %st %st + 1 } } set #sysmsgcol %TC Event SysMessage %str set #sysmsgcol 0 linesPerCycle %lpc RETURN ;GoSub UsePotion ;============================= ; Potion Color Table ; The list order is potion type ; then next to it the potion colors ; for each potion strength. Ex: ; Mana Regen : 2974/2989/2088 ;============================= ; Normal Potions ;============================= ; Agility : 1328/1331/1334 ; Cure : 46/45/44 ; Explosion : 625/624/125 ; Heal : 356/354/2125 ; Poison : 1419/1422/1425 ; Strength : 904/905/906 ; Wisdom : 1375/1374/1373 ; Nightsight : 1109 ; Refresh : 1642/1635 ;============================= ; Custom Potions ;============================= ; Deadly Poison : 2060 ; Equalizer : 1967 ; Magic Reflect : 2027 ; Paralyze : 1957 ; Plague : 2071 ; Paralyze Protection : 1998 ; Holy Water : 1953 ; Clumsy : 2033/2087/2988 ; Flashbang : 2058/1155/1992 ; Incognito : 2984/1947/2050 ; Invisibility : 2048/2053/2051 ; Mana Regen : 2974/2989/2088 ; Mana Vampire : 2020/1941/2060 ; Poison Shield : 2054/2032/2094 ; Protection : 1995/2098/2070 ; Reactive Armor : 2037/2988/2074 ; Regeneration : 1945/1948/2021 ; Shockwave : 1959/1914/2083 ; TrueSight : 288/286/285 ; Weaken : 856/855/854 ;============================= Sub UsePotion Set %PotName %4 Set %Ct %0 - 1 For %Col 1 %Ct { FindItem WUF C For #FindIndex 1 #FindCnt { event Property #FindID if #FindCol = % . %Col && %PotName in #Property { Set #LObjectID #FindID Event Macro 17 0 GoSub ToWait scnt2 5 set %HealTime #SCNT + 15 return %Col } } } GoSub ToWait scnt2 5 return ;======================================== ; Script Name: Red Warrior Needs Food Badly ; Author: Callum O'Lyre ; Version: 1.5 ; Client Tested with: 5.0.9.1 ; Shard OSI / FS: Pangaea ; Public Release: 23-05-2012 ; Revision Date: 29-05-2012 ; Purpose: Automatically feeds your character ;========================================= Sub EatFood set !lpc #lpc set #lpc 50 set %fjrnl #jindex While #True { if #jindex > %fjrnl { set %fjrnl %fjrnl + 1 scanjournal %fjrnl if You're_stuffed! in #journal || You_cannot_eat_anymore in #journal { set #lpc !lpc set %FoodTimer #SCNT + 1200 GoSub ToWait scnt2 5 return } } FindItem %FoodTypes C if #FindCNT < 1 { GoSub SendSysMessage Warning You_are_out_of_Food. set %FoodTimer #SCNT + 1200 set #lpc !lpc return } if %EatTimer < #SCNT || %EatTimer = N/A { Set #LOBJECTID #FindID Event Macro 17 0 set %EatTimer #SCNT + 2 } } ;Currently GetSettings and SaveSettings do nothing! ;Gearing up for a change though Sub GetSettings Set %DeathSound #True Set %DeathPath Death.wav Set %JobSound #True Set %JobPath JobDone.wav Set %AutoFeed #True Set %StrPot #False Set %HealTo 67 gosub getGlobalVar 45 FarjadAlchemy #charid DeathSound NOLOCK gosub getGlobalVar 45 FarjadAlchemy #charid DeathPath NOLOCK gosub getGlobalVar 45 FarjadAlchemy #charid JobSound NOLOCK gosub getGlobalVar 45 FarjadAlchemy #charid JobPath NOLOCK gosub getGlobalVar 45 FarjadAlchemy #charid AutoFeed NOLOCK gosub getGlobalVar 45 FarjadAlchemy #charid StrPot NOLOCK gosub getGlobalVar 45 FarjadAlchemy #charid HealTo NOLOCK return Sub ResetSettings menu List Add DefaultBox Resetting back to default gosub delGlobalVar 45 FarjadAlchemy #charid DeathSound gosub delGlobalVar 45 FarjadAlchemy #charid DeathPath gosub delGlobalVar 45 FarjadAlchemy #charid JobSound gosub delGlobalVar 45 FarjadAlchemy #charid JobPath gosub delGlobalVar 45 FarjadAlchemy #charid AutoFeed gosub delGlobalVar 45 FarjadAlchemy #charid StrPot gosub delGlobalVar 45 FarjadAlchemy #charid HealTo GoSub GetSettings Set %lpc #lpc Set #lpc 60 menu Set DeathSoundCheckBox %DeathSound menu Set JobSoundCheckBox %JobSound menu Set AutoFeedCheckBox %AutoFeed menu Set StrengthPotionCheckBox %StrPot menu Set DeathSoundPath %DeathSound menu Set JobSoundPath %JobSound menu Set HealToEditBox %HealTo menu List Add DefaultBox Settings are now their default Set #lpc %lpc return Sub SaveSettings menu Get DeathSoundCheckBox if #menuRes <> %DeathSound { menu List Add DefaultBox Saving Death Sound Toggle Set %DeathSound #menuRes gosub putGlobalVar 45 FarjadAlchemy #charid DeathSound } menu Get DeathSoundPath if #menuRes <> %DeathPath { menu List Add DefaultBox Saving Death Sound Path Set %DeathPath #menuRes gosub putGlobalVar 45 FarjadAlchemy #charid DeathPath } menu Get JobSoundCheckBox if #menuRes <> %JobSound { menu List Add DefaultBox Saving Job Sound Toggle Set %JobSound #menuRes gosub putGlobalVar 45 FarjadAlchemy #charid JobSound } menu Get JobSoundPath if #menuRes <> %JobPath { menu List Add DefaultBox Saving Job Sound Path Set %JobPath #menuRes gosub putGlobalVar 45 FarjadAlchemy #charid JobPath } menu Get AutoFeedCheckBox if #menuRes <> %AutoFeed { menu List Add DefaultBox Saving Auto Feeder Toggle Set %AutoFeed #menuRes gosub putGlobalVar 45 FarjadAlchemy #charid AutoFeed } menu Get StrengthPotionCheckBox if #menuRes <> %StrPot { menu List Add DefaultBox Saving Strength Potion Toggle Set %StrPot #menuRes gosub putGlobalVar 45 FarjadAlchemy #charid StrPot } menu GetNum HealToEditBox if #menuRes <> %HealTo { menu List Add DefaultBox Saving Heal Percentage Setting Set %HealTo #menuRes if %HealTo > 100 Set %HealTo 100 if %HealTo < 1 Set %HealTo 1 gosub putGlobalVar 45 FarjadAlchemy #charid HealTo } GoSub GetSettings return ;=================================================== ; Sub Name: Menu Subs ; Author: Callum O'Lyre ; Purpose: The building of menus that the script uses at various times, this section also includes the button listener sub. ;--------------------- ;Subs: InitialAlchemyMenu, NormalPotionMakingMenu, ShowSpecialPotionMakingMenu, ShowTileChargerMenu, ListenToTheButtons ;==================================================== Sub InitialAlchemyMenu GoSub GetSettings menu Clear menu Window Title Farjad's Lab menu Window Size 250 180 menu window color Black menu font bgcolor Black menu Font Transparent #true menu Font Align Right menu Font Name MS Sans Serif menu Font Size 8 menu Font Style menu Font Color yellow menu Font Transparent #false menu Font Align center menu Text EUOLabel1 5 5 What are you looking to do my friend? menu Button GrindHouseButton 5 25 240 30 Grindhouse menu Button NormalPotionMaking 5 65 240 30 Normal Potion Brewing menu Button SpecialPotionMaking 5 105 240 30 Special Potion Brewing menu Button TileCharging 5 145 240 30 Tile Charging menu Button SettingsButton 224 2 20 20 S Set #menubutton N/A menu Window Transparent 100 menu Show return Sub BuildSettingsMenu menu Shape SettingsBox 260 5 249 214 3 7 1 Yellow 7 None menu Font Name MS Sans Serif menu Font Size 8 menu Font Style menu Font Color Yellow menu Font Transparent #false menu Font Align Center menu Font BGColor Black menu Font Align Left menu Text SettingsTitle 268 -1 Settings menu Font Transparent #true menu List Create DefaultBox 5 180 240 65 menu Text DeathSoundTitle 264 92 Where is your Death Sound located? menu Text JobSoundTitle 264 132 Where is your Job's Done Sound Located? menu Text HealToText 264 176 At what health should I return to making potions? menu Check DeathSoundCheckBox 264 12 109 17 %DeathSound On Death Sound? menu Check JobSoundCheckBox 264 32 113 17 %JobSound Job's Done Sound? menu Check AutoFeedCheckBox 264 52 150 17 %AutoFeed Auto Feed Me? menu Check StrengthPotionCheckBox 264 72 130 17 %StrPot Use Strength Potions? menu Edit DeathSoundPath 264 108 121 %DeathPath menu Edit JobSoundPath 264 148 121 %JobPath menu Edit HealToEditBox 264 192 121 %HealTo menu Button SaveSettingsButton 260 220 122 25 Save Settings menu Button ResetSettingsButton 388 220 122 25 Reset Button menu Window Size 515 250 return ;Normal Potion Brewing Menu Sub NormalPotionMakingMenu Set %NormalPotionMakingMenu #True menu Clear menu Window Title Normal Potion menu Window Color Black menu Window Size 200 50 menu Font Transparent #true menu Font Name MS Sans Serif menu Font Size 8 menu Font Style menu Font Color Yellow menu Font Align center menu Text NormReagentText 65 13 Select Reagent Type! menu Font BGColor Yellow menu Font BGColor Black menu Button NormRegSelection 40 10 20 20 _ menu Button BackButton 5 5 20 30 < menu Show return ;Special Potion Making Menu Sub ShowSpecialPotionMakingMenu set !lpc #lpc set #lpc 300 menu clear menu Window Title Farjad's Potion Brewer menu window size 230 328 menu show menu window color Black menu font bgcolor Black menu Font Color Yellow menu font size 10 menu Font Transparent #true menu Text Title 55 5 Farjad's Potion Mixer for %LN 1 10 { set %LMulti %LN - 1 set %LineY 35 + ( 23 * ( %LMulti % 10 ) ) menu button %LN 5 %LineY 19 20 %LN menu Shape Line 5 %LineY 220 20 3 7 1 $111111 7 $111111 } for %TN 1 10 { set %TMulti %TN - 1 set %TextY 36 + ( 23 * ( %TMulti % 10 ) ) menu Text Reg . %TN 30 %TextY #SPC } menu button BeginSpecialPotionMakingButton 5 298 220 25 Start menu button ResetAllValues 5 270 220 25 Reset All Values menu button BackButton 5 5 19 20 < if %RecipeVerification = #True { menu button RecipeButton 206 5 19 20 R } menu Window Transparent 80 menu Show set #lpc !lpc return ;Tile Charger Menu Sub ShowTileChargerMenu menu Clear menu Window Title Farjad's Tile Supercharger menu Window Color Black menu Window Size 210 109 menu Font Transparent #true menu Font Align Right menu Font Name MS Sans Serif menu Font Size 8 menu Font Style menu Font Color WindowText menu Font Transparent #false menu Font Align Left menu Font BGColor Black menu Font Color Yellow menu Text WandTypeText 4 28 What Type of Wand do you wish to make? menu Combo Create WandType 4 50 201 menu Combo Add WandType Wand of Blessing menu Combo Add WandType Wand of Daemons menu Combo Add WandType Wand of Firewall menu Combo Add WandType Wand of Healing menu Combo Add WandType Wand of Hellfire menu Combo Add WandType Wand of Life menu Combo Add WandType Wand of Lightning menu Combo Add WandType Wand of Magic Reflection menu Combo Add WandType Wand of Meteors menu Combo Add WandType Wand of Protection menu Combo Add WandType Wand of Venom menu Combo Select WandType 1 menu Font Size 10 menu Button BeginTileCharging 4 80 203 25 Start menu button BackButton 4 4 19 19 < menu Font Size 8 menu Window Transparent 100 menu Show return sub GrinderMenu Set %RegType N/A Set %NormalPotionMakingMenu #False menu Clear menu Window Title Grindhouse menu Window Color Black menu Window Size 210 120 menu Font Transparent #true menu Font Align Right menu Font Name MS Sans Serif menu Font Size 8 menu Font Style menu Font Color Yellow menu Font Align Left menu Text NormReagentText 62 32 Select Reagent Type! menu Font BGColor Yellow menu Font BGColor Black menu Button NormRegSelection 37 29 20 20 _ menu Button BackButton 5 5 20 20 < menu Button StartGrindHouse 36 78 145 21 Start menu Show return Sub ListenToTheButtons while #true { while #menubutton = N/A { } ;Selection Menu Buttons if #menuButton = SettingsButton { Set !lpc #lpc Set #lpc 60 if %Expanded <> #True { GoSub BuildSettingsMenu Set %Expanded #True } else { GoSub InitialAlchemyMenu Set %Expanded #False } Set #lpc !lpc Set #menubutton N/A } if #menubutton = ResetSettingsButton { GoSub ResetSettings Set #menubutton N/A } if #menubutton = SaveSettingsButton { GoSub SaveSettings Set #menubutton N/A } if #menuButton = NormalPotionMaking { GoSub NormalPotionMakingMenu Set #menubutton N/A } if #menuButton = SpecialPotionMaking { GoSub ShowSpecialPotionMakingMenu Set #menubutton N/A } if #menubutton = TileCharging { GoSub ShowTileChargerMenu Set #menubutton N/A } if #menubutton = GrindHouseButton { Gosub GrinderMenu Set #menubutton N/A } ;GrindHouse Buttons if #menubutton = StartGrindHouse { menu Delete NormalRegSelection menu Delete StartGrindHouse menu Delete BackButton menu Button StopGrindHouse 36 78 145 21 Stop Set #menubutton N/A GoSub GrindHouse %ReagentToGrindType } if #menubutton = StopGrindHouse { menu Delete StopGrindHouse menu Button NormRegSelection 37 29 20 20 _ menu Button BackButton 5 5 20 20 < menu Button StartGrindHouse 36 78 145 21 Start Set #menubutton N/A } ;Normal Potion Making Buttons If #MenuButton = NP1 { for %i 1 4 { menu delete NP . %i } Set #menubutton N/A menu Button StopNormPotions 5 165 205 20 Stop menu Delete BackButton GoSub BeginNormalPotionMakingProcess %ReagentToGrindType %ReagentToGrindID 1 } If #MenuButton = NP2 { for %i 1 4 { menu delete NP . %i } Set #menubutton N/A menu Button StopNormPotions 5 165 205 20 Stop menu Delete BackButton GoSub BeginNormalPotionMakingProcess %ReagentToGrindType %ReagentToGrindID 2 } If #MenuButton = NP3 { for %i 1 4 { menu delete NP . %i } Set #menubutton N/A menu Button StopNormPotions 5 165 205 20 Stop menu Delete BackButton GoSub BeginNormalPotionMakingProcess %ReagentToGrindType %ReagentToGrindID 3 } If #MenuButton = NP4 { for %i 1 4 { menu delete NP . %i } Set #menubutton N/A menu Button StopNormPotions 5 165 205 20 Stop menu Delete BackButton GoSub BeginNormalPotionMakingProcess %ReagentToGrindType %ReagentToGrindID 4 } if #menubutton = StopNormPotions { menu Delete StopNormPotions menu Button NormRegSelection 37 29 20 20 _ menu Button BackButton 5 5 20 20 < GoSub DeterminePotionTypes %ReagentToGrindType Set #menubutton N/A } ;Special Potion Brewing Buttons if #menubutton >= 1 && #menubutton <= 10 { gosub ReagentSelection ReagentType , #menubutton gosub ItemProps menu Set Reg . #menubutton %name Set #menubutton N/A } if #menubutton = ResetAllValues { for %TN 1 10 { set %TMulti %TN - 1 set %TextY 36 + ( 23 * ( %TMulti % 10 ) ) set %ReagentType . %TN N/A menu Delete Reg . %TN menu Text Reg . %TN 30 %TextY #SPC } GoSub SendSysMessage Normal All_values_reset! Set #menubutton N/A } if #menubutton = BeginSpecialPotionMakingButton { for %DB 1 10 { menu Delete %DB } menu Delete RecipeButton menu Delete BackButton menu Delete BeginSpecialPotionMakingButton menu Delete ResetAllValues menu button Stop 5 298 220 25 Stop Set #menubutton N/A gosub BeginAlchemization } if #menubutton = stop { menu Delete Stop for %LN 1 10 { set %LMulti %LN - 1 set %LineY 35 + ( 23 * ( %LMulti % 10 ) ) menu button %LN 5 %LineY 19 20 %LN } if %RecipeVerification = #True { menu button RecipeButton 206 5 19 19 R } menu button BackButton 5 5 19 19 < menu button BeginSpecialPotionMakingButton 5 298 220 25 Start menu button ResetAllValues 5 270 220 25 Reset All Values Set #menubutton N/A } if #menubutton = RecipeButton { if %RecipesExtended <> #True { set %RecipesExtended #True menu Window Size 460 328 call PotionRecipes.txt GetRecipeTable Set #menubutton N/A } else { set %RecipesExtended #False menu Delete RecipeList menu Window Size 230 328 Set #menubutton N/A } } ;Tile Charging Buttons and Dropdown stuff if #menubutton = BeginTileCharging { Set #menubutton N/A menu Get WandType GoSub TileTypeSetup #menuRes menu Delete StartTileCharging menu Button StopTileCharging 4 80 203 25 Stop GoSub ChargeTile %TileType %GemType } if #menubutton = StopTileCharging { Set #menubutton N/A GoSub ShowTileChargerMenu } ;Shared Buttons if #menubutton = closed 1 { halt } if #menubutton = BackButton { for %RTD 1 10 { set %ReagentType . %RTD N/A } set %NormalPotionMakingMenu #False GoSub InitialAlchemyMenu Set #menubutton N/A } if #menubutton = NormRegSelection { gosub ReagentSelection ReagentTarget finditem %ReagentTarget set %ReagentToGrindID %ReagentTarget Set %ReagentToGrindType #FindType gosub ItemProps if %NormalPotionMakingMenu = #True GoSub DeterminePotionTypes %ReagentToGrindType else menu Set NormReagentText %name Set #menubutton N/A } } ;----------------------------------------------------------- ; Script Name: CEOWorldSaveChecker ; Author: CEO ; Version: 1.0 ; Client Tested with: 4.0.10b ; EUO version tested with: 1.42.00A5 ; Shard OSI / FS: OSI ; Revision Date: 060105 ; Public Release: 060105 ; Global Variables Used: *CEOWorldSaving ; Purpose: Used to catch the world save message for freeshards and temporarily pause mainscript during save. ; Link : http://www.easyuo.com/forum/viewtopic.php?p=3585#3585 ;------------------------------------------------------------- sub CEOWorldSaveChecker ; sub to pause a script during a RunUO world save. set %_text1 %1 set %_text2 %2 set %_text3 %3 if %_worldsaveupcoming { if %_worldsavetimer < #scnt { set %_worldsavetimer #scnt + %5 gosub popupworldsave 5 270 blue goto _WSC_WAIT1 } return } _WSC1: if %_worldsavejournalindex > #jindex return scanjournal %_worldsavejournalindex if %_text1 in #journal { set %_worldsaveupcoming #true set %_worldsavetimer #scnt + %4 set %_worldsavejournalindex %_worldsavejournalindex + 1 return } set %_worldsavejournalindex %_worldsavejournalindex + 1 goto _WSC1 _WSC_WAIT1: if %_worldsavetimer < #scnt goto _WSC_Complete wait 5 set *CEOWorldSaving #true if %_worldsavejournalindex > #jindex goto _WSC_WAIT1 scanjournal %_worldsavejournalindex if %_text2 in #journal { gosub popupworldsave 5 270 yellow set %_worldsavejournalindex %_worldsavejournalindex + 1 goto _WSC_WAIT2 } set %_worldsavejournalindex %_worldsavejournalindex + 1 goto _WSC_WAIT1 _WSC_WAIT2: if %_worldsavetimer < #scnt goto _WSC_Complete wait 5 if %_worldsavejournalindex > #jindex goto _WSC_WAIT2 scanjournal %_worldsavejournalindex if %_text3 notin #journal { set %_worldsavejournalindex %_worldsavejournalindex + 1 goto _WSC_WAIT2 } _WSC_Complete: set %_worldsavejournalindex #jindex set %_worldsaveupcoming #false set *CEOWorldSaving #false menu delete worldsave return sub popupworldsave set %x %1 set %y %2 set %worldcolor %3 menu shape worldsave %x %y 25 25 1 7 2 yellow 7 %worldcolor menu font bgcolor black menu font color yellow menu font type b menu font size 10 set %x %x + 30 set %y %y + 5 menu text worldsave %x %y World Save State menu font size 10 menu font bgcolor black menu font color yellow menu font type n return ;================================== ; Script Name: CEO*FileSystem (pseudo filesystem) ; Author: CEO ; Version: 1.1 ; Client Tested with: 4.0.1b ; EUO version tested with: 1_41_103 ; Shard OSI / FS: OSI ; Revision Date: 040219 ; Public Release: 040219 ; Globals Used: User specified (2 total) ; Purpose: Allows you to use a * variable as a pseudo-filesystem ; Link: http://www.easyuo.com/forum/viewtopic.php?p=3585#3585 ;======================================= ; CEO's global variable management subs: ; getGlobalVar . putGlobalVar . delGlobalVar ;======================================= ; ;ver 1.1 ;changed the lock file to use *variablename_lock so it'll work with any named *variable ; Sub getGlobalVar ;ver 1.0 posted 19Feb04 by CEO ;purpose: Allows you to store multiple variables in one global variable unique to ; each player and script. getGlobaVar retrieves a value from a global variable. ;@returns: #result = #false if variable not found, #true if found ; % . %3 contains variable value ;%1 is the global/persistant variable to use ( %1 + 1 is used for locking) ;%2 is the script identifer or pseudo filename ;%3 is #charid or pseudo filename ;%4 is the variable to search for and return in %. %3 ;%5 is for lock control. By default getGlobalVar uses a lock to return a value. In some cases you may want to ; retrieve a variable (mostly for speed) without needing a lock as long as you are aware of ; any potentional conflicts, that very rarely may occur. Set this param to NOLOCK to access ; global storage without a lock. ;sample usage: ; gosub getGlobalVar 50 MyScript #charid backpackid ; Using global var *50 finds the variable labeled MyScript#charidbackpackid and returns it in %backpackid ; ; gosub getGlobalVar 50 MyScript #charid clothstat NOLOCK ; Using global var *50 find the variable labeled MyScript#charidclothstat and returns it in %clothstat without using a lock ; Warning: do not use *1000. * %1 + 1 is used for locking and there is no *1001! nameSpace push nameSpace local #systime , _ , %2 , _ , %3 , _ , %4 , _ , GET set !lpc #lpc set #lpc 1000 set !lock %1 , _lock if ( %0 = 5 ) && ( %5 = NOLOCK ) goto getGlobalVar_skiplock set !lockcount 0 getGlobalVar_waitforlock: if * . !lock <> N/A && * . !lock <> #nsname { wait 1 4 set !lockcount !lockcount + 1 if !lockcount < 10 goto getGlobalVar_waitforlock if * . !lock <> N/A { set !currentlock * . !lock if !currentlock = N/A goto getGlobalVar_waitforlock str pos !currentlock _ set !strres #strres - 1 str left !currentlock !strres set !systime #systime - #strres if !systime < 10000 ; if over 10 seconds assume a broken lock and take it { set !lockcount 0 goto getGlobalVar_waitforlock } } } set * . !lock #nsname wait 3 2 if * . !lock <> #nsname { set !lockcount 0 goto getGlobalVar_waitforlock } getGlobalVar_skiplock: set !global * . %1 set !varName %2 , ^ , %3 , ^ , %4 , | str pos !global !varName set #result #strres <> 0 if #result { set !varNamePos #strres str len !varName set !delString !varNamePos + #strres - 1 str del !global 1 !delString set !global #strres str pos !global | set !varNamePos #strres - 1 str left !global !varNamePos set % . %4 #strres } if ( %0 < 5 || %5 <> NOLOCK ) && * . !lock = #nsname set * . !lock N/A set #lpc !lpc nameSpace Clear nameSpace Pop return #result Sub putGlobalVar ;ver 1.0 posted 19Feb04 by CEO ;purpose: Allows you to store multiple variables in one global variable unique to ; each player and script. putGlobaVar stores a value into a global variable. ;@returns: #result = #false if variable not found, #true if found ; % . %3 contains variable ;%1 is the global/persistant variable to use ;%2 is the script identifer or pseudo filename ;%3 #charid or other identifier ;%4 is the variable name of the variable to save into the* variable identified in %1 ;sample usage: ; gosub putGlovalVar 50 MyScript #chardid backpackid ; Using global var *50 stores/updates the variable labeled MyScript#charidbackpackid with %backpackid ; Warning: do not use *1000. * %1 + 1 is used for locking and there is no *1001! nameSpace push nameSpace local #systime , _ , %2 , _ , %3 , _ , %4 , _ , PUT set !lpc #lpc set #lpc 1000 set !lock %1 , _lock set !lockcount 0 putGlobalVar_waitforlock: if * . !lock <> N/A && * . !lock <> #nsname { wait 1 4 set !lockcount !lockcount + 1 if !lockcount < 10 goto putGlobalVar_waitforlock if * . !lock <> N/A { set !currentlock * . !lock if !currentlock = N/A goto putGlobalVar_waitforlock str pos !currentlock _ set !strres #strres - 1 str left !currentlock !strres set !systime #systime - #strres if !systime < 10000 ; if over 10 seconds assume a hung lock and take it { set !lockcount 0 goto putGlobalVar_waitforlock } } } set * . !lock #nsname wait 4 set !global * . %1 set !varName %2 , ^ , %3 , ^ , %4 , | str pos !global !varName if #strres = 0 { if * . !lock <> #nsname { set !lockcount 0 goto putGlobalVar_waitforlock } if |CEO*FILESYSTEM| notin !global set !global |CEO*FILESYSTEM| set * . %1 !global , !varName , % . %4 , | set * . !lock N/A set #lpc !lpc nameSpace clear nameSpace pop return #true } set !varNamePos #strres str len !varName set !splitString !varNamePos + #strres - 1 str left !global !splitstring set !globalPart1 #strres str del !global 1 !splitString set !global #strres str len !global set !globalLen #strres str pos !global | set !splitString !globalLen - #strres + 1 str right !global !splitstring set !global #strres if * . !lock <> #nsname { set !lockcount 0 goto putGlobalVar_waitforlock } set * . %1 !globalPart1 , % . %4 , !global set * . !lock N/A set #lpc !lpc nameSpace clear nameSpace pop return #true Sub delGlobalVar ;ver 1.0 posted 19Feb04 by CEO ;purpose: Allows you to delete a variable out of the globalvar pool unique to ; each player and script. delGlobaVar deletes a global variable in a * variable. ;@returns: #result = #false if variable not found, #true if deleted ; ;%1 is the global/persistant variable to use ;%2 is the script identifer or pseudo filename ;%3 is #charid or other identifier ;%4 is the variable name of the variable to save into the* variable identified in %1 ;sample usage: ; gosub delGlovalVar 50 MyScript #charid backpackid ; Using global var *50 deletes the variable label MyScript#charidbackpackid and it's associated value. ; Warning: do not use *1000. * %1 + 1 is used for locking and there is no *1001! nameSpace push nameSpace local #systime , _ , %2 , _ , %3 , _ , %4 , _ , DEL set !lpc #lpc set #lpc 1000 set !lock %1 , _lock set !lockcount 0 delGlobalVar_waitforlock: if * . !lock <> N/A && * . !lock <> #nsname { wait 1 4 set !lockcount !lockcount + 1 if !lockcount < 10 goto delGlobalVar_waitforlock if * . !lock <> N/A { set !currentlock * . !lock if !currentlock = N/A goto delGlobalVar_waitforlock str pos !currentlock _ set !strres #strres - 1 str left !currentlock !strres set !systime #systime - #strres if !systime < 10000 ; if over 10 seconds assume a broken lock and take it { set !lockcount 0 goto delGlobalVar_waitforlock } } } set * . !lock #nsname wait 4 set !global * . %1 set !varName %2 , ^ , %3 , ^ , %4 , | str pos !global !varName set #result #strres <> 0 if #result { set !varNamePos #strres str len !varName set !splitString !varNamePos + #strres - 1 set !delString !varNamePos - 1 str left !global !delString set !globalPart1 #strres str del !global 1 !splitString set !global #strres str pos !global | set !delString #strres str del !global 1 !delString if * . !lock <> #nsname { set !lockcount 0 goto delGlobalVar_waitforlock } set * . %1 !globalPart1 , #strres } if * . !lock = #nsname set * . !lock N/A set #lpc !lpc nameSpace clear nameSpace pop return #result