Inventory script.

Hi,

I am learning Lua and GLua at the moment. I will be trying to make an inventory system somewhere soon for darkrp, and I was wondering basicly, how do I start? What do I start off with? I want it to be integrated in the “extraF4tab”, so that it works with any custom f4 theme, and so that you can access your inventory on opening of your F4 menu.

So yeah, anyone got a phased plan? What do I start with? Etc. This will also become my “progress thread” in which I ask for help.

Regards,
Le me.

Start with derma design and an basic creation of an local database to save the items etc, also start with making an admin “system”/menu for the superadmins to edit each individual users inventory, the f4 menu etc can be made as last thing, to open the inv just do something like an concommand.

Maybe a little more in-depth explanation, this is the first glua script I’d create and I have no idea where to start.

if its really your first, then you shouldnt do it, because inventory counts as an bit of advanced, and requires good knowledge of Lua/GLua. You should get into basic VGUI/HUD design and such, and work your way up.

Well whitestar split it up into pretty much as small segments as possible without going to extreme lengths to prepare a guided tutorial for your specific case, but I’ll provide a bit more details:
1. Learn Derma. There is a good guide for derma on the old wiki, but beware that some things may be outdated. If you ever get stuck, look it up on the current Wiki.
2. Learn SQL and how to use it with GMod. I don’t know of any good guides, but a quick google search could probably help you.
3. Use Derma to make a menu for the inventory, and use SQL to store the data.
4. Learn how DarkRP’s F4 menu works and find a way to integrate your system into it.

but yeah this is a pretty big task to take on, and might not be the best idea for your first GLua project.

I think I’ll give up already… Just looked inside the files of a simple hud; it consists of 1066 lines of code already. That’s… crazy…

Brem, don’t give up so easy… The inventory i just made is under 500 lines.

an hud can be done in under 50 lines, so its not an “simple” hud which you got there.

[editline]30th September 2015[/editline]

Even though I am “good” in GLua myself, can do vgui, and now also a bit of MySQL, I am still too dumb for an inv system xD

Here im going to make you a list

1.) Create item registering function(shared)
2.) Create spawning function(server)
3.) Create item entity
4.) Make a test item and spawn it
5.) Make a saving method (file write, sql, JSON, etc)
6.) Make interface
6.5) Admin only commands(ie spawning)
7.) finished

Doesn’t look too complicated in my eyes, yet it has 1000+ lines of code.

If I make a thing, for example a HUD, I want it to be good, so I’ll probably end up with having 1000 lines of codes aswell, however, I simply suck at lua. I am kinda smart irl but I just don’t get this programming language.

I just recently finished mine… its actually on a playable server

[editline]30th September 2015[/editline]

Brem most of what i have learn was from starting small. I made a hud first because all it is, is basic draw. maybe you should start with a hud

it got so many lines, because it has multiple skins, and simple setup(fonts & icons), since fonts take up already 10+ lines if you set them up readable - which is easy.

Start simple. An aimbot, though not useful practically, is a good beginner’s gLua lesson.

Don’t be discouraged because of the amount of lines. Using Derma requires a lot of lines because for each element you have to set it’s size, position, etc.