Legacy GM Help with inventory

A

Anton Provid

Guest
hi, i am working with inventory for my project. got the file inventory extension but it is not working with mouse, that's mean i can not drag and drop item by using mouse (mb_left) ... now, i want change select slot inventory form keyboard_check_pressed(or(“...”)) into using mouse. ex: left mouse select and drag, if over the inventory it will drop items...
here is the the code:
Code:
var down = keyboard_check_pressed(or(“S”));

var up = keyboard_check_pressed(or(“W”));
var left = keyboard_check_pressed(or(“A”));
var right keyboard_check_pressed(or(“D”));
var y_button = gamepad_button_check_pressed(0, gp_face4);
var a_button = gamepad_button_check_pressed(0, gp_face1);
var x_button = gamepad_button_check_pressed(0, gp_face3);
var b_button = gamepad_button_check_pressed(0, gp_face2);

var select = gamepad_button_check_pressed(0,gp_select);
if (up)
{
    if (row_y > 0)
    {
        row_y--;
    }
    else
    {
        row_y = row - 1;
    }
}
if (down)
{
    if (row_y < row - 1)
    {
        row_y++;
    }
    else
    {
        row_y = 0;
    }
}
if (left)
{
    if (column_x > 0)
    {
        column_x--;
    }
    else
    {
        column_x = column -1;
    }
}
if (right)
{
    if (column_x < column -1)
    {
        column_x++;
    }
    else
    {
        column_x = 0;
    }
}

if (a_button)
{
    move_inventory_to_quick_inventory();
}

if (y_button)
{
    remove_quick_inventory();
}

if (x_button)
{
    combine_items();
}

if (b_button)
{
    split_items();
}

if (select)
{
    drop_item();
}
sorry this is the first i make the inventory in game and this is not my code, i just follow this of the tutorial in youtube -i am newbie. I don't know how to that so i need you help me can change it into using mouse. Thank for reading.
 

samspade

Member
Short answer, it is not easy to change it to a mouse. This uses a grid system modified by key presses. A mouse would need to use x and y positions relative to it on in room space, gui space or something else. Unfortunately, you can't use any of this and need to redo it from scratch if you want it be done with a mouse.

Also, unfortunately, in most ways doing it with a mouse is more complicated. But not by much. Here is a detailed tutorial on how that could serve as a foundation and explanation of the basic principals you would want to use.

 
A

Anton Provid

Guest
Short answer, it is not easy to change it to a mouse. This uses a grid system modified by key presses. A mouse would need to use x and y positions relative to it on in room space, gui space or something else. Unfortunately, you can't use any of this and need to redo it from scratch if you want it be done with a mouse.

Also, unfortunately, in most ways doing it with a mouse is more complicated. But not by much. Here is a detailed tutorial on how that could serve as a foundation and explanation of the basic principals you would want to use.

yes, i know it, i also look this and i will try it. Btw, thanks for your help.
 
Top