The following warnings occurred:
Warning [2] Undefined variable $search_thread - Line: 60 - File: showthread.php(1617) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1617) : eval()'d code 60 errorHandler->error_callback
/showthread.php 1617 eval
Warning [2] Undefined variable $forumjump - Line: 89 - File: showthread.php(1617) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1617) : eval()'d code 89 errorHandler->error_callback
/showthread.php 1617 eval




A GHI challenge, You are not Prepared!
#1
Who ever can figure this out I will give them 100g !

I have been trying to figure this out successfully for months now and it has still eluded me. I am working on a better more cohesive, user friendly combat system but I am missing an element of code that wold be extremely useful and make things much easier for that common combatant.

What I am trying to figure out is how to remove a buff, but with code not the little do hickey that comes with GHI.

Pilus (The creator of GHI) did give us part of the code with this

Code:
RemoveGHIBuff
Remove a buff on yourself
Input: index,filter
# index (number): buff index to remove
# filter (string): "HELPFUL" for buffs and "HARMFUL" for debuffs
from here http://pilus.info/cms/phpbb/viewtopic.php?p=2828#p2828

The thing is, that removes buffs from their index number, not their name. So it removes buffs from which order they are in not by name. You can't always guarantee which order any one persons buffs will be in so this is not that useful. What I am looking for is code that will remove a buff by name, so if it is, say the second or thrid buff down the line it will remove it, and not the ones before it.

Also, I would want it to remove a portion of a stack of buffs. For example, you have a buff called HP and it is stacked 45 times I want to be able to remove 10 of those HP buffs.

I did ask Pilus about this and he gave me this bit of code but I have never got it to work.
Code:
found = false;
for i = 1,#(GHI_BuffList) do
  if type(GHI_BuffList[i])=="table" then
    if GHI_BuffList[i].name == "con" then
      k = GHI_BuffList[i].index
      found = true;
    end
  end
end

if found == true then
  local a = GHI_BuffList[k].amount;
  if a > 4 then
    a = GHI_BuffList[k].amount - 4
  else
    RemoveGHIBuff(k, "HELPFUL")
  end
end

Here are some resources that should help.

http://pilus.info
http://wowprogramming.com
http://www.wowpedia.org/Portal:Interface_customization

I am leaving for a week on vacation so I will be back next Tue. and can reward any one who figures this out then.
Reply
#2
Just bash your computer around a bit.
That should do the trick.
Reply
#3
Your GHI Combat System is always a treat Dusk. Hope to see the solution to this soon.
[Image: 2r3hym9.png]
Main Characters:
Riggs Ravenhook - Swarmy Old Goblin Thief and Corporate Nuisance
Gorudo Goldforge - Goldforge Clan Remnant and Ranger
Turic Carsten - Stormwind Regular

http://diethe.deviantart.com/
Reply
#4
We really, really need such a system. The last one was awesome too but it never really took off.

And no, I know nothing about codes and stuff.
I would never die for my beliefs because I might be wrong.
Bertrand Russell
Reply
#5
I might take a poke at this. But I doubt I'll figure it out.
Wow. Sometimes I forget the past.
Reply
#6
Could you be a bit more specific, I understand code well, but not lua and WoW addons. Are you trying to create a new function that would search through the GHI Buff list by name, then remove it?
Reply
#7
Yes that is it exactly.

But if you can find a better way I am all for that too. I am not so worried about the means but the end.
Reply
#8
Then, is it your intent to just run this lua code in a macro, or should I just try to built it into the API and send you an updated lua file?
Reply
#9
No not in a macro but more like an addon type situation. Or through a GHI item in the script function.
Reply
#10
Think you can give me a better idea, you plan to just click on a GHI item and remove some buffs from the player?
Reply
#11
Goarn Wrote:Think you can give me a better idea, you plan to just click on a GHI item and remove some buffs from the player?

Essentially this seems true.

Also...WHATS THIS ABOUT GHI COMBAT?! IT sounds fun!

I demand an explanation.
[Image: Ml7sNnX.gif]
Reply
#12
Kind of but I am removing a GHI Buff with script or code not the Remove Buff right click action that comes with GHI.

This will be done with slash commands automatically when they make certain rolls. It is hard to explain with out laying out the whole system. But an exsample would be when they make a Magic Attack Roll they can type
Code:
/ma congers a bolt of lighting at hurls it at Bob
and it will make the emote
Joe congers a bolt of lighting at hurls it at Bob
and I want it to take 5 mana points from the stack of 50 MP buffs

The code ends up being much too large for one item so I am making it an Addon that just uses GHI buffs and other GHI functions.

And it is very fun Aphetoros, and it is coming very soon.
Reply
#13
Sorry for the duble post.

I was working more on the problem and I got this peice of code that I got strait out of the GHI Addon to work for me but only sometimes.
Code:
if not(GHI_RemoveGHIBuff_v2)
    then GHI_RemoveGHIBuff_v2  = function(name,filter,amount)
      local list,changed;
      if filter=="HELPFUL"
          then list = GHI_BuffList;
      elseif filter=="HARMFUL"
          then    list = GHI_DebuffList;
          end
      if type(list)=="table"
      then for i = 1,#(list)
      do if type(list[i])=="table"
          then if list[i].name == name
              then if (list[i].amount or 0) <= amount
             then amount = amount - list[i].amount; list[i] = nil;
      else list[i].amount = list[i].amount - amount; amount = 0; break;
          end
      changed = true;
      end
          end
              end
      if changed == true
          then list.lastUpdated = time();
      if filter=="HELPFUL"
          then GHI_BuffList = list;
      elseif filter=="HARMFUL"
          then GHI_DebuffList = list;
              end
      GHI_RerunBuffUpdate = true;
      GHI_UpdateAllBuffs();
          end
              end
                  end
                      end
      
      GHI_RemoveGHIBuff_v2("Buff 2","HELPFUL",5)

To be honest I am really not that good with code I just wish I was. I do a lot of frankenstein coding. But what ever works right.
Any way I bet this code can be condensed down it seems to be saying more than I need.
Reply




Users browsing this thread: 1 Guest(s)