Author Topic: XIIxOveR's Standard Subs  (Read 36803 times)

0 Members and 1 Guest are viewing this topic.

Offline 12TimesOverTopic starter

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *****
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +600
  • Referrals: 2
    • View Profile
XIIxOveR's Standard Subs
« on: September 23, 2010, 06:02:57 AM »
0
Just a thread for various subs I've written which I use regularly. These are probably the same or similar to what many other people use and probably already have in their libraries but I thought "Why Not".

XII
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline 12TimesOverTopic starter

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *****
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +600
  • Referrals: 2
    • View Profile
SUB ClickNWait
« Reply #1 on: September 23, 2010, 06:04:22 AM »
0
Code: [Select]
;#######################
;SUB XIIxClickNWait
;#######################
; %1 = Required: Xoffset
; %2 = Required: Yoffset
; %3 = Required: #TRUE to wait for gump, any other value to return after click
; %4 = Required if %3 is #TRUE: Gump_Name
; %5 = Required if %3 is #TRUE: Gump_Size
sub XIIxClickNWait
   namespace push
   namespace local nsXIIxClickNWait
   set !clickx #contposx + %1
   set !clicky #contposy + %2
   set !gName1 %4
   set !gName2 %4
   set !gSize %5
   click !clickx !clicky
   if %3 <> #TRUE
      {
      namespace pop
      return
      }
   if %0 > 3
      gosub GumpWait !gName1 !gName2 !gSize
   namespace pop   
return
« Last Edit: May 09, 2011, 01:00:21 PM by 12TimesOver »
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline 12TimesOverTopic starter

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *****
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +600
  • Referrals: 2
    • View Profile
