help with a mix of two codes

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

spano
decaying skeleton
decaying skeleton
Posts: 9
Joined: Fri Jun 25, 2004 9:57 am

help with a mix of two codes

Post by spano » Tue Aug 03, 2004 6:46 am

Please friends could anyone help me to mix this two codes, i want to add the loot part but i dont know where to add the second code, im reading a lot of posts to see how works and where people add the loot code but i cant see or find it, thanks in advance

here are the two codes ( i copy and pasted them , all credits to the guys that made the codes that are in the top of the codes btw )

1. CODE:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::.

#turbo
#define NPCini "stick-NPC.ini" | file autocreated edit for enrage npcs
#define PCini "stick-PC.ini | file autocreated edit for enrage npcs
#include turn.inc
| Twist4.mac Flexible bard song twister using timers by BrainDozer,
| combat code, and funtionality by m0nk
| Updated by Drax, rzmonk76
|
| Syntax: /macro Twist2.mac [block 1] [block 2]
|
| Parameter block 1 indicates non-combat songs
| Parameter block 2 indicates combat songs
|
| Choose any combination of songs in any sequance to twist for each mode.
|
| Example: /macro Twist2.mac 256 1234234
|
| This would repeat songs 2, 5 and 6 durring non-combat and songs 1, 2, 3
| and 4 in the above sequence while in combat. In this instance, song 1
| is only twisted 1 for 7, which comes in handy for long duration songs
| like amplification.
|
| Other Examples: /macro Twist2.mac 0 123 | Twists on attack only
| /macro Twist2.mac 12345 0 | non-attack twisting only
| /macro Twist2.mac 12345 | same as above
| /macro Twist2.mac 9804 11 | twists 84 and 1
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#event EXP "experience!!"
#event RageON "has become ENRAGED."
#event RageOFF "is no longer enraged"
#event MobGate " Gates."
#event Invited "To join the group, click on the 'FOLLOW' option, or 'DISBAND' to cancel"
#event StunON "You are stunned"
#event StunOFF "You are unstunned"
#event MissedNote "You miss a note, bringing your song to a close!"
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub main
:setupDeclare
/zapvars
/declare MobID global
/declare MeleeDistance global
/declare CSong global | keeps track of current song number 1-max
/declare CSongf global | break and play song toggle (break=0 play=1)
/declare attack global | debug: @combat glitch work-around
/declare CSongt timer | break and play song timer
/declare attackct timer | debug: @combat glitch work-around check timer
/declare v90 global
/declare v91 global
/declare l0 global
/declare l1 global
/declare l2 global
/declare l3 global
/declare a array2
/declare MeleeDistance global
/declare MobID global
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/stopsong
/call initVars @Param0 @Param1
:Mainloop
/if $combat==TRUE /call attack
/if @attackct==0 /if $combat==TRUE /if @attack==0 /call AttackOn
/if @attackct==0 /if $combat==FALSE /if @attack==1 /call AttackOff
/if @v9@attack!=-1 /if $char(state)==STAND /call TwistSong @attack
/if @attackct==0 /varset attackct 10


/doevents
/goto :Mainloop
/endmacro
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Sub TwistSong
/if @CSong>@v9@Param0 /varset CSong 0 | Restart twist when end of list
/if (@CSongf==0 && @CSongt==0) /call TS2 @Param0 | Start next song in list
/if (@CSongf==1 && @CSongt==0) /call TS3 | Stop song and advance index
/return | Debug: conditionals wern't playing nice with brackets
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub TS2
/cast @a(@Param0,@CSong)
/varset CSongf 1
/varset CSongt 32 | adjustable play delay
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub TS3
/stopsong
/varset CSong $int($calc(@CSong+1)) | Debug: Force integer
/varset CSongf 0
/varset CSongt 1 | adjustable break delay
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub initVars
/if @Param1=="" /varset Param1 "0"
/varset v90 0 | v90,v91 max song index lengths
/varset v91 0 | l0 combat mode index
/for l0 0 to 1 | l1 parameter index
/for l1 0 to $int($calc($strlen(@Param@l0)-1)) | l2 hold
/varset l2 $mid(@l1,1,@Param@l0)
/varset l3 @v9@l0 | Debug: array didn't like the fancy stuff
/if (@l2>=1 && @l2<=8) /varset a(@l0,@l3) @l2 | Debug: Bracket trouble
/if (@l2>=1 && @l2<=8) /varset v9@l0 $int($calc(@v9@l0+1))
/next l1 | Debug: it thinks it's a float-forcing
/next l0
/varset v90 $int($calc(@v90-1)) | over increment fix
/varset v91 $int($calc(@v91-1)) |
/varset CSong 0
/varset CSongt 0
/varset CSongf 0
/if $combat==TRUE /varset attack 1 | debug: inital combat values
/if $combat==FALSE /varset attack 0 |
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub AttackOn
/stopsong
/varset attack 1
/varset CSong 0 | reset sequence
/varset CSongt 0 | attack mode twist start delay
/varset CSongf 0 | force play mode
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub AttackOff
/stopsong
/varset attack 0
/varset CSong 0 | reset sequence
/varset CSongt 0 | attack off mode twist start delay
/varset CSongf 0 | force play mode
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub Event_MissedNote
/varset CSongt 0 | missed note try again delay
/varset CSongf 0 | switch back to play mode
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub attack
:attackCheck
/varset MobID $target(id)

