Moderator: MacroQuest Developers


Code: Select all
:Loop
/varset songname $char(gem,$cursong)
/call Sing $int($a(0,$cursong))
/call circ $p0 $p1 $p2
/doevents
/varset CastTimer $int($spell("$songname",casttime)*10+$spell("$songname",recoverytime)*10)
:casting
/call circ $p0 $p1 $p2
/if n $CastTimer>0 /goto :casting
/doevents
/cal circ $p0 $p1 $p2
/goto :Loop
/return

Code: Select all
/varset a(0,$int($nsongs)) $int($a(1,$v60))
/varadd nsongs 1
/echo Song $int($nsongs): $char(gem,$a(0,$int($nsongs-1)))


Code: Select all
| - Twist1.mac -
|
#event MissedNote "You miss a note, bringing your song to a close!"
#event Recovered "You haven't recovered yet..."
#event NeedTarget "You must first select a target for this spell!"
#event Slow "You slow down"
#event Exp "You gain "
#event Slain "You have slain"
|#event Outof "out of range"
#define cursong v1
#define nsongs v3
#define switch v4
#define exper V2
#define targcount v5
Sub Main
/if $p0=="" /return
/if $p0==NULL /return
/varset nsongs 1
/varset a(0,1) $p0 | First song
/echo Song 1: $char(gem,$p0)
/if $p1!="" /if $p1!=NULL {
/varadd nsongs 1
/varset a(0,2) $p1
/echo Song 2: $char(gem,$p1)
}
/if $p2!="" /if $p2!=NULL {
/varadd nsongs 1
/varset a(0,3) $p2
/echo Song 3: $char(gem,$p2)
}
/if $p3!="" /if $p3!=NULL {
/varadd nsongs 1
/varset a(0,4) $p3
/echo Song 4: $char(gem,$p3)
}
/if $p3!="" /if $p4!=NULL {
/varadd nsongs 1
/varset a(0,5) $p4
/echo Song 5: $char(gem,$p4)
}
/varset cursong 1
/varset exper $char(exp)
/varset switch 0
/varset t0 33
/varset a(8,0) "$target(name,clean)"
/varset a(8,1) $target(level)
/varset a(8,2) $target(name)
/varset a(8,3) $target(id)
:Loop
/if n $t0<=0 /call Sing $int($a(0,$cursong))
| /call circ $p3 $p4 $p5
/doevents
/goto :Loop
/return
sub event_exp
/delay 1s
/varset v57 $char(exp)
/varcalc v58 $v57-$v56
/varcalc v60 100-$char(exp)
/varcalc v59 $v60/$v58
/if n $v58>0 {
/echo and you've gained $v58% exp, bringing your total exp to $char(exp)%!!
|#Read npc.ini for any entries of last target.
/if n $ini(npc.ini,"$zone","$a(8,0)")=="notfound" {
/varset v74 0
} else {
/varset v74 $ini(npc.ini,"$zone","$a(8,0)")
}
/varcalc v74 $v74+1
|#Save the data in npc.ini
/ini npc.ini "$zone" "$a(8,0)" $v74
|End of NPC ini
/echo Don't forget, $v60% left till level, with only $v59 of these mobs to kill.
|#display npc.ini data.
/if n $v74==1.00 {
/echo This is your first kill of $a(8,0) in $zone.
} else {
/echo You've have killed $a(8,0) a total of $int($v74) times in $zone.
}
/varset v73 0
} else {
|# Below handles when you don't get exp or just dinged
/echo Exp remains at $char(exp)% after kill.
}
/return
Sub Sing
/varset t0 33
/stopsong
/cast $p0
/varadd cursong 1
/if n $cursong>$nsongs /varset cursong 1
/doevents
/return
|sub circ
| /face heading $calc($heading($p0,$p1)+90+$calc($p2-$distance($p0,$p1))/2)
| |/echo $distance($p0,$p1)
|/return
Sub Event_MissedNote
/varcalc cursong $cursong - 1
/if n $cursong<1 /varset cursong 1
/call Sing $cursong
/doevents
/return
Sub Event_Slow
/if n $cursong!=1 {
/varset cursong 1
/varset t0 0
/doevent
}
/return
|Sub Event_Outof
| /varset t0 0
| /varadd targcount 1
| /if n targcount>4 {
| /varset targcount 0
| /tar npc
| }
| /doevents
|/return
Sub Event_Recovered
/delay 1
/doevents
/return
Sub Event_NeedTarget
/varadd cursong 1
/if n $cursong>$nsongs /varset cursong 1
/return
Sub Event_Slain
/if n $ini(npc.ini,"$zone","$a(8,0)")=="notfound" {
/varset v74 0
} else {
/varset v74 $ini(npc.ini,"$zone","$a(8,0)")
}
/varcalc v74 $v74+1
/ini npc.ini "$zone" "$a(8,0)" $v74
/if n $v74==1.00 {
/echo This is your first kill of $a(8,0) in $zone.
} else {
/echo You have killed $a(8,0) a total of $int($v74) times in $zone.
}
/endm
/return


MQ.h:TheColonel wrote:9 is the limit on parameters
Code: Select all
#define MAX_STACKVARS 10
------> #define MAX_STACKVARS 30
