Help In Inventory System

R

rouzbeh

Guest
hi
so i made an inventory system with 5 slots
and this is my script for Item pick up :
Code:
itemnumber = argument0;

if(Slot1 == -1)
{
    Slot1 = itemnumber;
    return(0);
}
if(Slot1 != -1)
{
    if(Slot2 == -1)
    {
        Slot2 = itemnumber;
        return(0);
    }
    if(Slot2 != -1)
    {
        if(Slot3 == -1)
        {
            Slot3 = itemnumber;
            return(0);
        }
        if(Slot3 != -1)
        {
            if(Slot4 == -1)
            {
                Slot4 = itemnumber
                return(0);
            }
            if(Slot4 != -1)
            {
                if(Slot5 == -1)
                {
                    Slot5 = itemnumber;
                    return(0);
                }
                if(Slot5 != -1)
                {
                }
            }
        }
    }
}
but i want to 2 or more items like each other transform to one item and draw a text of number of that item in front of it but i dont know how i can do it
sorry for my bad english i try to explain well
and also i dont use arrays because i cant use them to send them to server ( my game is online using 39dll)
so pls help me thx:rolleyes:
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Moderator
no one can help me ? :(
If you post in the Game Design forum and only wait an HOUR before bumping, then I wouldn't be surprised noone has helped you... ;)

Moved to the Programming forum (and please don't bump a topic unless 48 hours have passed or you have more information relevant to the issue to share).
 

GMWolf

aka fel666
First of All, I see variables named slot1, slot2,...
This is a rec now for disaster and unmaintainable code.

Before you do anything else, I suggest you learn arrays, along with for loops.
 
R

rouzbeh

Guest
If you post in the Game Design forum and only wait an HOUR before bumping, then I wouldn't be surprised noone has helped you... ;)

Moved to the Programming forum (and please don't bump a topic unless 48 hours have passed or you have more information relevant to the issue to share).
thank you admin

First of All, I see variables named slot1, slot2,...
This is a rec now for disaster and unmaintainable code.

Before you do anything else, I suggest you learn arrays, along with for loops.
as i said ... i cant use arrays, and i know how to use for loops and arrays but i cant send them with 39dll
 

GMWolf

aka fel666
thank you admin



as i said ... i cant use arrays, and i know how to use for loops and arrays but i cant send them with 39dll
You totally can...
Just write your values to your buffer in turn...

Also, 39dll? That old archaic thing?
You know at this point GMs built in networking is far more stable and powerful?
 
R

rouzbeh

Guest
yea i know its super old now but i cant change my whole cods that's take too long
ok i try to do that
thaks
 

GMWolf

aka fel666
yea i know its super old now but i cant change my whole cods that's take too long
ok i try to do that
thaks
Actually current networking works similarly to 39dll. (Buffers and all)
Assuming your code is a little well written, should not be too difficult to make the change.
 
R

rouzbeh

Guest
for example this cods will be transform to what cod in GMS ?
Code:
clearbuffer();
writebyte(ARM);
writeshort(mouse_x);
writeshort(mouse_y);
send_game_server();
 

GMWolf

aka fel666
for example this cods will be transform to what cod in GMS ?
Code:
clearbuffer();
writebyte(ARM);
writeshort(mouse_x);
writeshort(mouse_y);
send_game_server();
Code:
var buffer = buffer_create(40, buffer_fixed, 1);
buffer_write(buffer, buffer_u8, ARM);
buffer_write(buffer, buffer_u16, mouse_x);
buffer_write(buffer, buffer_u16, mouse_y);
network_send_packet(socket, buffer, 40);
buffer_delete(buffer);
Rather than creating and destroying buffers, you could also have a global buffer like 39dll.
 
Top