:attackSetup
/if $target(type)!=NPC {
/attack off
/delay 5
/return
}
/if n $target(distance)>150 {
/attack off
/delay 5
/return
}

:attackPreFight
/call ClearReturn
/varset MeleeDistance $ini("NPCini","$zone","$target(name,clean).DistanceMelee")
/if "@MeleeDistance"=="NOTFOUND" {
/ini "NPCini" "$zone" "$target(name,clean).DistanceMelee" 15
/delay 0
/varset MeleeDistance $ini("NPCini","$zone","$target(name,clean).DistanceMelee")
}

:attackMeleeLoop
/doevents exp
/doevents RageOn
/doevents MobGate
/doevents StunON
/doevents ToggleTaunt
/if n $target(id)!=@MobID /goto :attackend
/if $return==EndATK /goto :attackEnd
/if $combat!=TRUE /goto :attackend
/call turn
/if n $target(distance)>@MeleeDistance /sendkey down up
/if n $target(distance)<=@MeleeDistance /sendkey up up
/if n $target(id)==@MobID /if n $target(distance)<=$calc(@MeleeDistance-5) /press down
/return

:attackend
/doevents exp
/varset MobID NULL
/sendkey up up
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub ClearReturn
/return NULL
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub event_exp
/if n $target(hp,pct)>0 /return
/return EndATK
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub event_RageOn
/if n $target(hp,pct)>15 /return
/if n $target(hp,pct)==0 /return
/if $target(id)==@MobID /sendkey up up
/call ClearReturn
/echo Rage On
/attack off
/call ClearReturn

:waitRage
/doevents
/if $target(id)!=@MobID /return EndATK
/if $return==EndATK /return EndATK
/if $return==RageOFF /return
/goto :waitRage
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub event_RageOFF
/echo Rage OFF
/attack on
/return RageOFF
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub event_MobGate
/echo MOB GATED!
/attack off
/return EndATK
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub event_Invited
/invite
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub event_StunON
/doevents flush StunOFF
/call ClearReturn

:LoopStunOFF
/doevents StunOFF
/if "$return"=="StunOFF" {
/call ClearReturn
/return
}
/goto :LoopStunOFF
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub event_StunOFF
/return StunOFF
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||





AND HERE IS THE 2.CODE::::::::::::::::::::::::::::::::::::




|------------
|
| Taken Parts of Robdawg's Hunter.mac Loot code
|
| Edited and designed to meet my needs
| ~Exslam
|
|
|------------

/declare RV_LootSlot int outer 0


Sub Main

/squelch /target radius 50 corpse
/if (!${Target.ID}) {
/echo No Corpses in Range.
/echo Ending Macro.
/end
}

:MoveTo
/if ((${Target.Distance})>10) {
/face fast
/keypress Forward Hold
/delay 5
}
/if ((${Target.Distance})<5) {
/delay 2
/keypress back
/goto :loot
/delay 2
}
/goto :MoveTo

:loot

/declare LootSlot int inner 0
/declare LootCheck int inner 0
/declare LootTotal int inner 0

/lootn never
/fastdrop on
/delay 2s
/loot
/delay 2s

