Page 1 of 2

[Mod] Inventory Plus [20120917.1] [inventory_plus]

PostPosted: Tue Nov 27, 2012 01:49
by 0gb.us
[mod] Inventory Plus [unknown version] [inventory_plus]

This is a simple plugin, which adds the ability for other plugins to add buttons for other menu pages to the player formspec. The original design is by Cornernote, but I'm maintaining it now.

New features include a more user friendly interface for players (the crafting grid displays at the same time as the buttons) and a removal of redundancy created in the creative inventory page in Minetest 0.4.4.

Copyright (C) 2012 cornernote, Brett O'Donnell <cornernote@gmail.com>

Code license: GPLv3
Image license: No images included.

Dependencies: none

Latest version: https://github.com/0gb-us/inventory_plus

PostPosted: Wed Dec 26, 2012 10:23
by foxinsky
Folks,could you please take a look at the following bug:

Bug occures when player try to login to the server. Minetest 0.4.4

11:18:39: ACTION[ServerThread]: zZz joins game. List of players: zZz
11:18:39: ERROR[main]: ERROR: An unhandled exception occurred: ServerError: LuaError: error: ...est/world_minetest/worldmods/inventory_plus/init.lua:72: bad argument #1 to 'pairs' (table expected, got nil)
11:18:39: ERROR[main]: stack traceback:

