SHARE
TWEET

Untitled

a guest Jun 19th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if(keyboard_check_pressed(ord("E")))
  2. {
  3. show_inventory = !show_inventory;
  4. }
  5. #region Mouse Slot
  6. mousex = device_mouse_x_to_gui(0);
  7. mousey = device_mouse_y_to_gui(0);
  8.  
  9. var cell_xbuff = (cell_size+x_buffer)*scale;
  10. var cell_ybuff = (cell_size+y_buffer)*scale;
  11.  
  12. var i_mousex = mousex - slots_x;
  13. var i_mousey = mousey - slots_y;
  14.  
  15. var nx = i_mousex div cell_xbuff;
  16. var ny = i_mousey div cell_ybuff;
  17.  
  18. if(nx >= 0 and nx < inv_slots_width and ny >= 0 and ny < inv_slots_height)
  19. {
  20.     var sx = i_mousex - (nx*cell_xbuff);
  21.     var sy = i_mousey - (ny*cell_xbuff);
  22.    
  23.     if((sx < cell_size*scale) and (sy < cell_size*scale))
  24.     {
  25. m_slotx = nx;
  26. m_sloty = ny;
  27.     }
  28. }
  29.  
  30. //Set Selected Slot to Mouse Position
  31. selected_slot =  min(inv_slots-1, m_slotx + (m_sloty*inv_slots_width));
  32. #endregion
  33.  
  34. //Pickup Item
  35.  
  36. var inv_grid = ds_inventory;
  37. var ss_item = inv_grid[# 0, selected_slot];
  38.  
  39. if(pickup_slot != -1)
  40. {
  41.    if keyboard_check_pressed(ord ("Z"))
  42.    {
  43.        if(ss_item == item.none)
  44.        {
  45.            inv_grid[# 0, selected_slot] = inv_grid[# 0, pickup_slot];
  46.            inv_grid[# 1, selected_slot] = inv_grid[# 1, pickup_slot];
  47.            
  48.            inv_grid[# 0, selected_slot] = item.none;
  49.            inv_grid[# 1, pickup_slot] = 0;
  50.            
  51.            pickup_slot = -1;
  52.        }
  53.         else if (ss_item == inv_grid[# 0, pickup_slot])
  54.         {
  55.             if(selected_slot != pickup_slot)
  56.             {
  57.                 inv_grid[# 1, selected_slot] += inv_grid[# 1, pickup_slot];
  58.                 inv_grid[# 0, pickup_slot] = item.none;
  59.                 inv_grid[# 1, pickup_slot] = 0;
  60.             }
  61.            
  62.             pickup_slot = -1;
  63.         }
  64.         else
  65.         {
  66.             var ss_item_num = inv_grid[# 1, selected_slot];
  67.            inv_grid[# 0, selected_slot] = inv_grid[# 0, pickup_slot];
  68.            inv_grid[# 1, selected_slot] = inv_grid[# 1, pickup_slot];
  69.            
  70.            inv_grid[# 0, selected_slot] = ss_item;
  71.            inv_grid[# 1, pickup_slot] = ss_item_num;
  72.            
  73.            //pickup_slot = -1;
  74.         }
  75.    }
  76. }
  77. else if(ss_item != item.none)
  78. {
  79.     if keyboard_check_pressed(ord ("X"))
  80.     {
  81.       pickup_slot = selected_slot;
  82.     }
  83. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top