Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Hey! I love the engine and trying to understand it as much as I can so this might be a silly one, but in the guided tour you mention that single grids could be used as a selection input. How do you know what value is selected with it? With Buttons with Checkboxes you have buttonName.value that you can compare, but I don't see how that would work with the grid widget. Thank you for the help! 


I also don't understand how to add new items to a grid like an inventory system. I made an items grid that has two columns of Name And Description. I've looked at you helping someone with an inventory system yet when I try to re-create this function in the Decker script

on add_item n do 
 i:get_items[] 
 i.value:insert name:n into i.value 
end

I'm met with an error of "Expected name, but found:. It's an error that happens when I try to put this

n into i.value 

I've even tried to add this code to a button

on click do

i:inventory.widgets.items

i.value:insert name:"sworde" into i.name

alert["ye have acquired ye sworde!"]

end


But I still get the same issue as before what am I doing wrong? 

(1 edit) (+2)

If you refer to the Decker Reference Manual, grid widgets have a ".rowvalue" property that can be used to obtain the data in the selected row; this will be a dictionary. The "first" of such a dictionary will obtain the value for the first column:

on click do
 f.text:first g.rowvalue
end

In this particular example it would be equivalent to ask for the "key" entry of the dictionary, as that is the name of the first column:

on click do
 f.text:g.rowvalue.key
end

As for adding rows, it looks like you were consulting a very old example from before the "insert" syntax was overhauled. Given a grid "i" with a single column "name", I think you want something closer to:

i.value:insert name with "sworde" into i.value

The Lil Reference Manual has detailed explanations and many examples of the "insert" query form.

Does that make sense?

(+2)

This makes so much sense I'm so sorry I think I just got lost digging through the documentation and must have missed it. Thank you for your time!