If statement syntax error

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

Moderator: Moderators

xaphyre
Noob
Noob
Posts: 5
Joined: 04 May 2013, 20:04
Noob?: Yes

If statement syntax error

#1 Post by xaphyre »

Hi, I would like to know why do I keep getting this syntax error problem when there doesn't seem to be any?
I'm pretty sure I have encoded it in UTF-8 without BOM format.
Any help would be appreciated. Thank you!
Image

Image
Raider
The Kore Devil
The Kore Devil
Posts: 672
Joined: 22 Feb 2013, 03:40
Noob?: No
Location: The Netherlands

Re: If statement syntax error

#2 Post by Raider »

You have downloaded the latest Openkore revision? The developers have implemented the if and else if some weeks ago, so old Openkore builds won't recognize it.
xaphyre
Noob
Noob
Posts: 5
Joined: 04 May 2013, 20:04
Noob?: Yes

Re: If statement syntax error

#3 Post by xaphyre »

I'm using revision 8545.
However, I still have the same problem.
This is what happens when I load my macro.
Image
Raider
The Kore Devil
The Kore Devil
Posts: 672
Joined: 22 Feb 2013, 03:40
Noob?: No
Location: The Netherlands

Re: If statement syntax error

#4 Post by Raider »

Code: Select all

macro foo {
     if ($.zeny > 0) {
        log Rich
     }
}
This just works for me. Try checking other macros with if statements: http://openkore.com/index.php/Macro_plugin#IF_statement
xaphyre
Noob
Noob
Posts: 5
Joined: 04 May 2013, 20:04
Noob?: Yes

Re: If statement syntax error

#5 Post by xaphyre »

It doesn't work. I have tried to copy and paste all the codes exactly as provided by you and the link.
It just keeps ignoring my "}" at the end and saying that I have a syntax error in my if statement. :cry:

Edit: Whenever I try to use @commands, I get disconnected
For example:
"do c @go 0"
I've already tried configuring chatLangCode to both 0 and 1, but I still get disconnected.
Is there any ways to solve this problem?
Your help is deeply appreciated. :D
Raider
The Kore Devil
The Kore Devil
Posts: 672
Joined: 22 Feb 2013, 03:40
Noob?: No
Location: The Netherlands

Re: If statement syntax error

#6 Post by Raider »

I'm sorry for the commands problem, we hope to fix that issue. Atleast you are able to bot now :)
Try to download the latest revision of the macro plugin.
http://openkore.svn.sf.net/viewvc/openk ... /?view=tar
xaphyre
Noob
Noob
Posts: 5
Joined: 04 May 2013, 20:04
Noob?: Yes

Re: If statement syntax error

#7 Post by xaphyre »

I'm able to bot as long as I don't use any if statements in my macros.
I still don't know what is wrong though.
It seems to me that the curly braces are causing the problem. (But that's just my guess :? )
But anyway thank you for help! I hope to hear something about the if statement problem soon :>
Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

Re: If statement syntax error

#8 Post by Kaspy »

xaphyre wrote:I'm using revision 8545.
This is the version of OpenKore or Macro Plugin?

Code: Select all

macro foo {
     if ($.zeny > 0) {
        log More 0z
     } else {
		log 0z!
	 }
}
This worked here
Image
rocknroll
Been there done that!
Been there done that!
Posts: 118
Joined: 19 Sep 2011, 07:30
Noob?: Yes

Re: If statement syntax error

#9 Post by rocknroll »

xaphyre wrote:I'm using revision 8545.
However, I still have the same problem.
This is what happens when I load my macro.
Image
maybe that problem causing by BOM ??
i have same problem too, so from now i adding space with # on top

Image
Sorry, my english is very bad !
Raider
The Kore Devil
The Kore Devil
Posts: 672
Joined: 22 Feb 2013, 03:40
Noob?: No
Location: The Netherlands

Re: If statement syntax error

#10 Post by Raider »

I fixed this error by using the latest revision of the macro plugin, restart Openkore after moving the files to the correct folder.
http://openkore.svn.sf.net/viewvc/openk ... /?view=tar