Need Ini/Chat help

This is how not to ask for help
psychosis
a lesser mummy
a lesser mummy
Posts: 32
Joined: Fri Jan 28, 2005 2:23 pm

Need Ini/Chat help

Post by psychosis » Wed Mar 30, 2005 9:50 am

[[DataType:string]]

Im working on tweaking a macro (buffbot) while in and of its self it is a awsome macro it does have a few limitations.

NOTE:
Yes I have RTFM.
Yes I have Searched the board.
Yes I have read amost all the help forum.

While I have learned alot in doing this im getting close to figuring it out but there are a few things im missing.

This is how the buffbot macro searches incomming text to determine if it needs to buff.

Code: Select all

   /varset RequestedBuff ${Text}
   /if (${RequestedBuff.Right[50].Equal["Sorry, I am A.F.K. (Away From Keyboard) right now."]}) /varset RequestedBuff ${RequestedBuff.Left[-50]}
    
   /if (${RequestedBuff.Left[12].Equal["can i get a "]})   /varset RequestedBuff ${RequestedBuff.Right[-12]}
   /if (${RequestedBuff.Left[10].Equal["can i get "]})      /varset RequestedBuff ${RequestedBuff.Right[-10]}
   /if (${RequestedBuff.Right[13].Equal[" when you can"]})   /varset RequestedBuff ${RequestedBuff.Left[-13]}
   /if (${RequestedBuff.Right[3].Equal[" ty"]})         /varset RequestedBuff ${RequestedBuff.Left[-3]}
   /if (${RequestedBuff.Right[4].Equal[" plz"]})         /varset RequestedBuff ${RequestedBuff.Left[-4]}
   /if (${RequestedBuff.Right[4].Equal[" pls"]})         /varset RequestedBuff ${RequestedBuff.Left[-4]}
   /if (${RequestedBuff.Right[5].Equal[" pls!"]})         /varset RequestedBuff ${RequestedBuff.Left[-5]}
   /if (${RequestedBuff.Right[5].Equal[" plZ!"]})         /varset RequestedBuff ${RequestedBuff.Left[-5]}
   /if (${RequestedBuff.Right[4].Equal[" wmp"]})         /varset RequestedBuff ${RequestedBuff.Left[-4]}
   /if (${RequestedBuff.Right[8].Equal[" please!"]})      /varset RequestedBuff ${RequestedBuff.Left[-8]}
   /if (${RequestedBuff.Right[7].Equal[" please"]})      /varset RequestedBuff ${RequestedBuff.Left[-7]}
   /if (${RequestedBuff.Right[4].Equal[" wmp"]})         /varset RequestedBuff ${RequestedBuff.Left[-4]}
   /if (${RequestedBuff.Right[3].Equal[" =)"]})         /varset RequestedBuff ${RequestedBuff.Left[-3]}
   /if (${RequestedBuff.Right[3].Equal[" :)"]})         /varset RequestedBuff ${RequestedBuff.Left[-3]}
   /if (${RequestedBuff.Right[2].Equal[" )"]})         /varset RequestedBuff ${RequestedBuff.Left[-2]}
   /if (${RequestedBuff.Right[1].Equal["?"]})            /varset RequestedBuff ${RequestedBuff.Left[-1]} 
Sadly you have to modify this every time you want it to handle a different BS response some one tosses your way. This makes it slightly cumbersom to work with at times.

I found the ChatText.Find[] command. Thought I had it working but I guess I didnt put it in correctly.

I am trying to get the variables in the INI file to be loaded into an array and used in the find command and search the chat text that is incomming to search out the requested buffs.

I have no clue how to do this.

If I missed something and or over looked something its very probable. I just think that it would be nice to leave the macro alone and only worry about modifying the ini file.

Any help on this would be greatly appreciated.

TY in advance.

pandera13
orc pawn
orc pawn
Posts: 15
Joined: Sat Mar 05, 2005 11:07 pm

Post by pandera13 » Wed Mar 30, 2005 10:39 am

Possibly look at the druidbot code. I know it searches the ini buff section for aliases. Not sure if that is what you are looking for, but should be close to it I would think. You list your buff details on one line and then place your aliases on another line. The macro then searches through the alias line of each buff and casts that buff if the appropriate text is found.
http://www.macroquest2.com/phpBB2/viewtopic.php?t=10040
Ini Sample

Code: Select all

DoBuff2=Steeloak Skin 
DoBuffGem2=gem3 
DoBuffIcon2=Steeloak Skin 
DoBuffIndoors2=1 
DoBuffAliases2=Oak|9|nine|Steel|Skin|

Code: Select all

