I am currently learning how to use SugarCube (and trying to port my Harlowe story into SugarCube) and can't find information on how to set a datamap.
I understand that to set an array in SugarCube, you use the following syntax:
<<set $array= ["zero", "one", "two", "three"]>>
How do you set a datamap?
Comments
The nearest equivalent to a datamap in standard Javascript would be an object (also known as an associate array), and one of the ways you define an object is as follows:
<<set $objects =
{ nameitem: 'wallet', agevalue: true },
{ nameitem: "bob", agevalue: 30 }
>>
would there be a way , and ive tried to no success, to call on just the first line, or just nameitem's, or just agevalue's, and print all of those?
<<print $objects.nameoritem>> only outputs the first one.
'Wallet'
in this case.
Say I had a bob and a jill and wanted to call on jill instead.
Your name is <<print $person.name2>> would suffice, but is there another way of doing it if the array was set up like this
I know I could use prototypes, but would I need the <<Script>> tag to enclose everything or can I do it all with twine: something like that?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects
note: Your first $person variable example suffers from the same problem.