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

I don?t get the documentation, get errors.

Bengan12

Well-Known Member
Joined
Feb 24, 2011
Messages
1,967
Reaction score
31
Now i followed the documentation, to try to find how to get free bag slots, more like how many.

wo i want this to be an integer so i can post a number right?

so i found in styx.logic.inventory a freeslots function something.

now the documention say
Code:
C#
Code:
Visual basic
Code:
Visual C++

Why?

i go with the C# one as it looks correct.

Code:
public static int FreeSlots { get; }

now this should get number of free slots? or am i just stupied, this is the first time i look in to the documentation.

so i set it to...
Code:
 public static int FreeSlots { get{ return FreeSlots; } }

What i think this will do is to get the number of free slots and put it to an integer named FreeSlots, HB compiles it ok, but when it tries to use it likte this...
Code:
Styx.Helpers.Logging.Write(Color.FromName("Purple"), "We have {0} free slots.", FreeSlots);

HB crashes :D

am i on the right track to get it to work? where can i read more?
 
Now i followed the documentation, to try to find how to get free bag slots, more like how many.

wo i want this to be an integer so i can post a number right?

so i found in styx.logic.inventory a freeslots function something.

now the documention say
Code:
C#
Code:
Visual basic
Code:
Visual C++

Why?

i go with the C# one as it looks correct.

Code:
public static int FreeSlots { get; }

now this should get number of free slots? or am i just stupied, this is the first time i look in to the documentation.

so i set it to...
Code:
 public static int FreeSlots { get{ return FreeSlots; } }

What i think this will do is to get the number of free slots and put it to an integer named FreeSlots, HB compiles it ok, but when it tries to use it likte this...
Code:
Styx.Helpers.Logging.Write(Color.FromName("Purple"), "We have {0} free slots.", FreeSlots);

HB crashes :D

am i on the right track to get it to work? where can i read more?
from what it looks like your returning the Int Freeslots into itself, so since theres nothing there, thats bad. and then your wiring an empty Int directly to a string without converting it to a string. so yea, theres lots of problems

if you havent go to the guides section and read my CC creation guide, so at least you can get your project setup properly, and that will help in the long run in getting what you want coded
 
from what it looks like your returning the Int Freeslots into itself, so since theres nothing there, thats bad. and then your wiring an empty Int directly to a string without converting it to a string. so yea, theres lots of problems

if you havent go to the guides section and read my CC creation guide, so at least you can get your project setup properly, and that will help in the long run in getting what you want coded

where in your guide can i find where to convert an int to a string, already eyed through your guide, and the project is set up as i think it should be.
 
where in your guide can i find where to convert an int to a string, already eyed through your guide, and the project is set up as i think it should be.
theres more wrong then just the int to string issue.

but its .ToString()
 
I'd advise on reading up on C# in general before you run head first in anything really!
 
Don?t feel like reading up on an entire language just to get 1 function that i miss :D sure i was planing to read up on C# but not today.
 
Correct me if I'm wrong here in my assumption what returns which but if I recall correctly:
Code:
ObjectManager.Me.FreeBagSlots
<-- Gives free bag slots regardless of the type of bags (profession bags)
Code:
ObjectManager.Me.FreeNormalBagSlots
<-- Gives free bags slots excluding "Special" bags (profession bags o.i.d.).

So your code should probably look something like
Code:
Styx.Helpers.Logging.Write(Color.FromName("Purple"), "We have {0} free slots Left", ObjectManager.Me.FreeNormalBagSlots);

Maybe give that a try?
 
Correct me if I'm wrong here in my assumption what returns which but if I recall correctly:
Code:
ObjectManager.Me.FreeBagSlots
<-- Gives free bag slots regardless of the type of bags (profession bags)
Code:
ObjectManager.Me.FreeNormalBagSlots
<-- Gives free bags slots excluding "Special" bags (profession bags o.i.d.).

So your code should probably look something like
Code:
Styx.Helpers.Logging.Write(Color.FromName("Purple"), "We have {0} free slots Left", ObjectManager.Me.FreeNormalBagSlots);

Maybe give that a try?


Seems more simple.

So if i do like this, would it work?