Sub Event_Chat(string ChatType,string Sender,string ChatText) 
/declare a        int local 
/declare i        int local 
/declare MyTarget int local 
/if (!${RDPause} || !${DoBuffTotal} || !${DoBuffs}) /return 
:WaitToBuff 
/if (${Me.Moving} || ${Me.Casting.ID} || (${Me.Gem[${DoBuff[${i}]}]} && !${Me.SpellReady[${DoBuff[${i}]}]}) || (${SitTimer} && !${Me.Gem[${DoBuff[${i}]}]} && !${Me.Mount.ID})) { 
  /call CheckGroup 
  /goto :WaitToBuff 
} 
/for i 1 to ${DoBuffTotal} 
/for a 1 to ${DoBuffAliases[${i}].Count[|]} 
/if (${ChatText.Find[${DoBuffAliases[${i}].Arg[${a},|]}]}) { 
  /call CheckGroup 
  /if (!${Outdoors} && !${DoBuffIndoors[${i}]}) /goto :NextDoBuff 
  /varset MyTarget ${Target.ID} 
  /varset BuffGuy ${Spawn[pc ${Sender}].ID} 
  /call TargetGuy 
  /if (${TargetReturn.Equal[TARGET_SUCCESS]}) { 
    /if (${ReportDoBuffs} && !${SpamTimer}) /tt Buffing you with ${DoBuff[${i}]} 
    /if (${ReportDoBuffs} && !${SpamTimer} && ${Target.CleanName.NotEqual[NULL]}) /${ChatChannel} Buffing ${Target.CleanName} with ${DoBuff[${i}]} 
    /varset SpamTimer ${SpamDelay} 
    /if (${DoBuffGem[${i}].Equal[item]} && (${Target.Distance}<${Spell[${DoBuffID[${i}]}].Range} || ${Target.Distance}<${Spell[${DoBuffID[${i}]}].AERange})) { 
      /call Cast "${DoBuff[${i}]}" item 1s Check4Pad 
    } 
    /if (${DoBuffGem[${i}].Equal[alt]} && ${Me.AltAbilityReady[${DoBuff[${i}]}]} && (${Target.Distance}<${Spell[${DoBuffID[${i}]}].Range} || ${Target.Distance}<${Spell[${DoBuffID[${i}]}].AERange})) { 
      /call Cast "${DoBuff[${i}]}" alt 1s Check4Pad 
    } 
    /if (${Me.CurrentMana}>${Spell[${DoBuffID[${i}]}].Mana} && (${Target.Distance}<${Spell[${DoBuffID[${i}]}].Range} || ${Target.Distance}<${Spell[${DoBuffID[${i}]}].AERange})) { 
      /call Cast "${DoBuff[${i}]}" ${DoBuffGem[${i}]} 1s Check4Pad 
    } 
    /target id ${MyTarget} 
  } 
} 
/next a 
:NextDoBuff 
/next i 
} 
/return
You will have to figure out how to modify al the inc sections on your own though. Played around with it some, but took the lazy way out till I get a little more time to work on adding a ports section to it.

psychosis
a lesser mummy
a lesser mummy
Posts: 32
Joined: Fri Jan 28, 2005 2:23 pm

Post by psychosis » Wed Mar 30, 2005 11:11 am

Here is a example of what Im trying and failing at.

Code: Select all