/if (!${Corpse.Items}) {
/echo No Loot, moving to next.
/return
}

/varset LootTotal ${Corpse.Items}
/for LootSlot 1 to ${LootTotal}
/itemnotify loot${LootSlot} leftmouseup
/delay 1s
/echo Keeping a ${Cursor.Name}.
/autoinventory
/delay 1s
/next LootSlot

/notify LootWnd DoneButton leftmouseup
/delay 1s
/if ((${Me.FreeInventory})=0) {
/echo No Free Inventory Slots, Ending Macro.
/end
}
/squelch /target corpse radius 50
/if (${Target.ID}) {
/goto :start
} else {
/echo No corpses in Range, Ending Macro!
}

/return


p.d :: thanks in advance again, btw if u think that u can redirect me to any site to explain the thingy that i want do, please add a link and i ll read it and try to understand again, thanks friends

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Tue Aug 03, 2004 9:38 am

Simple way to include one macro into another:

Rename the "lesser" macro file from whatever.mac to whatever.inc

Add a line at the top of the "main" macro

Code: Select all

#include whatever.inc
Inside of whatever.inc, look for

Code: Select all

Sub Main
and change it to

Code: Select all

Sub Whatever
Now in the "main" macro use

Code: Select all

/call Whatever
when you want to run the "lesser" macro. If both macros use variables or functions with the same name, you might have some problems, but in general this should get you started.

spano
decaying skeleton
decaying skeleton
Posts: 9
Joined: Fri Jun 25, 2004 9:57 am

Post by spano » Tue Aug 03, 2004 11:49 am

kk i ll try now, thanks for the help i ll post if it works or not, but BUNCH of thanks in advance friends

spano
decaying skeleton
decaying skeleton
Posts: 9
Joined: Fri Jun 25, 2004 9:57 am

Post by spano » Tue Aug 03, 2004 2:18 pm

