$merchant(has,"Item") is crashing me

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

Moderator: MacroQuest Developers

Joshjje
orc pawn
orc pawn
Posts: 18
Joined: Mon Oct 27, 2003 2:39 pm

$merchant(has,"Item") is crashing me

Post by Joshjje » Mon Oct 27, 2003 2:41 pm

Code: Select all

Sub Main

/if $merchant(has,"Malachite)=="TRUE"
{
/press u
/delay 10
}
/return

This script right here is crashing me, it was working fine pre oct 25th build, and concurrent versions have been crashing me, i tried using the oct 24th build but then $merchant() gives me comparison errors whenever i use it...other people have told me it works fine for them but why should it be crashing for me? can someone please help me. The merchant window is open, the merchant has the item, etc. Using todays build right now.

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

Post by MacroFiend » Mon Oct 27, 2003 2:47 pm

You are missing a quote at the end of Malachite. Try putting the quote in and see if it still dies.

Joshjje
orc pawn
orc pawn
Posts: 18
Joined: Mon Oct 27, 2003 2:39 pm

..

Post by Joshjje » Mon Oct 27, 2003 3:31 pm

Sorry that was a typo, still crashes...now for some strange reason im getting random crashes...grr i dont know

OK I again reverted back to the oct 24th build and ran through the WHOLE script with no errors, except for the $merchant(has still not working which i commented out, and $merchant() gives me comparison errors which doesnt end the macro, also in this part of code:

Code: Select all

/if $char(buff,1)~~"clarity" /return
/if $char(buff,1)==NULL /varset ClarityFlag 1

/if n @ClarityFlag>0 {
/target "myself"
/delay 10
/target myself
/cast 1
/delay 80
/varset ClarityFlag 0
}
when i have calrity 2 on it gives me 2 errors that say couldnt find comparison in 'clarity', and works fine if i dont have it on.

I just want to know if theres a reason why the oct 24th build runs fine save for the few errors and $merchant, while the new builds are crashing me to death. If anybody would like to contact me over AIM, or mIRC and look over my code or whatever id much appreciate it.

Scrime
a ghoul
a ghoul
Posts: 86
Joined: Sun Sep 21, 2003 5:48 pm
Contact:

Post by Scrime » Mon Oct 27, 2003 4:07 pm

I think you are using $char(buff) incorrectly.

If I remember correctly $char(buff, spellname) returns the buff slot number for a buff, 0 if you dont have the buff. So for what you are trying to do, I think that:

Code: Select all

/if n $char(buff,"Clarity II")!=0 /return

would work much better.

I don't know about the other problems you are having.
[url=http://www.catb.org/~esr/faqs/smart-questions.html]asking smart questions[/url]

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

Post by MacroFiend » Mon Oct 27, 2003 6:50 pm

Joshjje, the reason for your $char(buff,xxx) error is the same as what I ended up saying about your first error ... you need more quotes. If you are dealing with a spell that has a space in its name (a la "Clarity II"), you have to have quotes around it for the comparison. If you don't, when the parser goes through and does the replacements, you will end up with something that looks like ...

Code: Select all

/if Clarity II~~"clarity" /return
If you look at it like that, I'm sure you'll see why the quotes are so important. If you aren't dealing with a numeric comparison and you aren't absolutely sure you will never have a space in your variables, save yourself a bit of hassle and put quotes around both sides of the comparator. 4 extra characters won't add much to your script length ... but can save you hours of frustration when trying to debug.

Joshjje
orc pawn
orc pawn
Posts: 18
Joined: Mon Oct 27, 2003 2:39 pm

..

Post by Joshjje » Mon Oct 27, 2003 9:39 pm

Ah yeah i see, the clarity issue is fixed, however, the $merchant(has, "itemname") still poses a problem.

User avatar
Kint
a hill giant
a hill giant
Posts: 208
Joined: Thu Mar 13, 2003 3:36 am

Post by Kint » Tue Oct 28, 2003 1:25 pm

I was talking to someone the other night who was crashing with $merchant(has,XXX). he could echo it and it would work just fine but when he put it in a macro it crashed him hard.

Joshjje
orc pawn
orc pawn
Posts: 18
Joined: Mon Oct 27, 2003 2:39 pm

..

Post by Joshjje » Tue Oct 28, 2003 2:23 pm

/echo $merchant(has, xxx) also crashes me, however, ill try out the new build maybe it works