New feature for 'if': block of commands (r8457)

All about the macro plugin can be found in this forum. This forum is intended for the macro plugin only.

Moderator: Moderators

Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

New feature for 'if': block of commands (r8457)

#1 Post by Kaspy »

Now, from the 8457 revision of the macro plugin, you can use the block of commands 'if'.
The syntax used is identical to the most used languages​​, including Perl.

Here is an example:
Image

Edit:
In the revision 8462, the implemented else.

Here is a complete example:
Image

Edit:
Now I added the 'elsif'!
He is like the else + if.
Basically, it serves to make the commands shorter, readable and optimized.
 
Example with explanation:
Image
Last edited by Kaspy on 30 Mar 2013, 18:53, edited 2 times in total.
Image
Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

Re: New feature for 'if': block of commands (r8457)

#2 Post by Kaspy »

Sent another comminit, implementing indentation in debugger macro
Image
Image
Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

Re: New feature for 'if': block of commands (r8457)

#3 Post by Kaspy »

Fortunately for you, implement the else!
It is enabled if the 'if' is false.
 
Here is a complete example:
Image

If you have further questions, please see this article
Image
Raider
The Kore Devil
The Kore Devil
Posts: 672
Joined: 22 Feb 2013, 03:40
Noob?: No
Location: The Netherlands

Re: New feature for 'if': block of commands (r8457)

#4 Post by Raider »

Nicee, this is very usefull!
Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

Re: New feature for 'if': block of commands (r8457)

#5 Post by Kaspy »

Now I added the 'elsif'!
He is like the else + if.
Basically, it serves to make the commands shorter, readable and optimized.
 
Example with explanation:
Image
Image
forbbs
Human
Human
Posts: 30
Joined: 26 Jul 2011, 21:03
Noob?: Yes

Re: New feature for 'if': block of commands (r8457)

#6 Post by forbbs »

very good!thank you!
forbbs
Human
Human
Posts: 30
Joined: 26 Jul 2011, 21:03
Noob?: Yes

Re: New feature for 'if': block of commands (r8457)

#7 Post by forbbs »

I notice 'if' block of an automacro triggerd after mapchang will report: " error in 0: syntax error in if statement".

like this

Code: Select all

automacro shieldequip {
	location not prontera
	timeout 5
	equipped leftHand none
	call {
		if (@inventory (some shield) > 0) {
			log something to equip
			do eq some shield
		} else {
			log none to equip
		}
	}
}
Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

Re: New feature for 'if': block of commands (r8457)

#8 Post by Kaspy »

Sorry, I not found errors.
Image
Image

Could you post the original macro?
If necessary, you can send me a PM.
Image
Dark Airnel
Been there done that!
Been there done that!
Posts: 133
Joined: 09 Oct 2009, 01:43
Noob?: No

Re: New feature for 'if': block of commands (r8457)

#9 Post by Dark Airnel »

This new added feature is just GREAT!!! I was able to perfect most of my macros because of this new additional feature. Kudos!!!