In thread b7391700:
/build/buildd/minetestc55-0.4.4/src/main.cpp:1760: int main(int, char**): Assertion '0' failed.
Debug stacks:
DEBUG STACK FOR THREAD b7391700:
#0 int main(int, char**)
(Leftover data: #1 Dedicated server branch)
(Leftover data: #2 virtual void ServerMap::save(ModifiedState))
(Leftover data: #3 void ServerMap::saveMapMeta())
Aborted

PostPosted: Wed Dec 26, 2012 16:09
by 0gb.us
This error isn't happening on my copy of 0.4.4.

What other plugins do you have installed? Perhaps inventory_plus isn't playing nicely with another plugin.

PostPosted: Wed Dec 26, 2012 21:48
by foxinsky
0gb.us wrote:This error isn't happening on my copy of 0.4.4.

What other plugins do you have installed? Perhaps inventory_plus isn't playing nicely with another plugin.


Yep, looks like. I'll try check which mod is incompotible with inventory_plus.

PostPosted: Thu Dec 27, 2012 04:41
by 0gb.us
If you figure it out, let me know so I can fix inventory_plus if possible. Or, you could post a list of plugins you use, and I'll find the problem.

PostPosted: Thu Dec 27, 2012 06:59
by foxinsky
It sounds strange, but error occures with only inventory_plus in worldmods.

~/mtest$ ls ./world_minetest/worldmods/
inventory_plus


07:57:15: ERROR[main]: ERROR: An unhandled exception occurred: ServerError: LuaError: error: ...est/world_minetest/worldmods/inventory_plus/init.lua:72: bad argument #1 to 'pairs' (table expected, got nil)
07:57:15: ERROR[main]: stack traceback:

In thread b731f700:
/build/buildd/minetestc55-0.4.4/src/main.cpp:1760: int main(int, char**): Assertion '0' failed.
Debug stacks:
DEBUG STACK FOR THREAD b731f700:
#0 int main(int, char**)
(Leftover data: #1 Dedicated server branch)
(Leftover data: #2 virtual void ServerMap::save(ModifiedState))
(Leftover data: #3 void ServerMap::saveMapMeta())


Line #72 from init.lua:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
    for k,v in pairs(inventory_plus.buttons[player:get_player_name()]) do

Is it possible that at the moment of getting player name, core (minetest) doesn't know it?

UPD#1: No, core know it :

----cut form modyfied init.lua-----
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
        if page=="main" then                                                                                     
                -- buttons                                                                                       
                print('DBG. PlayerName: '..player:get_player_name())                                             
                print('DBG. buttons:'..inventory_plus.buttons[player:get_player_name()])                         
                local x,y=0,0                                                                                   
                for k,v in pairs(inventory_plus.buttons[player:get_player_name()]) do


---- cut from output-----
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
08:21:02: ACTION[ServerThread]: zZz joins game. List of players: zZz
DBG. PlayerName: zZz
DBG. PlayerName: zZz
08:21:03: ERROR[main]: ERROR: An unhandled exception occurred: ServerError: LuaError: error: ...est/world_minetest/worldmods/inventory_plus/init.lua:75: attempt to concatenate field '?' (a nil value)


So as for me we have non-initialyzed buttons list.

end this code is not executing:

---cut from init.lua start from line#21
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- register_button                                                                                               
inventory_plus.register_button = function(player,name,label)                                                     
        local player_name = player:get_player_name()                                                             
        print('ready to check if nil')                                                                           
        if inventory_plus.buttons[player_name] == nil then                                                       
                inventory_plus.buttons[player_name] = {}                                                         
                print('buttons nil checking at 27')                                                             
        end                                                                                                     
        print('out of checking condition')                                                                       
        inventory_plus.buttons[player_name][name] = label                                                       
end                                                         

PostPosted: Fri Dec 28, 2012 04:01
by 0gb.us
When I move inventory_plus to worldmods, I still don't have the problem. Can you post a list of plugins you are using please?

PostPosted: Fri Dec 28, 2012 07:23
by foxinsky
Sure, sorry.

3dforniture
4seasons
conifers
craft_guide
desert_uses
exchange
farming
farming_plus
locked_sign
minetest-protect-master
moreblocks
moreflowers
moreores
peaceful_npc
plantlife-master
unified_inventory

PostPosted: Fri Dec 28, 2012 07:26
by jojoa1997
foxinsky wrote:Sure, sorry.

3dforniture
4seasons
conifers
craft_guide
desert_uses
exchange
farming
farming_plus
locked_sign
minetest-protect-master
moreblocks
moreflowers
moreores
peaceful_npc
plantlife-master
unified_inventory

unified_inventory does not work with inventory_plus. also if you decide to keep unified_inventory delete the creative mod in the default folder.

PostPosted: Fri Dec 28, 2012 19:06
by 0gb.us
jojoa1997 wrote:unified_inventory does not work with inventory_plus.


Yes, that's the issue.

unified_inventory is great, but it takes over the entire menu. No other menu-based plugins can be used with it. In truth, inventory_plus does the same thing, but it also provides an API for adding new menu pages.

PostPosted: Wed Feb 06, 2013 01:58
by jojoa1997
when i use a mod like specialties or armor when ever i press a button that has an action it always sends me back to the creative menu.

PostPosted: Thu Feb 07, 2013 02:54
by 0gb.us
jojoa1997 wrote:when i use a mod like specialties or armor when ever i press a button that has an action it always sends me back to the creative menu.


That's an incompatibility between those plugins and creative. Those plugins SHOULD call inventory_plus.set_inventory_formspec() to set the formspec when the buttons are used, but it sounds like they are either calling player:set_inventory_formspec() directly or not setting the formspec at all, assuming it is already set. When creative mode is turned off, that works fine, but when creative mode s turned on, creative tries to hog the menu.

Report this in the specialties / armor topics, as I can't fix it on my end. Those plugins will need to be fixed themselves.

PostPosted: Wed Feb 27, 2013 02:36
by J-Block
The file downloaded as a file, not a zipped folder. I tried to make a folder for it named "inventory_plus" but I don't know how to make an "init.lua". The mod should be in a zipped folder form in the fist place anyway.

PostPosted: Wed Feb 27, 2013 03:42
by Temperest
It's a tar.gz. A decent archiver will do the trick. On Windows (I assume you are using Windows), 7-zip is the best one around IMO.

http://7-zip.org/

PostPosted: Wed Feb 27, 2013 06:13
by 0gb.us
J-Block wrote:The file downloaded as a file, not a zipped folder. I tried to make a folder for it named "inventory_plus" but I don't know how to make an "init.lua". The mod should be in a zipped folder form in the fist place anyway.


By a "zipped folder", do you mean a .zip file? A .zip file is as much a file as anything else is.

Temperest wrote:It's a tar.gz. A decent archiver will do the trick. On Windows (I assume you are using Windows), 7-zip is the best one around IMO.

http://7-zip.org/


Yeah, if you're not on an operating system that supports .tar.gz (Might I recommend Linux Mint or Ubuntu?), 7-zip will do the trick.

PostPosted: Wed Feb 27, 2013 14:25
by nomohakon
0gb.us wrote:
Temperest wrote:It's a tar.gz. A decent archiver will do the trick. On Windows (I assume you are using Windows), 7-zip is the best one around IMO.

http://7-zip.org/


Yeah, if you're not on an operating system that supports .tar.gz (Might I recommend Linux Mint or Ubuntu?), 7-zip will do the trick.

Ehm, i use 7-zip and i have to unpack it twice. First .gz, then .tar.

PostPosted: Wed Feb 27, 2013 14:43
by rarkenin
nomohakon wrote:Ehm, i use 7-zip and i have to unpack it twice. First .gz, then .tar.


On Linux, you're only a tar -xvzf file.tar.gz away.

PostPosted: Wed Feb 27, 2013 14:54
by J-Block
How do I save it as a 7-zip?

PostPosted: Wed Feb 27, 2013 21:24
by 0gb.us
J-Block wrote:How do I save it as a 7-zip?


You can't. You save it as a .tar.gz, and use the 7-zip application to open the .tar.gz.

PostPosted: Tue Mar 05, 2013 12:50
by Tedypig
First, let me say nice work on the mod. My girlfriend and I love it.

HOWEVER! There is a small visual glitch and another small glitch.

The visual glitch is the "refill" box is scrambled (the word not the box).

The other one is, it does not look like the pics. It flashes at that and the goes almost normal.

Any help is appreciated. Thank you.

-Teddypig

PostPosted: Tue Mar 05, 2013 20:40
by 0gb.us
Tedypig wrote:First, let me say nice work on the mod. My girlfriend and I love it.

HOWEVER! There is a small visual glitch and another small glitch.

The visual glitch is the "refill" box is scrambled (the word not the box).

The other one is, it does not look like the pics. It flashes at that and the goes almost normal.

Any help is appreciated. Thank you.

-Teddypig

The refill box glitch is caused by using the wrong version of inventory_plus. Use version 20120917.1, not version 20120917.0, and it should be fixed.

What pictures? I didn't include pictures.

Does the flashing only happen in creative mode? If yes, it's not something I can fix. The creative mode menu fights to take control, then inventory_plus takes over. The slight delay between the two causes the flash you see.

PostPosted: Wed Mar 13, 2013 14:41
by Tedypig
Can you post a .zip download for the latest version please?

PostPosted: Wed Mar 13, 2013 15:32
by Temperest
You can extract the archive using any decent archiver. A good example is 7-zip.

PostPosted: Fri Mar 22, 2013 21:53
by Traxie21
The download is 404-ing.

PostPosted: Fri Mar 22, 2013 22:37
by rarkenin
Traxie21 wrote:The download is 404-ing.


Recently, it looks like 0gb.us had a hard disk failure.

PostPosted: Fri Mar 22, 2013 23:27
by 0gb.us
Hmm. I just realized that means I lost all the plugins I built. They're all gone, my only copy was on the hard drive that blew.

EDIT: Does anyone have a copy of the latest version of this? I'd love to get it back online.

PostPosted: Fri Mar 22, 2013 23:35
by Traxie21
GitHub?
Always
It'd be a good idea to always push to something on github, so you always have a backup.

PostPosted: Sat Mar 23, 2013 01:10
by 0gb.us
Traxie21 wrote:GitHub?
Always
It'd be a good idea to always push to something on github, so you always have a backup.


I hadn't even started with Github at that point. I use it now, but not back then.

Also, Github is a bit of a pain to work with, particularly the uploading and deleting. I wouldn't want to use it for a small project lie this, it would require a bunch of nested directories on my computer, just to get around Github's renaming tenancies. Why can't it just leave the directory names as you set them?

Anyway, I should have had a backup copy. I realize this is my own fault. However, Github isn't a great fit for me. Backing up to my other computer would be a better option.

Speaking of which, I believe I do have a backup of this, it's just on my misplaced USB flash drive. I should have moved it to my other computer. My mistake. Hopefully someone has a copy of this we can use, but if not, we'll just have to wait for the flash drive to turn up.

EDIT: It's also a pain to rename files. There really should be a web interface for all of this.

PostPosted: Sat Mar 23, 2013 01:29
by jojoa1997
here is one. it is my copy and i dont know if it is the most recent or if i have not edited it but here it is. https://github.com/jojoa1997/0gb.us-repo

PostPosted: Sat Mar 23, 2013 02:08
by 0gb.us
Awesome, thanks Jojoa!

I think the only difference between that version and the up to date version is that we had to delete the trash slot added by inventory_plus, due to creative incorporating the trash slot into the default game.

Come to think of it, we should now also remove the refill slot, as it is pointless in 0.4.5. I'll fork it and make the changes.

After that, I'll probably do a full rewrite. Unfortunately, this will break compatibility a bit, but it will give better options and allow me to add it to 0gb.us_game, where it will be maintained on Github, and be kept up to date. Currently, there's a licence incompatibility, but a rewrite should fix that.

EDIT: Maybe a rewrite wouldn't be advisable ....

EDIT: It looks like maybe you had a copy where I already removed the trash slot? I just didn't do it very cleanly ....

https://github.com/0gb-us/inventory_plus