You have a couple of problems in your code there.
First, you’re creating a Map object incorrectly. If you’re going to use a Map like that, then the code should be like this:
<<set $bafarians to new Map([["name", "Bafarians"], ["origin", "xxx"], ["charasteristic", "yyy"], ["description", "zzz"]])>>
See the Map() constructor documentation for details.
That said, rather than using a Map object, you’d probably be better off using a generic object instead, like this:
<<set $bafarians = { name: "Bafarians", origin: "xxx", charasteristic: "yyy", description: "zzz" }>>
Generic objects are a lot easier to work with than Maps in most cases.
Next, you have three problems with this code:
<<link "bafarians" "tpl_speciesInfoScreen">>
<<script>>
<<set _tempSpecie to $bafarnians)>>
<</script>>
<</link>>
The first problem is that you’re attempting to use a SugarCube macro within a <<script>>
macro. The only thing which should be inside of a <<script>>
macro is JavaScript code, thus there is no need for that <<script>>
macro to be there at all.
Second is that you’re setting the value of a temporary variable (_tempSpecie) just before you go to another passage, which clears out all of the temporary variables. Also, there’s an extra “)
” after “$bafarnians
”.
If you need to do something like that, then your code should be more like this:
<<link "bafarians" "tpl_speciesInfoScreen">>
<<set $tempSpecie = "$bafarnians">>
<</link>>
and then, in the “tpl_speciesInfoScreen” passage, the code would look like this:
<<set _tempSpecie = State.getVar($tempSpecie)>><<unset $tempSpecie>>\
''Race:'' <<print _tempSpecie.name>>
''Origin:'' <<print _tempSpecie.origin>>
''Charasteristics: '' <<print _tempSpecie.charasteristic>>
''Description:'' <<print _tempSpecie.description>>
That uses the State.getVar() method to turn the string “$bafarnians” into the value of the variable $bafarnians, and then uses the <<unset>>
macro to get rid of the $tempSpecie variable, since you no longer need it.
Hope that helps!