#How do you listen to events from other mods?
26 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
i figured... parts of it out
its kind of awful and i hate it
apparently this might be because it's interpreting the map as a json, which means it can only have string keys
which
is sucks
JavaScript object access can only use string or symbol keys
I really have no idea why KJS devs let one access a Java map like a JS object
I mean, come on, even JS map does not allow this!
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
You can try using a put method on the map, which should allow you to insert anything as a key
As the Map should do
So, instead of:
```js
event.geneWeights[cringeGene] = 1.0;
do
```js
event.geneWeights.put(toGeneRk("geneticsresequenced:cringe"), 1)
```
(.0) at the end of a number does not matter, all numbers in JS are like Java double anyway
Also, don't confuse "JSON" with "JS object"
I tried that, didn't work
It said object doesn't have put method
Yay, KubeJS wrecks basic map access
The only thing I could suggest is to make some sort of a proxy that is exposed to scripts that will expose the necessary methods of a map
While still being able to set anything as key
I could theoretically add a new method to the event