subroutine?

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

Moderator: MacroQuest Developers

england20
orc pawn
orc pawn
Posts: 13
Joined: Sun Jun 12, 2011 4:21 pm

subroutine?

Post by england20 » Mon Jun 13, 2011 8:12 pm

hello guys, new to all this but starting to love it lol anyways..

i copied booyjuice's forage macro to a new file in the macros folder when i go to load it in-game i get the error message saying
"flow ran into another subroutine
forage.mac@20 (main): sub Main
the current macro has ended.

anything i am doing wrong or something i need to add?
please help! =)

england20
orc pawn
orc pawn
Posts: 13
Joined: Sun Jun 12, 2011 4:21 pm

Re: subroutine?

Post by england20 » Tue Jun 14, 2011 2:56 pm

this is the macro im trying to use.

|yafm.mac
|
|Yet Another Forage Macro
|
|Ini File: yafm.ini
|
| 0 = destroy
| 1 = keep
|
|New foraged items are added to the ini file automatically and are kept by default.


||||||||||||||||||||
| Main
||||||||||||||||||||
sub Main

/cleanup

| Verify that we have the ability to forage.
/if (${Me.Skill[Forage]}==0) {
/echo You cannot forage, silly person!
/goto :Exit
}

:Forage

| Stand up. Can't forage while sitting.
/if (${Me.State.NotEqual[STAND]}) {
/stand
/delay 5
}

/delay 1s

| If we can forage then do so.
/if (${Me.AbilityReady[Forage]}) {
/doability forage
}

| If we successfully foraged something then take care of it.
/if (${Cursor.ID}) {
/call HandleItem
}

/goto :Forage

:Exit
/return

||||||||||||||||||||
| HandleItem
||||||||||||||||||||
sub HandleItem

/declare ItemSetting int local
/declare NotFound int local

/varset NotFound -1

| Look up this item in yafm.ini
/varset ItemSetting ${Ini[yafm.ini,ForageList,${Cursor.Name},${NotFound}]}

/delay 5

| If the item isn't in the .ini file then add it.
/if (${ItemSetting}==${NotFound}) {

/ini "yafm.ini" "ForageList" "${Cursor.Name}" "1"

/varset ItemSetting 1

}

| If we're keeping this item then stash it in our bags.
| Otherwise, just destroy it.
/if (${ItemSetting}==1) {

:LootIt
/autoinventory
/delay 5
/if (${Cursor.ID}) /goto :LootIt

} else {

/destroy

}

/return

/return

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Re: subroutine?

Post by dont_know_at_all » Tue Jun 14, 2011 4:54 pm

Which is line 20?

england20
orc pawn
orc pawn
Posts: 13
Joined: Sun Jun 12, 2011 4:21 pm

Re: subroutine?

Post by england20 » Tue Jun 14, 2011 5:43 pm

sorry I dont know what you mean exactly?

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Re: subroutine?

Post by dont_know_at_all » Tue Jun 14, 2011 6:19 pm

Files are a set a characters. A special character known as carriage return indicates the end of a line. Your error occurred on the 20th line so I would like to know the characters between the 19th and 20th carriage returns.

england20
orc pawn
orc pawn
Posts: 13
Joined: Sun Jun 12, 2011 4:21 pm

Re: subroutine?

Post by england20 » Tue Jun 14, 2011 6:43 pm

nevermind, I figured it out =)
again I appreciate the feedback!