Moderator: MacroQuest Developers

there is a huge difference. the macro i created (with the help from a few ppl here, thanks!) resonds to hails and doesnt require letting ppl know you are running a macro magus service.Diamondmine wrote:the wizard was set up at the time portal and anytime a raid was called the wizard was put up. works well, I dont see a difference in anything that you are trying to do

Code: Select all
/declare QueueMaxSize int outer
/declare QueueSize int outer
| Change size as needed
/varset QueueMaxSize 10
/varset QueueSize 0
/declare QueueArray[${QueueMaxSize}]
Sub EnQueue(string Element)
|Adds an element to the Queue
|returns 1 on succes 0 on failure
/if (${QueueSize}<${QueueMaxSize}) {
/varset QueueArray(QueueSize) Element
/varset QueueSize ${QueueSize} + 1
/return 1
} else {
/return NULL
}
Sub DeQueue
|Retrieves an element from the Queue
|Returns the first element on success, null on failure
/declare ReturnValue
/declare Counter int
/if (${QueueSize}>0) {
/varset ReturnValue QueueArray(0)
/for Counter 0 to ${QueueSize} - 1
/varset QueueArray(${Counter}) QueueArray(${Counter} + 1)
/next Counter
/varset QueueSize ${QueueSize} - 1
/return ${ReturnValue}
} else {
/return null
}
Code: Select all
#include spell_routines.inc
#event Hailed "#1# says, 'Hail, <Your-Name-Here>'"
Sub Main
/echo Raid TL Macro has now started..
/declare transspell string outer
/declare RequestorID int outer
/declare spellgem int outer 9
/declare QueueMaxSize int outer
/declare QueueSize int outer
/varset QueueMaxSize 10
/varset QueueSize 0
/declare QueueArray[${QueueMaxSize}]
/if (!${Defined[Param0]}) {
/echo Error, You must specify the translocate spell you wish to use.
/echo Syntax: /mac tl Natimbi
/end
} else {
/echo You have chosen to use: Translocate: ${Param0}
/varset transspell Translocate: ${Param0}
/if (!${Me.SpellReady["${transspell}"]}) {
/echo Now meming ${transspell}
/memspell ${spellgem} "${transspell}"
}
}
:loop
/doevents
/delay 2s
/goto :loop
Sub Event_Hailed(string line,string RequestorName)
/varset RequestorID ${Spawn[pc ${RequestorName}].ID}
/squelch /target id ${RequestorID}
/delay 1s ${Target.ID}==${RequestorID}
/echo Adding {$RequestorName} to queue for translocation
/call EnQueue ${RequestorName}
/return
Sub Trans(string PersonToTrans)
/if (${Me.SpellReady["${transspell}"]}) {
/if (${FindItemCount[Small Portal Fragments]}>0) {
/echo Now translocating: ${PersonToTrans}
/call cast "${transspell}" ${spellgem} 1s
} else {
/echo Out of portal fragments, ending macro.
/end
}
}
/return
Sub EnQueue(string Element)
|Adds an element to the Queue
|returns 1 on succes 0 on failure
/if (${QueueSize}<${QueueMaxSize}) {
/varset QueueArray(QueueSize) Element
/varset QueueSize ${QueueSize} + 1
/return 1
} else {
/return NULL
}
Sub DeQueue
|Retrieves an element from the Queue
|Returns the first element on success, null on failure
/declare ReturnValue
/declare Counter int
/if (${QueueSize}>0) {
/varset ReturnValue QueueArray(0)
/for Counter 0 to ${QueueSize} - 1
/varset QueueArray(${Counter}) QueueArray(${Counter} + 1)
/next Counter
/varset QueueSize ${QueueSize} - 1
/return ${ReturnValue}
/if (!${Me.SpellReady["${transspell}"]}) /call Trans ${ReturnValue}
} else {
/return null
}
Code: Select all
#include spell_routines.inc
#event Hailed "#1# says, 'Hail, <Your-Name-Here>"
Sub Main
/echo Raid TL Macro has now started..
/declare transspell string outer
/declare RequestorID int outer
/declare spellgem int outer 9
/declare QueueMaxSize int outer
/declare QueueSize int outer
/declare Num int local 0
/varset QueueMaxSize 10
/varset QueueSize 0
/declare QueueArray[${QueueMaxSize}] string outer
/if (!${Defined[Param0]}) {
/echo Error, You must specify the translocate spell you wish to use.
/echo Syntax: /mac tl Natimbi
/end
} else {
/echo You have chosen to use: Translocate: ${Param0}
/varset transspell Translocate: ${Param0}
/if (!${Me.SpellReady["${transspell}"]}) {
/echo Now meming ${transspell}
/memspell ${spellgem} "${transspell}"
}
}
:loop
/doevents
/delay 2s
/if (${QueueSize}>1) /call DeQueue
/goto :loop
Sub Event_Hailed(string line,string RequestorName)
/varset RequestorID ${Spawn[pc ${RequestorName}].ID}
/squelch /target id ${RequestorID}
/delay 1s ${Target.ID}==${RequestorID}
/echo Adding ${RequestorName} to translocation queue
/call EnQueue ${RequestorName}
/return
Sub Trans(string PersonToTrans)
/if (${Me.SpellReady["${transspell}"]}) {
/if (${FindItemCount[Small Portal Fragments]}>0) {
/echo Now translocating: ${PersonToTrans}
/call cast "${transspell}" ${spellgem} 1s
} else {
/echo Out of portal fragments, ending macro.
/end
}
}
/return
Sub EnQueue(string Element)
/if (${QueueSize}<${QueueMaxSize}) {
/varcalc QueueSize ${QueueSize} + 1
/varset QueueArray[${QueueSize}] ${Element}
/echo Successfully added ${Element} to slot ${QueueSize} of the queue
/return 1
} else {
/echo Add to queue failed
/return NULL
}
Sub DeQueue
/declare ReturnValue string local
/declare Counter int local 0
/if (${QueueSize}>0) {
/varset ReturnValue QueueArray[0]
/for Counter 0 to ${QueueSize}
/varset QueueArray[${Counter}] QueueArray[${Counter}+1]
/next Counter
/return ${ReturnValue}
/echo Retrieved: ${ReturnValue}
| /if (!${Me.SpellReady["${transspell}"]}) /call Trans ${ReturnValue}
} else {
/return null
}
Code: Select all
/return ${ReturnValue}Code: Select all
/if (${QueueSize}>1) /call DeQueueCode: Select all
/varset transspell Translocate: ${Param0}this is the problem i am having now.. i am not sure what i am doing wrong in the dequeue sub.JJ wrote:Also, in your dequeue event, it doesn't seem to decrement your queue after retrieving the next queue item.
[MQ2] Retrieved: QueueArray[0]
/varset 'QueueArray[-1] failed, out of bounds of array
tl.mac@93 (DeQueue): /varset QueueArray[${Counter}] QueueArray[${Counter} + 1]
Code: Select all
#include spell_routines.inc
#event Hailed "#1# says, 'Hail, <Your-Name-Here>'"
Sub Main
/echo Raid TL Macro has now started..
/declare transspell string outer
/declare RequestorID int outer
/declare spellgem int outer 9
/declare QueueMaxSize int outer
/declare QueueSize int outer
/declare Num int local 0
/varset QueueMaxSize 10
/varset QueueSize 0
/declare QueueArray[${QueueMaxSize}] string outer
/if (!${Defined[Param0]}) {
/echo Error, You must specify the translocate spell you wish to use.
/echo Syntax: /mac tl Natimbi
/end
} else {
/echo You have chosen to use: Translocate: ${Param0}
/varset transspell Translocate: ${Param0}
/if (!${Me.SpellReady["${transspell}"]}) {
/echo Now meming ${transspell}
/memspell ${spellgem} "${transspell}"
}
}
:loop
/doevents
/delay 2s
/if (${QueueSize}>0) /call DeQueue
/goto :loop
Sub Event_Hailed(string line,string RequestorName)
/varset RequestorID ${Spawn[pc ${RequestorName}].ID}
/squelch /target id ${RequestorID}
/delay 1s ${Target.ID}==${RequestorID}
/echo Adding ${RequestorName} to translocation queue
/call EnQueue ${RequestorName}
/return
Sub Trans(string PersonToTrans)
/if (${Me.SpellReady["${transspell}"]}) {
/if (${FindItemCount[Small Portal Fragments]}>0) {
/echo Now translocating: ${PersonToTrans}
/call cast "${transspell}" ${spellgem} 1s
} else {
/echo Out of portal fragments, ending macro.
/end
}
}
/return
Sub EnQueue(string Element)
/if (${QueueSize}<${QueueMaxSize}) {
/varcalc QueueSize ${QueueSize} + 1
/varset QueueArray[${QueueSize}] ${Element}
/echo Successfully added ${Element} to slot ${QueueSize} of the queue
/return 1
} else {
/echo Add to queue failed
/return NULL
}
Sub DeQueue
/declare ReturnValue string local
/declare Counter int local 0
/varset ReturnValue QueueArray[0]
/for Counter 0 to ${QueueSize} -1
/varset QueueArray[${Counter}] QueueArray[${Counter} + 1]
/next Counter
/echo Retrieved: ${ReturnValue}
/if (!${Me.SpellReady["${transspell}"]}) /call Trans ${ReturnValue}
/return
Code: Select all
/for Counter 0 to ${QueueSize} -1Code: Select all
/for Counter 0 to (${QueueSize}-1)Code: Select all
/varcalc ${QueueSize} (${QueueSize}-1)
/echo Retrieved: ${ReturnValue}
Code: Select all
/for Counter 0 to (${QueueSize}-1)Code: Select all
/for Counter 0 to ${Math.Calc[${QueueSize}-1]}