Bug? /if handling

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

LordGiddion
a snow griffon
a snow griffon
Posts: 352
Joined: Sat Sep 13, 2003 6:12 pm
Contact:

Bug? /if handling

Post by LordGiddion » Thu Oct 30, 2003 10:50 am

if there is an error in macro code these 2 lines are handled differently.

Code: Select all

/if @x==@y /if @x==@z /varset same 1
/if (@x==@y && @x==@z) /varset same 1
if for example x was equal to "some crap" the first line would error as "couldn't find comparision operator in 'some '" where as the second line errors out AND ends the macro with the error syntax error in /if comparison else comparison or something simular - would it be possible for both to error gracefully and continue?

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Post by MacroFiend » Thu Oct 30, 2003 11:24 am

If you are ever going to compare non-numeric data, you should (for your own sanity) put the variables inside quotes. That way spaces and other special characters don't cause the parser to choke.

Code: Select all

/if "@x"=="@y" /if "@x"=="@z" /varset same 1 
I didn't know if was possible to do compound comparisons inside an if (2nd example)

LordGiddion
a snow griffon
a snow griffon
Posts: 352
Joined: Sat Sep 13, 2003 6:12 pm
Contact:

Post by LordGiddion » Thu Oct 30, 2003 12:04 pm

I know about using quotes, that was just an easy example of a fail, the issue is that compond comparisons endmacro if there is something not quite right. And stacked comparisons give you an error and continue execution.

I preffer the compond comparisons, it's more dificult to do || (or) with the stacked or nested comparisons. But for example where Grimjack and I develope the genbot mac together he changed all my compond comparisons to nested ones because of the way they error.

Plazmic
The One
The One
Posts: 800
Joined: Fri Jun 14, 2002 12:31 am
Contact:

Post by Plazmic » Thu Oct 30, 2003 12:23 pm

If any parsing error continues the macro, that is a bug. All parsing errors should (and will when I fix this one) end the macro gracefully.
The goal is to make people write good macros, not ones that have errors but still manage to work.
- Plazmic

boredom
a lesser mummy
a lesser mummy
Posts: 49
Joined: Thu Jun 19, 2003 3:45 pm

quotes

Post by boredom » Thu Oct 30, 2003 3:56 pm

Is there any way of detecting if there is a quotation mark in a string? For example, if someone on the master list sends a tell to GrimJack's bot with a quote in it, you get about 50 repeats of this error.

/Bored