Code:
 if (ObjectManager.Me.FreeNormalBagSlots <= 1)
                                    {
Styx.Helpers.Logging.Write(Color.FromName("Purple"), "Yo wont have room for that go sell some stuff...");
                                     }

Or ahould i call for the number to an int before then compare that int in an if statement?
 
Seems more simple.

So if i do like this, would it work?

Code:
 if (ObjectManager.Me.FreeNormalBagSlots <= 1)
                                    {
Styx.Helpers.Logging.Write(Color.FromName("Purple"), "Yo wont have room for that go sell some stuff...");
                                     }

Or ahould i call for the number to an int before then compare that int in an if statement?
just post what you have, what you want it to do, and ill do it later, since looking at that same line you posted about 5 times now, i still dont get what your overall goal is and what your actually trying to make or implement that logging.write, since using it by itself is pretty useless.
 
Seems more simple.

So if i do like this, would it work?

Code:
 if (ObjectManager.Me.FreeNormalBagSlots <= 1)
{
Styx.Helpers.Logging.Write(Color.FromName("Purple"), "You wont have room for that go sell some stuff...");
}

Or should i call for the number to an int before then compare that int in an if statement?

I would make it < 2 instead of <= 1. The < 2 is more reliable, the <= 1 could cause some trouble in the field (at least that's what I was always told, and what I saw in other people's work).
The rest of the code you have there should do it's work.

@Code, he has to learn too somehow. Us doing his coding doesn't help him learn it. This is the way I learned it too (and still learn when I feel like it). It's not my field of interest since it has nothing to do with my RL work environment, nor do I have the time nor ambition to learn C#. But it's fun when U know it a bit, and can mess around with available plugins :) Most likely he's trying to whip up a lockpicking plugin tailored for his specific needs (if this has anything to do with the PM I got some time back at least).
 
I would make it < 2 instead of <= 1. The < 2 is more reliable, the <= 1 could cause some trouble in the field (at least that's what I was always told, and what I saw in other people's work).
The rest of the code you have there should do it's work.

@Code, he has to learn too somehow. Us doing his coding doesn't help him learn it. This is the way I learned it too (and still learn when I feel like it). It's not my field of interest since it has nothing to do with my RL work environment, nor do I have the time nor ambition to learn C#. But it's fun when U know it a bit, and can mess around with available plugins :) Most likely he's trying to whip up a lockpicking plugin tailored for his specific needs (if this has anything to do with the PM I got some time back at least).
yea, but we cant help him if its not in the correct context.

and <2 wont work if someone puts a 2 in there, it wont work, because the number being compared to would have to be Greater then 2, so 3. using < or = (<=) includes the value your also checking if greater then, so then 2 would work. its not about whats easy to read, its about what your trying to do, and what works.
 
As said, if I think of the PM I got, he's making a plugin to open specific lockboxes (the kind that drops epics).
What he's probably checking for is that the specific lockbox is not opened unless there's more than xx bagspace (that's why I suggested 2 since I've seen some boxes can drop 2 items at a time).
Further than that my educated guess is as good as yours on what bengan is cooking up.
 
yea, but we cant help him if its not in the correct context.

and <2 wont work if someone puts a 2 in there, it wont work, because the number being compared to would have to be Greater then 2, so 3. using < or = (<=) includes the value your also checking if greater then, so then 2 would work. its not about whats easy to read, its about what your trying to do, and what works.

LiquidAtoR is right, i hate just reading stuff from the start like c++ type echo:"hello world!!!"; 2000 times obver and over.
I go straight on to it and trie to solve the problem, if i manage to solve the problem, i learn from it, if i fail i don?t do it again.

I have never before worked with C#, but i have been doing some PHP and lightly C++ but as i se this is nothing like C#, but if i read C# code i can ounderstand it after a while, and thats how i learn.

What i want it to do is kind of simple, i have copied some code from others, (Yes i have asked them) :) and modified it for my needs, i know this is not programming, but it is a way for me to learn.

i will post the plugin version 1.0.0.0 so you can se what i was doing :D

What i want in it is a distance check for hostail mobs, and this empty bags check.
 
Back
Top