This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

hello everyone
if been working on this code

extends Node2D

const SlotClass = preload('res://')
onready var inventoryslots = $GridContainer
var holdingitem = null

func ready():
for invslot in inventoryslots.getchildren():
invslot.connect('guiinput', self, "slot-guiinput", [invslot])

func slotguiinput(event: InputEvent, slot: SlotClass):
if event is InputEventMouseButton:
if event.buttonindex == BUTTONLEFT && event.pressed:
if holdingitem != null:
if !slot.item:
holdingitem = null
var tempitem = slot.item
tempitem.globalposition = event.globalposition
holdingitem = tempitem
elif slot.item:
holdingitem = slot.item
holdingitem.globalposition = getglobalmouseposition()

func input(event):
if holdingitem:
holdingitem.globalposition = getglobalmouseposition()

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

can anyone pls help

in Engine by (35 points)

3 Answers

0 votes

Lets say your function is defined like this func pickFromSlot(item):

That error means you're calling the function pickFromSlot() without a parameter which it requires.

If there are instances where you don't need to send arguments to the function then you can pre-define them like this func pickFromSlot(item = null):

by (6,942 points)

thank you
i dont get the error anymore
but my script isn working

0 votes

slot é um comando próprio da engine ou da linguagem? pq se a resposta for negativa, pode ser que voce estea chamando um método, variável ou propriedade que não exista, ou que não pode ser acessada dessa forma.
Outra possibilidade é que haja diferença entre letras maiúsculas e minúsculas.

by (18 points)
0 votes

Here I found the exact time code for you.
Check your function.

by (887 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.