Sub Event_HandleBuffRequest(FullText, Player, Text)

   /declare Buff          string local
   /declare thebuff       string local
   /declare AllowedBuff   int    local NOT_FOUND
   /declare RequestedBuff string local
   /declare count         int    local 0 

	 /varset RequestedBuff ${Text}
     /if (${RequestedBuff.Find[$Ini[BUFFBOT_INI, ${Me.Class.Name}, [color=red]?!Load Vars!?[/color]}] ${RequestedBuff} /varset RequestedBuff ${RequestedBuff}

     /if (${RequestedBuff.Length} < 1) {
       /echo # Debug: too short text
       /return
     }

     /if (${RequestedBuff.Length} > 25) {
       /echo # Debug: too long text
       /return
     }

   |Process buff request
   /echo # Debug: looking for ${RequestedBuff}
   /varset Buff ${Ini[BUFFBOT_INI, ${Me.Class.Name}, ${RequestedBuff}, NOT_FOUND]}
   /echo # Debug: result ${Buff} 
Trying to use the InI to load the searchable values and loop through them to search them out of the text that comes in. Failing out if not found or casting the buff if found.

CheckinThingsOut
a ghoul
a ghoul
Posts: 81
Joined: Wed Jun 30, 2004 3:11 pm

Post by CheckinThingsOut » Wed Mar 30, 2005 1:23 pm

Code: Select all

/declare DoBuff[10]          string outer
/declare DoBuffAliases[10]   string outer
/declare DoBuffGem[10]       string outer
/declare DoBuffIcon[10]      string outer

/varset MyIni buffbot_${Me.CleanName}.ini
/declare i int local

/for i 1 to 10

     /varset DoBuff[${i}] ${Ini[${MyIni},DoBuffStuff,DoBuff${i},NOTFOUND]}
     /if (${DoBuff[${i}].Equal["NOTFOUND"]}) {
         /ini "${MyIni}" DoBuffStuff DoBuff${i} "Do Buff Item/Spell #${i}"
         /varset DoBuff[${i}] "Do Buff Item/Spell #${i}"
     }

     /varset DoBuffAliases[${i}] ${Ini${MyIni},DoBuffStuff,DoBuffAliases${i},NOTFOUND]}
     /if (${DoBuffAliases[${i}].Equal["NOTFOUND"]}) {
         /ini "${MyIni}" DoBuffStuff DoBuffAliases${i} "Put the keywords you want to respond to for this buff"
         /varset DoBuffAliases[${i}] "Put the keywords you want to respond to for this buff"
     }

     /varset DoBuffGem[${i}] ${Ini[${MyIni},DoBuffStuff,DoBuffGem${i},NOTFOUND]}
     /if (${DoBuffGem[${i}].Equal["NOTFOUND"]}) {
          /ini "${MyIni}" DoBuffStuff DoBuffGem${i} "Do Buff #${i} Gem or put Item if an item"
          /varset DoBuffGem[${i}] "Do Buff #${i} Gem or put Item if an item"
     }

     /varset DoBuffIcon[${i}] ${Ini[${MyIni},DoBuffStuff,DoBuffIcon${i},NOTFOUND]}
     /if (${DoBuffIcon[${i}].Equal["NOTFOUND"]}) {
          /ini "${MyIni}" DoBuffStuff DoBuffIcon${i} "Do Buff #${i} Buff Icon"
          /varset DoBuffIcon[${i}] "Do Buff #${i} Buff Icon"
     }

/next i

Code: Select all

Sub Event_HandleBuffRequest(FullText, Player, Text)
    /declare i        int local
    /for a 1 to ${DoBuffAliases[${i}].Count[|]}
         /if (${ChatText.Find[${DoBuffAliases[${i}].Arg[${a},|]}]}) {
              Do Buff Here
         }
    /next a
/return

Code: Select all

DoBuff2=Steeloak Skin 
DoBuffGem2=gem3 
DoBuffIcon2=Steeloak Skin 
DoBuffAliases2=Oak|9|nine|Steel|Skin|
Here is some skeleton code taken from druidbot. It should get you on the path. It won't work just by pluging in what I have here though. You'll have to play with it.
Supports up to 10 DoBuffs.

psychosis
a lesser mummy
a lesser mummy
Posts: 32
Joined: Fri Jan 28, 2005 2:23 pm

Post by psychosis » Wed Mar 30, 2005 1:53 pm

I'm sorry I am not a druid nor am I interested in using DruidBot, I would have posted about DruidBot if I was. I am using buffbot which is much easier to work with over all. I am only trying to figure out a few things dealing with looping through variables stored in a INI file.

So can we please stick to the topic and macro in discussion?

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 » Wed Mar 30, 2005 2:05 pm

If you can't get it working, it must not be a whole lot easier to work with then huh? Tool. It amazes me how someone can throw attitude at someone who is genuinely trying to help them. Moron. My buffing code in RaidDruid deals with exactly the problem you're having. Cuntwaffle
[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]

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Wed Mar 30, 2005 2:25 pm

NOTE:
Yes I have RTFM.
Yes I have Searched the board.
Yes I have read amost all the help forum.
Grats, but NOTE:
No you did not follow the instructions for posting on MQ2::Macros::Help.
# Sign up and log into the wiki
# Navigate on the wiki to the place you think the answer to your question should be found. Start from the Main Page, and navigate via the links on the page until you reach your goal. Don't use the "search" box and give up. The answer to your question should also not be found in a "discussion" page.
# Hit an "edit" link on the page -- these links appear at the top of each page, and at each section within the page
# In the edit box, type what you think the answer to your question should be, even if you do not know for sure. Make it informative, rather than inquisitive (do not ask a question -- state an answer). You don't need to know any special codes to add to the wiki; Simply put the answer as you think it should read.
# Hit the "Save page" button, found below the edit box.
# Get the URL to the page you edited, for example http://www.macroquest2.com/wiki/index.php/Help_Forums is the URL to this page. Alternatively, you can just get the title of the page, found at the very top, right below the tabs that say article, discussion, edit, etc. For example, Help Forums is the title of this page.
# Post a new thread on the help forum, with a descriptive title. Do not title your post "help please", just try to explain it as best you can in a few words. Inside the thread, make sure to include the URL to the page you edited, or the title of the page inside [[]], like this: [[Help Forums]]. Also explain what you added to the wiki, and ask if it needs to be corrected or changed. You can say whatever else in the post you like, but this is the most important thing.
# Wait for someone to respond to your thread. If your addition to the wiki must be corrected or changed, it is likely that someone will do it for you, and then respond. If you were right, then you lost absolutely nothing, and either way your question should be answered for the next person to have the same question.
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0