What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Guild function problem

BPAlpha

New Member
Joined
Jan 15, 2010
Messages
594
Reaction score
41
trying to make my allrounder use guild bank to take an deposit items but having problems with this line... any ideas on what im doing wrong??

Code:
if (Lua.GetReturnValues("GetGuildBankItemLink(" + tab.ToString() + "," + slot.ToString() + ")", "trade.lua").Contains("36912"))

this is error im getting
Code:
[13:19:06:342] System.NullReferenceException: Object reference not set to an instance of an object.
   at Guildcontrol.Guildcontrol.Pulse() in c:\Users\Desktop\HB\Plugins\Guildtest.cs:line 98
   at Styx.Plugins.PluginWrapper.Pulse()
 
will my "withdraw elementium ore" macro's help?
Code:
/run for t=1,GetNumGuildBankTabs()do for s=1,98 do local l=GetGuildBankItemLink(t,s)if l and strfind(strlower(l),"elementium ore")then AutoStoreGuildBankItem(t,s)end end end
(the "xxx xxx" is lowercase only due to the 2nd strlower)
 
Last edited:
not really as its only 1 item i have a list of around 50 items but thanks for idea :)
 
Lua.GetReturnValues is not returning anything so the "Contains(...)" extention method has no collection to operate on.

I'd suggest moving that to a variable and using conditional to check whether the variable is null.

-Alpha

Edit: The above is what I feel is the most likely but it could also be that the "tab" and "slot" variables are null which makes the ToString(...) method fail for the same reason I think, I can't remember right now whether the ToString(...) method handles the situation itself.
 
Last edited:
tabs and slot are both returning a value think its something to do with how i done containing!! the plugin can seem to find the item im trying to loot.. i can get it to loot all guild bank items just not specific items..
 
Give the below a try but put something in for the logging part so you can see what's being passed in etc.

Code:
String command = String.Format("GetGuildBankItemLink({0}, {1})", tab, slot);
String[] values = Lua.GetReturnValues(command, "trade.lua");
if (values != null)
{
    if (values.Contains("36912"))
    {
        //Found, do something with it...
    }
}
else
{
    //Insert code to log no values returned from Lua, include tab and slot for debugging purposes
}
 
getting compile error cant convert
Code:
<string> to "string"
 
Oh duh, sorry I wrote the code straight into the box here without using IDE. Lua.GetReturnValues returns a List<String> not a String[]. Should be as below...sorry...

Code:
String command = String.Format("GetGuildBankItemLink({0}, {1})", tab, slot);
List&lt;String&gt; returnValues = Lua.GetReturnValues(command, "trade.lua");
if (returnValues != null)
{
    if (returnValues.Contains("36912"))
    {
        //Found, do something with it...
    }
}
else
{
    //Insert code to log no values returned from Lua, include tab and slot for debugging purposes
}
 
Last edited:
think i got to bottom of it.. its not returning anything for the guildinfo!! here is source code if any1 could help it would be great.. need it to loot all items within _itemlist
 

Attachments

Code:
                for (int tab = 1; tab <= tabNum; tab++)
                {
                    Lua.DoString("SetCurrentGuildBankTab(" + tabNum.ToString() + ")");

Should this be tabNum.ToString() or tab.ToString()? Also, "tab <= tabNum; tab++" would add one tab too many, suggest "tab < tabNum". Lua.LuaGetReturnValue is deprecated, you should use Lua.GetReturnValues now.

Also, I can't see how the code below would actually be fired. I've never seen this situation before but it doesn't break in the compiler. In particular the first line essentially says "if this is true, return...and somehow execute this after you've already returned...". As I said though this may be something I've never come across before or I'm missing something as it didn't technically break the build but many things that cause an issue don't, it's not really a debugging tool lol

Code:
                                if (ObjectManager.Me.FreeBagSlots <= 2) return;
                                {
                                    if (Lua.LuaGetReturnValue("return GetGuildBankItemLink(" + tab.ToString() + "," + slot.ToString() + ")", "trade.lua")[0].Contains("36912"))
                                    {
                                        Lua.DoString("AutoStoreGuildBankItem(" + tab.ToString() + "," + slot.ToString() + ")");
                                    }
                                    else if (ObjectManager.Me.FreeBagSlots == 2)
                                    {
                                        break;
                                    }
                                }

-Alpha
 
Last edited:
im sure it will be something simple just cant get my head around it
 
I've quickly gone through and rewritten parts of the code. I'm just starting work at the moment so haven't had time to test. Please try the attached and if it works I'll explain the rest of the changes I've made etc. I'll check the board through the day but will be home around 7pm UK time.

View attachment Guildtest.cs

-Alpha
 
Last edited:
[18:17:22:535] System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at Styx.WoWInternals.Lua.GetReturnVal[T](String lua, UInt32 retVal)


error im getting now..
 
if (Lua.GetReturnVal<String>("return GetGuildBankItemLink(" + tabNum.ToString() + "," + slot.ToString() + ")", 0).Contains("36912"))

still cant get past this line
 
Same error message?

I'm at home now so I'm going to load it up and give it a try too.

-Alpha
 
Okay, I've mostly got this figured out. I've got it actually withdrawing items etc. I'm going to put it through its paces with more testing, maybe tweak a little, then will post an updated version.

Replied to your PM now ;)

-Alpha
 
Getting tired, here's what I have so far. It will withdraw items (I used a different item code for something I know I have in guild bank) etc. It will however do this constantly at the moment, you'll need to have some "only run once every x minutes" or "continue with grind" or "sleep" and so on which isn't there right now.

Also, I had some debug logging which is still in there, you may wish to remove this as it will spam the HB log for every tab / slot check. Add me on MSN (PMd you) and we can talk through the code etc, am happy to give any help I can. Check out your "CanViewGuildTab", this was using the wrong API function as that's only available on the edit permissions section of the control panel.

View attachment Guildtest.cs

-Alpha
 
Back
Top