SUB Gumpwait
« Reply #2 on: September 23, 2010, 06:04:50 AM »
0
Code: [Select]
;#######################
;SUB XIIxGumpWait
;#######################
; %1 = Required: Gumpname 1
; %2 = Required only if using Gumpsize: Gumpname 2
; %3 = Optional: Gumpsize
; Returns #TRUE if gump occured before timeout, #FALSE if timeout occured
sub XIIxGumpWait
   namespace push
   namespace local nsXIIxGumpWait
   wait 10
   set !gName1 %1
   set !gName2 %2
   set !gSize %3
   set !_time #SCNT
   while #SCNT <= !_time + 5
      {
      if %0 > 2
         {
         if ( #CONTNAME = !gName1 && #CONTSIZE = !gSize ) || ( #CONTNAME = !gName2 && #CONTSIZE = !gSize )
            {
            namespace pop
            return #TRUE
            }
         }
      else
         {
         if #CONTNAME = !gName1 || #CONTNAME = !gName2
            {
            namespace pop
            return #TRUE
            }
         }
      }
   namespace pop
return #FALSE
« Last Edit: May 07, 2013, 11:07:51 AM by 12TimesOver »
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline 12TimesOverTopic starter

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *****
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +600
  • Referrals: 2
    • View Profile
SUB Maxweight
« Reply #3 on: September 23, 2010, 06:05:18 AM »
0
Code: [Select]
;####################
;SUB XIIxMaxWeight
;####################
; %1 = Maxweight offset
sub XIIxMaxWeight
   Namespace Push
   Namespace Local nsXIIxMaxWeight
   set !offset %1
   If #maxweight = N/A
      {
      event macro 8 2
      wait 5
      event macro 10 2
      }

   set !MaxWeight #MaxWeight

   finditem #CHARID
   if #findtype NOTIN AV_XU_OCB_NCB ;char is human
      set !MaxWeight !MaxWeight + 60
      
   if !MaxWeight > 550
      set !MaxWeight 550 ;Backpack maximum

   set !MaxWeight !MaxWeight - !offset ;Adjust as see fit for overfull buffer
   set #RESULT !MaxWeight
   Namespace pop
Return #RESULT
« Last Edit: May 07, 2013, 11:08:14 AM by 12TimesOver »
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline 12TimesOverTopic starter

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *****
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +600
  • Referrals: 2
    • View Profile
SUB Pause
« Reply #4 on: September 23, 2010, 06:05:48 AM »
0
Code: [Select]
;#######################
;SUB XIIxPause
;#######################
; %1 = Button position 1
; %2 = Button position 2
; %3 = Button position 3
; %4 = Button position 4
; %5 = Button Name
; e.g. "gosub pause 340 92 40 25 Pause"
Sub XIIxPause
   namespace push
   namespace local XIIxPause
   set !1 %1
   set !2 %2
   set !3 %3
   set !4 %4
   set !5 %5
   menu set Status Status: Paused
   menu delete !5
   menu Font BGColor BtnFace
   menu Font Color WindowText
   menu button resume !1 !2 !3 !4 Resume
   set #menubutton N/A
   while #menubutton <> Resume
      wait 1
   menu delete resume
   menu Font BGColor BtnFace
   menu Font Color WindowText
   menu Button !5 !1 !2 !3 !4 !5
   menu set Status Status: Working...
   namespace pop
Return
« Last Edit: October 27, 2011, 04:52:17 AM by 12TimesOver »
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline 12TimesOverTopic starter

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *****
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +600
  • Referrals: 2
    • View Profile
SUB RoT Timer with accompanying Skillcheck
« Reply #5 on: May 06, 2011, 02:33:42 AM »
0
Notes - this code assumes that you are also updating a Skill Gained display menu, if not you do not need to use the Whole2Dec sub and can comment out the menu lines in the Skillcheck sub. I left them there for reference.

RoT Timer not fully tested.

Code: [Select]
;####################
;SUB XIIxSkillCheck
;####################
; Checks skill, updates menu, and engages RoT Timer if applicable
; %1 Required = Skill to check
; %2 Required = Skill last time visited sub, used to determine if RoT (!LastSkill)
; %3 Required = #TRUE/#FALSE to update menu
; %4 Required if %3 is #TRUE = Starting skill level, used to update Menu (!StartSkill)
; Returns Skill Level
sub XIIxSkillCheck
   Namespace Push
   NameSpace Local nsXIIxSkillCheck
   set !SkillName %1
   set !LastSkill %2
   set !ToMenu %3
   set !StartSkill %4
   set !RoTShards Siege_Perilous_Mugen_
  
   chooseskill !SkillName
   set !CurrentSkill #skill

   if !ToMenu = #TRUE
      {
      set !GainedSkill !CurrentSkill - !StartSkill
      gosub XIIxWhole2Dec !CurrentSkill
      Menu set M_Skill_Current #RESULT
      gosub XIIxWhole2Dec !GainedSkill
      Menu set M_Skill_Gained #RESULT
      }

   if #Shard in !RoTShards && !CurrentSkill >= 700 && !CurrentSkill > !LastSkill
      gosub XIIxRoTimer !CurrentSkill

   set #RESULT !CurrentSkill
   namespace clear
   namespace Pop
return #RESULT

Code: [Select]
;####################
;SUB XIIxRoTimer
;####################
; %1 Skill Level
Sub XIIxRoTimer
   Namespace Push
   Namespace Local nsXIIxRoTimer
   set !Skill %1

   If !Skill > 699 && !Skill < 800
      Set !Timer #SCNT + 300
   If !Skill > 799 && !Skill < 900
      Set !Timer #SCNT + 480
   If !Skill > 899 && !Skill < 1000
      Set !Timer #SCNT + 720
   If !Skill > 999 && !Skill < 1200
      Set !Timer #SCNT + 900

   Repeat
      wait 1220
      Set #LobjectID #BackpackID
      Event Macro 17 0
   Until #SCNT >= !Timer

   Namespace Pop
Return

Code: [Select]
;#######################
;SUB XIIxWhole2Dec
;#######################
; %1 Whole number value to convert to Decimal form
; Returns Decimal value
sub XIIxWhole2Dec
   Namespace Push
   Namespace Local nsXIIxWhole2Dec
   set !Int %1 / 10
   set !Dec %1 % 10
   set #RESULT !Int , #dot , !Dec
   Namespace Pop
return #RESULT
« Last Edit: January 25, 2014, 03:58:52 PM by 12TimesOver »
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline 12TimesOverTopic starter

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *****
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +600
  • Referrals: 2
    • View Profile
SUB MoveStuff
« Reply #6 on: October 27, 2011, 04:51:03 AM »
0
Code: [Select]
;#######################
;SUB XIIxMoveStuff
;#######################
; %1 ItemType or ID to move
; %2 Color or #FALSE if color doesn't matter
; %3 Container to move from
; %4 Number of items to move
; %5 Container to move to
; Returns #FALSE if item to move is not found or #TRUE if successful
sub XIIxMoveStuff
   Namespace Push
   Namespace Local nsXIIxMoveStuff
   set !Item2Move %1
   set !Color %2
   set !SourceContainer %3
   set !Amount2Move %4
   set !TargetContainer %5
   set !sWait 10
   
   finditem !Item2Move C_ , !SourceContainer
   if #findkind = -1
      {
      namespace clear
      NameSpace Pop
      Return #FALSE
      }
   else
      {
      if !Color <> #FALSE && #findcol <> !Color
         {
         ignoreitem #findid
         namespace clear
         namespace pop
         return #TRUE
         }
      else
         {
         if #findstack < !Amount2Move
            set !Amount2Move #findstack
         exevent drag #findid !Amount2Move
         wait !sWait
         exevent dropc !TargetContainer
         wait !sWait
         }
      }
   namespace clear
   Namespace Pop
return #TRUE
« Last Edit: May 18, 2014, 06:07:30 AM by 12TimesOver »
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Tags: