Loop something a certain amount of times?

Have a macro idea but not sure where to start? Ask here.

Moderator: MacroQuest Developers

DrmChld
a ghoul
a ghoul
Posts: 89
Joined: Fri Jul 09, 2004 3:25 pm

Loop something a certain amount of times?

Post by DrmChld » Mon Nov 21, 2005 12:30 pm

I am looking to make a loop that will summon 10 times or so. Instead of me just cutting and pasting 10 lines I was looking for the code.

I remember vaguely that I need to do something with a For statement and a counter, god its been so long since I have done any C, and not finding anything good with Search.


Can someone post a snipplet real quick on how to do a repeat of something a certain amount of times.

Thanks

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Mon Nov 21, 2005 12:35 pm

Code: Select all

/declare i int local
/for i 1 to ${SomeInteger}
/if (${Variable${i}}==SomeValue) /dosomestuff
/next i
/return
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

DrmChld
a ghoul
a ghoul
Posts: 89
Joined: Fri Jul 09, 2004 3:25 pm

Post by DrmChld » Mon Nov 21, 2005 12:41 pm

Thanks..

Can you elaborate on this line? :)


/if (${Variable${i}}==SomeValue)

He is what I have so far..But having a problem with the above line. I'm macroly-challenged

TIA

Code: Select all

Sub Main

/declare i int local 


/for i 1 to 10
/if (${Variable${i}}==10){ 
	/keypress ALT+9
	/delay 7s
	/autoinventory
}

/next i 


/return

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Mon Nov 21, 2005 1:14 pm

DrmChld wrote:Thanks..

Can you elaborate on this line? :)


/if (${Variable${i}}==SomeValue)
That was just an example of how to do some kind of test. You don't need it, remove that line and the curly brackets. And change that /keypress crap to /cast or better yet, use spell_routines.inc to make it catch fizzles and stuff.

notadruid
a ghoul
a ghoul
Posts: 143
Joined: Mon Dec 08, 2003 6:02 pm

Post by notadruid » Mon Nov 21, 2005 1:48 pm

The if is not needed. You would want this:

Code: Select all

Sub Main

/declare i int local 


/for i 1 to 10
  /keypress ALT+9
  /delay 7s
  /autoinventory
/next i

/return
I assume you're summoning stuff / imbuing gems?
I am not a druid.

xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Loop something a certain amount of times?

Post by xyilla » Wed Jun 25, 2025 1:12 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Loop something a certain amount of times?

Post by xyilla » Wed Jun 25, 2025 1:13 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Loop something a certain amount of times?

Post by xyilla » Wed Jun 25, 2025 1:14 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Loop something a certain amount of times?

Post by xyilla » Wed Jun 25, 2025 1:15 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Loop something a certain amount of times?

Post by xyilla » Wed Jun 25, 2025 1:17 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Loop something a certain amount of times?

Post by xyilla » Wed Jun 25, 2025 1:18 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Loop something a certain amount of times?

Post by xyilla » Wed Jun 25, 2025 1:19 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Loop something a certain amount of times?

Post by xyilla » Wed Jun 25, 2025 1:20 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Loop something a certain amount of times?

Post by xyilla » Wed Jun 25, 2025 1:21 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Loop something a certain amount of times?

Post by xyilla » Wed Jun 25, 2025 1:22 am