Beginners question

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Castor1010

hello everyone
if been working on this code

extends Node2D

const SlotClass = preload(‘res://Slot.gd’)
onready var inventory_slots = $GridContainer
var holding_item = null

func _ready():
for inv_slot in inventory_slots.get_children():
inv_slot.connect(‘gui_input’, self, “slot-gui_input”, [inv_slot])

func slot_gui_input(event: InputEvent, slot: SlotClass):
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT && event.pressed:
if holding_item != null:
if !slot.item:
slot.putIntoSlot(holding_item)
holding_item = null
else:
var temp_item = slot.item
slot.pickFromSlot()
temp_item.global_position = event.global_position
slot.putIntoSlot(holding_item)
holding_item = temp_item
elif slot.item:
holding_item = slot.item
slot.pickFromSlot()
holding_item.global_position = get_global_mouse_position()

func _input(_event):
if holding_item:
holding_item.global_position = get_global_mouse_position()

but it gifs me the error:
too few arguments in ‘pickFromSlot()’ At least 1

can anyone pls help

:bust_in_silhouette: Reply From: yrtv

Welcome to the club of people trying to use Script as a Scene.
See here:
https://forum.godotengine.org/94684/nonexistent-function-in-base

https://forum.godotengine.org/94694/error-invalid-index-set_wait_time-base-instance-value-float

what do you mean

Castor1010 | 2021-02-08 19:57

Check the links, and make sure you do not making same mistake as they did.

yrtv | 2021-02-08 21:04

just say the answer

Castor1010 | 2021-02-09 18:29