doh (( not work or im doing something wrong i did how u say in your post but nothing i ll post the error to see if someone could help me

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Tue Aug 03, 2004 3:28 pm

All I ask is that if you post any more code you use the little "Code" button to mark the text

Code: Select all

like this
as it helps a lot when reading it or doing a cut/paste if i want to test it myself. :)

eqjoe
a grimling bloodguard
a grimling bloodguard
Posts: 984
Joined: Sat Sep 28, 2002 12:26 pm

Re: help with a mix of two codes

Post by eqjoe » Tue Aug 03, 2004 4:32 pm

spano wrote:Please friends could anyone help me to mix this two codes, i want to add the loot part but i dont know where to add the second code,
What "codes" are you talking about? Are to talking about macros?

If you want to learn how to use Macroquest, you better give up on "codes" and learn how to write macros... you will have much better luck.


-j

spano
decaying skeleton
decaying skeleton
Posts: 9
Joined: Fri Jun 25, 2004 9:57 am

Post by spano » Tue Aug 03, 2004 6:17 pm

ok here is the code that im trying to get him to work, im done with choose the targets , kill them and loot only the items that i want.

I fount that the macro made by ROBDAWG have all i want and im trying to modify to adecuate to my needs ( u rules Rob!! ) , now my only problem is that i dont know how to add the code that play my songs when im fighting with a mob ( im a ugly bard....).

Here is the code that im using or what i have atm::

Code: Select all

 | Hunter.mac
| Author      : robdawg
| Version     : v1.2 2004-05-13 10:06pm PST
| Useage      : /macro Hunter
| Description : This macro will run your character around killing any mobs in your
|      RV_MobArray.  Then it will attempt to loot all items in your
|      RV_LootArray.  This is definitely a work in progress and I am sure
|      someone can think of plenty of upgrades for this.
|------------------------------------------------------------------------------------

#turbo 10
#include cantar.inc

Sub Main

   |------------------------------------------------------------
   |How many times should aquire target fail before delaying?
   |------------------------------------------------------------
   /declare RV_FailMax          int outer  5
   |------------------------------------------------------------
   |How far would you like to target a mob?
   |------------------------------------------------------------
   /declare RV_MaxRadius        int outer  30
   |------------------------------------------------------------
   |How far is the combat range?
   |------------------------------------------------------------
   /declare RV_Range            int outer 30
   |------------------------------------------------------------
   |What is the minimum Z Value of mobs I should target?
   |------------------------------------------------------------
   /declare RV_MinZRange        int outer  -1000
   |------------------------------------------------------------
   |What is the maximum Z Value of mobs I should target?
   |------------------------------------------------------------
   /declare RV_MaxZRange        int outer  1000
   |------------------------------------------------------------
   |Should I loot all items?
   |------------------------------------------------------------
   /declare RV_LootAllItems     int outer  0
   |------------------------------------------------------------
   |Should I display stats?
   |------------------------------------------------------------
   /declare RV_DisplayStats     int outer  1

   |------------------------------------------------------------
   |Loot Array Information.
   |------------------------------------------------------------
   /call ReadINI HunterMob.ini "${Zone.Name}" Mob
   /if (!${Defined[RV_MobArray]}) {
      /echo Mob Array Creation Error, ending macro...
      /endmacro
   }

   |------------------------------------------------------------
   |Mob Array Information.
   |------------------------------------------------------------
   /call ReadINI HunterLoot.ini "${Zone.Name}" Loot
   /if (!${Defined[RV_LootArray]}) {
      /echo No Loot Array Created...
   }

   |------------------------------------------------------------
   |Variables that you don't need to worry about.
   |------------------------------------------------------------
   /declare RV_FailCounter      int outer  0
   /declare RV_MyTargetID       int outer  0
   /declare RV_MyTargetName     string outer
   /declare RV_MyTargetDead     int outer  0
   /declare RV_InvalidTargetID  int outer  0
   /declare RV_HasTarget        int outer  0
   /declare RV_RandomWait       int outer  0
   /declare RV_LootSlot         int outer  0
   /declare RV_CheckLook        int outer  0
   /declare RV_Fighting         int outer  0
   /declare RV_TargetDead       int outer  0
   /declare RV_MyXLOC           int outer  0
   /declare RV_MyYLOC           int outer  0
   
   /declare RV_FastRange        int outer
   /declare RV_RangeMax         int outer
   /declare RV_RangeMin         int outer
   /varcalc RV_FastRange ${RV_Range}+3
   /varcalc RV_RangeMax ${RV_Range}+1
   /varcalc RV_RangeMin ${RV_Range}-1

   :Start
   /doevents
   /call GMCheck
   /call GetTarget	
   
   :KillAdds
   
   /if (${RV_HasTarget}) /call CombatSub
   /if (${RV_HasTarget} && (${Defined[RV_LootArray]} || ${RV_LootAllItems})) /call LootMob
   /if (${RV_DisplayStats}) /call DisplayStats
   /call ResetSub

   /varset RV_RandomWait ${Math.Rand[5]}
   /varcalc RV_RandomWait ${RV_RandomWait}+1
   /echo Paranoia - Waiting ${RV_RandomWait} seconds before resuming
   /delay ${RV_RandomWait}s
   
   /if (${Target.ID}) {
      /echo Looks like something is attacking us, killing it...
      /delay 1s
      /varset RV_HasTarget 1
      /varset RV_Fighting 1
      /goto :KillAdds
   }
   
   /goto :Start
   
/return

|--------------------------------------------------------------------------------
|SUB: Aquire Target
|--------------------------------------------------------------------------------
Sub GetTarget

   /declare RV_CurrentRadius   int local
   /declare RV_TargetSub   int local
   :Acquire
   /for RV_CurrentRadius 100 to ${RV_MaxRadius} step 100
      /for RV_TargetSub 1 to ${RV_MobArray.Size}
         /squelch /target radius ${RV_CurrentRadius} nopcnear notid ${RV_InvalidTargetID} npc "${RV_MobArray[${RV_TargetSub}]}"
         /varset RV_MyTargetID ${Target.ID}
         /varset RV_MyTargetDead 0
         /if (${Target.ID}) {
            /if (${Int[${Target.PctHPs}]}<100) {
               /echo Mob NOT a Full Health, picking another...
               /varset RV_InvalidTargetID ${Target.ID}
               /call ResetSub
               /goto :Acquire
            }
            /if (${Int[${Target.Z}]}<${RV_MinZRange}) {
               /echo Mob is BELOW Min Z Range, picking another...
               /varset RV_InvalidTargetID ${Target.ID}
               /call ResetSub
               /goto :Acquire
            }
            /if (${Int[${Target.Z}]}>${RV_MaxZRange}) {
               /echo Mob is ABOVE Max Z Range, picking another...
               /varset RV_InvalidTargetID ${Target.ID}
               /call ResetSub
               /goto :Acquire
            }
            /varset RV_HasTarget 1
            /varset RV_MyTargetName ${Target.CleanName}
            /echo Acquired ${Target.CleanName} at range ${Int[${Target.Distance}]}
            /return
         }
      /next RV_TargetSub
      /delay 2
   /next RV_CurrentRadius

   /if (!${Target.ID}) {
      /delay 2s
      /varcalc RV_FailCounter ${RV_FailCounter}+1
      /echo Failed to Acquire Target in Range ${RV_MaxRadius} ${RV_FailCounter} Time(s)
      /if (${RV_FailCounter}>=${RV_FailMax}) {
         /echo Waiting for Respawns, Resetting Failure Counter...
         /delay 60s
         /varset RV_FailCounter 0
      }
      /goto :Acquire
   }
/return



|--------------------------------------------------------------------------------
|SUB: Combat
|--------------------------------------------------------------------------------
Sub CombatSub

   /echo Attacking Mob NOW!
   /varset RV_Fighting 1
   /varset RV_TargetDead 0
   
   :CombatLoop
   /doevents
   /attack on
   
   /call SpecialIT
   /if (!${Target.ID}) {
      /attack off
      /keypress forward
      /keypress back
     
      /varset RV_TargetDead 1
      /varset RV_Fighting 0
      /delay 1s
      /target radius 30 corpse
      /delay 1s
      /if (!${Target.ID}) {
         /call ResetSub
         /return
      }
      /face fast
   }
   /if (!${RV_TargetDead}) {
      /goto :CombatLoop
   }
   
/return

|--------------------------------------------------------------------------------
|SUB: Special Combat
|--------------------------------------------------------------------------------
Sub SpecialIt

   /declare TempID    int inner  0
   
   /if ((${Int[${Me.PctHPs}]}<75)&&(${Me.Gem["Requiem of Time"]})&&(${Me.SpellReady["Requiem of Time"]})) {
      /varset TempID ${Target.ID}
      /keypress forward
      /keypress back
      /keypress F8
      /echo Casting SLOW Spell because of low health...
      /cast "Requiem of Time"
      /delay 3s
      /target id ${TempID}
   }
   
/return

|--------------------------------------------------------------------------------
|SUB: Looting
|--------------------------------------------------------------------------------
Sub LootMob

   /declare LootSlot    int inner  0
   /declare LootCheck   int inner  0
   /declare LootTotal   int inner  0
   
   /face fast
   
   /keypress forward
   /keypress back
   
   /fastdrop on
   /lootn always
   /delay 2s
   /loot
   /delay 2s
   /if (!${Corpse.Items}) {
      /echo NO LOOT! Cheap Bastard!
      /return
   }

   /varset LootTotal ${Corpse.Items}
   /for LootSlot 1 to ${LootTotal}
      /itemnotify loot${LootSlot} leftmouseup
      /delay 1s
      /if (${RV_LootAllItems}) {
         /echo Keeping a ${Cursor.Name}... WOOT!
         /autoinventory
         /delay 1s
      } else {
         /for LootCheck 1 to ${RV_LootArray.Size}
            /if (${Cursor.Name.Find[${RV_LootArray[${LootCheck}]}]}) {
               /echo Keeping a ${Cursor.Name}... WOOT!
               /varcalc RV_LootStats[${LootCheck}] ${RV_LootStats[${LootCheck}]}+1
               /autoinventory
               /delay 1s
            }
         /next LootCheck
      }
      /if (${Cursor.ID}) {
         /echo Destroying a ${Cursor.Name}...
         /destroy
         /delay 1s
      }
   /next LootSlot
   
   /notify LootWnd DoneButton leftmouseup
   /delay 2
   
/return

|--------------------------------------------------------------------------------
|SUB: Reset
|--------------------------------------------------------------------------------
Sub ResetSub

   /keypress esc
   /keypress esc
   /keypress esc
   /keypress esc
   
   /varset RV_HasTarget 0
   /varset RV_TargetDead 0
   /varset RV_Fighting 0
   
/return


|--------------------------------------------------------------------------------
|SUB: GM Check
|--------------------------------------------------------------------------------
Sub GMCheck

   /if (${Spawn[gm].ID}) {
      /beep
      /beep
      /beep
     
      /echo GM has entered the zone!
      /echo FUCK HIM but ending the macro...

      /keypress forward
      /keypress back

      /quit
      /endmacro
   }
   
/return

|---------------------------------------------------------------------------------
|
| SUB: cantar
|---------------------------------------------------------------------------------

Sub cantar(NonCombatGems,CombatGems) 
    /if (!${Defined[NonCombatGems]}) /endmacro 

| 
|  Variable Declarations 
| 
    /declare CombatCurSong int outer 
    /declare NonCombatCurSong int outer 
    /declare NNonCombatSongs int outer 
    /declare NCombatSongs int outer 
    /declare NonCombatSongList string outer 
    /declare CombatSongList string outer 
    /declare TwistI int outer 
    /declare DynamicBuffer int outer 
    /declare NonCombatSongArray[30] int outer 
    /declare CombatSongArray[30] int outer 

| 
|  Timer Declarations 
| 
    /declare SingTime timer outer 


    /varset CombatCurSong 1 
    /varset NonCombatCurSong 1 
    /varset NNonCombatSongs ${Int[${String[${NonCombatGems}].Length}]} 
    /if (${Defined[CombatGems]}) /varset NCombatSongs ${Int[${String[${CombatGems}].Length}]} 
    /varset NonCombatSongList ${NonCombatGems} 
    /if (${Defined[CombatGems]}) /varset CombatSongList ${CombatGems} 
    /varset DynamicBuffer 5 

    /for TwistI 1 to ${NNonCombatSongs} 
        /varset NonCombatSongArray[${TwistI}] ${String["${NonCombatSongList}"].Mid[${TwistI},1]} 
    /next TwistI 

    /if (${Defined[CombatGems]}) { 
        /for TwistI 1 to ${NCombatSongs} 
            /varset CombatSongArray[${TwistI}] ${String["${CombatSongList}"].Mid[${TwistI},1]} 
        /next TwistI 
    } 
    :Loop 
    /if (${Me.Standing}) { 
        /if (${Defined[CombatGems]}) /if (${Me.Combat}) /call CombatSing ${CombatSongArray[${CombatCurSong}]} 
        /if ((!${Me.Combat})||(!${Defined[CombatGems]})) /call NonCombatSing ${NonCombatSongArray[${NonCombatCurSong}]} 
    } 
   /if (${Me.State.Equal["DUCK"]}) /keypress DUCK 
   /if (!${Me.Standing}) /stand 
   /goto :Loop 
/return 


Sub CombatSing(Song) 
     /declare Buffer int local 
     /declare Duration int local 
     /varset Duration 0 

  :CombatSing1 
    /call CheckSong ${Song} 
    /varset Duration ${Macro.Return} 
    /varset SingTime 30 
    /varset Buffer 0    
    /cast "${Me.Gem[${Song}]}" 
  :CombatSing2 
    /delay 1 
    /if (${Me.Casting.ID}) { 
        /if (${SingTime}<=0) /goto :CombatSingBreak 
        /goto :CombatSing2 
    } 
    :CombatSingBreak 
    /if (${SingTime}>0) /goto :CombatSing1 
    /if (${Duration}==0) { 
        /delay ${DynamicBuffer} 
        /stopsong 
    } else { 
      :CombatSing3 
        /varcalc Buffer ${Buffer}+1 
        /delay 1 
        /if (${Buffer}>8) { 
        /stopsong 
        /goto :CombatSing1 
        } 
        /if ((!${Me.Song["${Me.Gem[${Song}]}"].ID})&&(!${Me.Buff["${Me.Gem[${Song}]}"].ID})) /goto :CombatSing3 
        /if ((${Me.Song["${Me.Gem[${Song}]}"].Duration}<${Math.Calc[${Duration}-1]})&&(${Me.Buff["${Me.Gem[${Song}]}"].Duration}<${Math.Calc[${Duration}-1]})) /goto :CombatSing3 
        /varset DynamicBuffer ${Buffer} 
        /stopsong 
    } 
|    /echo Dynamic Buffer: ${DynamicBuffer} 
    /varcalc CombatCurSong ${CombatCurSong}+1 
    /if (${CombatCurSong}>${NCombatSongs}) /varset CombatCurSong 1 
/return 


Sub NonCombatSing(Song) 
     /declare Buffer int local 
     /declare Duration int local 
     /varset Duration 0 

  :NonCombatSing1 
    /call CheckSong ${Song} 
    /varset Duration ${Macro.Return} 
    /varset SingTime 30 
    /varset Buffer 0    
    /cast "${Me.Gem[${Song}]}" 
  :NonCombatSing2 
    /delay 1 
    /if (${Me.Casting.ID}) { 
        /if (${SingTime}<=0) /goto :NonCombatSingBreak 
        /goto :NonCombatSing2 
    } 
    :NonCombatSingBreak 
    /if (${SingTime}>0) /goto :NonCombatSing1 
    /if (${Duration}==0) { 
        /delay ${DynamicBuffer} 
        /stopsong 
    } else { 
      :NonCombatSing3 
        /varcalc Buffer ${Buffer}+1 
        /delay 1 
        /if (${Buffer}>8) { 
        /stopsong 
        /goto :NonCombatSing1 
        } 
        /if ((!${Me.Song["${Me.Gem[${Song}]}"].ID})&&(!${Me.Buff["${Me.Gem[${Song}]}"].ID})) /goto :NonCombatSing3 
        /if ((${Me.Song["${Me.Gem[${Song}]}"].Duration}<${Math.Calc[${Duration}-1]})&&(${Me.Buff["${Me.Gem[${Song}]}"].Duration}<${Math.Calc[${Duration}-1]})) /goto :NonCombatSing3 
        /varset DynamicBuffer ${Buffer} 
        /stopsong 
    } 
|    /echo Dynamic Buffer: ${DynamicBuffer} 
    /varcalc NonCombatCurSong ${NonCombatCurSong}+1 
    /if (${NonCombatCurSong}>${NNonCombatSongs}) /varset NonCombatCurSong 1 
/return 

Sub CheckSong(GemNumber) 
/if (${Me.Gem[${GemNumber}].SpellType.Find["Beneficial"]}) { 
    /if (${Me.Gem[${GemNumber}].TargetType.Find["Group"]} || ${Me.Gem[${GemNumber}].TargetType.Find["Self"]} || ${Me.Gem[${GemNumber}].TargetType.Find["PC"]}) { 
        /if ((${Me.Gem[${GemNumber}].Name.Equal[Cassindra`s Chant of Clarity]}) || (${Me.Gem[${GemNumber}].Name.Equal[Cassindra's Chorus of Clarity]})) { 
            /return 3 
        } 
        /return ${Me.Gem[${GemNumber}].Duration} 
    } else { 
        /return 0 
    } 
} else { 
    /return 0 
} 
/return 

|--------------------------------------------------------------------------------
|SUB: Reading from an INI File
|--------------------------------------------------------------------------------
Sub ReadINI(FileName,SectionName,ArrayType)

   /echo Attempting to Read Section "${SectionName}" Zone Information from ${FileName}...
   /delay 1s
   
   /if (${Ini[${FileName},${SectionName},-1,NO].Equal[NO]}) {
      /echo "${SectionName}" is not a Valid Section for FILE:${FileName}, ending macro...
      /delay 1s
      /return
   }
   /declare nValues     int local  1
   /declare nArray      int local  0
   /declare KeySet      string local  ${Ini[${FileName},${SectionName}]}

   :CounterLoop
   /if (${String[${Ini[${FileName},${SectionName},${ArrayType}${nValues}]}].Equal[null]}) {
      /varcalc nValues ${nValues}-1
      /goto :MakeArray
   }
   /varcalc nValues ${nValues}+1
   /goto :CounterLoop 

   :MakeArray
   /if (!${nValues}) /return
   /if (${FileName.Equal["HunterMob.ini"]}&&${nValues}>0) {
      /echo Declaring Mob Array...
      /declare RV_MobArray[${nValues}]   string outer
      /declare RV_MobStats[${nValues}]   string outer
   }
   /if (${FileName.Equal["HunterLoot.ini"]}&&${nValues}>0) {
      /echo Declaring Loot Array...
      /declare RV_LootArray[${nValues}]  string outer
      /declare RV_LootStats[${nValues}]  string outer
   }
   /for nArray 1 to ${nValues}
      /if (${FileName.Equal["HunterMob.ini"]}) {
         /varset RV_MobArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}${nArray}]}
         /varset RV_MobStats[${nArray}] 0
      }
      /if (${FileName.Equal["HunterLoot.ini"]}) {
         /varset RV_LootArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}${nArray}]}
         /varset RV_LootStats[${nArray}] 0
      }
   /next nArray
   
   /echo "${SectionName}" Zone Information Read Successfully from ${FileName}...
   /delay 1s
   
/return

|--------------------------------------------------------------------------------
|SUB: Display Stats
|--------------------------------------------------------------------------------
Sub DisplayStats

   /declare nArray  int local
   
   /if (${Defined[RV_LootArray]}) {
      /for nArray 1 to ${RV_LootArray.Size}
         /echo ${Int[${RV_LootStats[${nArray}]}]} ${RV_LootArray[${nArray}]}'s
      /next nArray
   }
   
/return  
I tried to use the info that Cr4zyB4ard said but im doing something wrong , im sure of it, or maybe im missing something important, im trying to learn and im reading all time and re- reading all your post to try to understant how it works, feel free to post any advice, maybe i dont want that u explain me or resolve my trouble, i like to learn and im sure that soon or later i ll resolve.

Thanks all of your friends

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Tue Aug 03, 2004 11:15 pm

I'm sorry but I just don't have the time to read and disect this whole macro. If you could specify a section that's giving you problems, or paste just the part you think might be causing them, and possibly a detailed description of any errors you're getting or what should be happening that isn't, it would help greatly. :)

spano
decaying skeleton
decaying skeleton
Posts: 9
Joined: Fri Jun 25, 2004 9:57 am

Post by spano » Tue Aug 03, 2004 11:33 pm

Well im 99% done atm, i found the way of the trouble " working " with a plugin ( MQ2Twist ) and using a edited version of " hunter.mac " ( as i said Rob rules!!, thanks friend!! )

i said 99% because when i load the plug, i play 4 song, and the last one is a slow song, the song have a recast time and must be casted on a target, but when i launch the macro and the plugin only cast the slow song 1 time, isnt a difference if i put slow song in first slot ( ex. /twist 4 1 2 3 ) or in the last ( ex. /twist 1 2 3 4 ) , only works first time i press the hotkey with the description:

/plugin MQ2Twist
/twist 1 2 3 4

the line works like 4 1 2 3 4 1 2 3 1 2 3 1 2 3 or 1 2 3 4 1 2 3 1 2 3 1 2 3 .......

any way to fix it? i was wondering to ask the guy that made the pluging , but i just noticed when i was typing this lines

P.D thanks Cr4zyB4rd , you and Rob are great guys

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Wed Aug 04, 2004 1:15 am

Read the thread about the twist plugin. Both of the high level slows have a two minute duration, and the plugin won't attempt to play the song again until the duration is up (or nearly so). Unfortunately this is true even if the song is resisted. Due to this restriction I usually use a custombind to slow manually with something like "/twist hold 1", or make other arrangements if I'm twisting from inside of a macro.

spano
decaying skeleton
decaying skeleton
Posts: 9
Joined: Fri Jun 25, 2004 9:57 am

Post by spano » Thu Aug 05, 2004 6:12 am

Cr4zy exist a way to make for example any code that says:

If combat press hotkey 1 and if not in combat press hotkey2

hotkey 1 : combat songs (warsong of zek, psalm of veshaa, rizlona, requiem of time ), /twist 1 2 3 4

hotkey 2 : /twist hold 4 ( winds of marr )

is it posibly?

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Thu Aug 05, 2004 10:52 am

Something like

Code: Select all

/custombind add TwistHotkey
/custombind set TwistHotkey /twist ${If[${Me.Combat},1 2 3 4,hold 4]}
/bind TwistHotkey ctrl t
that will make a hotkey (bound to CTRL-T in the above example, but use whatever) that will do "/twist 1 2 3 4" if you have attack turned on and "/twist hold 4" otherwise.

spano
decaying skeleton
decaying skeleton
Posts: 9
Joined: Fri Jun 25, 2004 9:57 am

Post by spano » Thu Aug 05, 2004 12:45 pm

ok Cr4zyB4rd rules , all my trouble solutioned 100% , thanks again all of u friends