**solved** proper /if syntax

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

horseshoecrabs
a ghoul
a ghoul
Posts: 89
Joined: Fri Jun 10, 2005 6:35 pm

Post by horseshoecrabs » Fri Oct 07, 2005 1:40 pm

http://www.macroquest2.com/phpBB2/viewt ... 69&start=0

The link above is to my mana robe macro, which isn't relevant to your question. However, starting at the bottom of the first page, the conversation morphs into a dialog about when and when not to use quotation marks and it helped me a lot. Make sure you read the thread into page two as there are some fantastic explanations in there about quotations, delimiters, etc.

Bottom line: don't use quotes in /declare statements and instead use them only when they are necessary such as calling a spell. To my knowledge, they are never used for integers. The only exception I could imagine is if you were looking at (or for) a string that looked like an int. in which case the string handling rules still apply.

ultimateq
a lesser mummy
a lesser mummy
Posts: 44
Joined: Sun Aug 07, 2005 11:50 am

Post by ultimateq » Fri Oct 07, 2005 1:51 pm

Thanks Horse. Was not sure how that worked. This has all been very informative.

Thankyou all for helping this noob find his way. My macro just went from unworkable to slightly more workable :smile:

Edit: Thankyou Again. I understand much better on how everything works.

larry1024
a ghoul
a ghoul
Posts: 131
Joined: Tue Apr 19, 2005 11:28 pm

Post by larry1024 » Wed Feb 01, 2006 6:25 am

ok i'm a newb at this macoing but was wondering what is so wrong witht he bellow?

#event Yaulp "Your surge of strength fades."
sub event_makemypetgoaway(string line,string zone)
/if (${Me.Class.Name.Equal["cleric"]}) {
| Refreshing Yaulp
/echo #Refreshing Yaulp
/cast cast 8

just trying to refresh yalp every 30 seconds

User avatar
gimp
a grimling bloodguard
a grimling bloodguard
Posts: 584
Joined: Fri Oct 29, 2004 9:28 am
Location: internet

Post by gimp » Wed Feb 01, 2006 6:56 am

larry1024 wrote:ok i'm a newb at this macoing but was wondering what is so wrong witht he bellow?

#event Yaulp "Your surge of strength fades."
sub event_makemypetgoaway(string line,string zone)
/if (${Me.Class.Name.Equal["cleric"]}) {
| Refreshing Yaulp
/echo #Refreshing Yaulp
/cast cast 8

just trying to refresh yalp every 30 seconds
you should make a new thread if you have a new question :)

your bug is that your event routine is incorrectly named.
rename event_makemypetgoaway to event_Yaulp. also remove string zone parameter

Harden
a hill giant
a hill giant
Posts: 244
Joined: Thu Aug 25, 2005 8:23 pm

Post by Harden » Wed Feb 01, 2006 2:08 pm

larry1024 wrote:ok i'm a newb at this macoing but was wondering what is so wrong witht he bellow?

#event Yaulp "Your surge of strength fades."
sub event_makemypetgoaway(string line,string zone)
/if (${Me.Class.Name.Equal["cleric"]}) {
| Refreshing Yaulp
/echo #Refreshing Yaulp
/cast cast 8

just trying to refresh yalp every 30 seconds
If you have spell routines inc try this: (Only need to add #include spell_routines.inc if it's not already included in the macro your writing this for.

Code: Select all

#include spell_routines.inc

#event   Yaulp      "Your surge of strength fades." 
sub event_Yaulp 
   /if (${Me.Class.Name.Equal["cleric"]})  {
      |Refreshing Yaulp 
      /echo #Refreshing Yaulp 
      /call cast "Yaulp VII" gem8 
   }
/return
Just a point of interist. After the first time you cast Yaulp VII, this will refresh it indefinatly, every time your chat see's "Your surge of strength fades."
-Harden
I wanna be a Macro Writer when I grow up!

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Wed Feb 01, 2006 3:04 pm

well if that isn't the hard way to do it.
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

rapierguy
a ghoul
a ghoul
Posts: 122
Joined: Thu Apr 14, 2005 1:07 am

Post by rapierguy » Mon Feb 20, 2006 1:49 pm

nils wrote:

Code: Select all

| chat.mac
#Chat Chat

Sub Main

/declare channel         string outer mychannel
/join ${channel}

:Main_Loop
  /delay 1
  /doevents
  /goto :Main_Loop
/return

Sub SomeSub
   /chat #${channel} If this is working you should see this First
/return

Sub event_Chat(string ChatType,string Sender,string ChatText) 
   /if (${ChatType.Equal[${channel}]}) {
      /if (${ChatText.Equal[bla]} || ${ChatText.Equal[bla bla]} || ${ChatText.Equal[blah]} || ${ChatText.Equal[blah blah]}) /call SomeSub
          /chat #${channel}  You should see this Second
          /tell ${Sender} it worked!
   }
/return
Just out of curiosity could the above code be converted into an .inc file so multiple macros could make use of it? Example would be a shammy macro, chanter macro, cleric macro and war macro could access the same channel what have you and add

Code: Select all

#include chat.inc 
to the macros

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 Feb 20, 2006 5:18 pm

Very easily. Look at feedme.inc and feedme.mac for an example
[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]

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

Re: **solved** proper /if syntax

Post by xyilla » Wed Jun 18, 2025 7:31 pm


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

Re: **solved** proper /if syntax

Post by xyilla » Wed Jun 18, 2025 7:32 pm


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

Re: **solved** proper /if syntax

Post by xyilla » Wed Jun 18, 2025 7:33 pm


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

Re: **solved** proper /if syntax

Post by xyilla » Wed Jun 18, 2025 7:34 pm


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

Re: **solved** proper /if syntax

Post by xyilla » Wed Jun 18, 2025 7:36 pm


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

Re: **solved** proper /if syntax

Post by xyilla » Wed Jun 18, 2025 7:37 pm


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

Re: **solved** proper /if syntax

Post by xyilla » Wed Jun 18, 2025 7:38 pm