Closed LorisHenry closed 1 year ago
AFAIK, it is a new feature (very experimental), that the GUI is link to separated simulation (if you have multi) and as effect, it distingue with experiment scope. See the color in Interactive console, it the same with current chosen simulation
So var1 is not in simulation scope. it you chose the experiment GUI scope (small triangle)
And it return the right scope and value for var1
BUT it strange the in simulation scope, your Likewise syntax did not work or some other like: host.var1,
Hi. The new version presented by Nghi partially solves this issue: you are now able to explicitly target the experiment as the agent with which one interacts in the console. However, two still remain if you enter experiment.var1
in the console while talking with the simulation:
Error: Block definition does not begin or end correctly
)var1
. Both are due to the fact that we have to deal with a compilation (and not execution) error: when an expression like experiment.var1
is compiled, GAML does not know which experiment species we are targeting. However, when it is executed, the context is the one of the current experiment. That is why experiment.var1
returns an error (albeit a bit obscure) but experiment["var1"]
not (and returns the correct value). In the latter, no verification is made at compilation time about the existence of var1
, assuming that if it does not exist, nil
will be returned at execution time.
I will try to implement and push a solution where
Describe the bug When defining a variable in an experiment, we can not access the variable in the interactive console
To Reproduce Steps to reproduce the behavior:
code to reproduce :
Then in the interactive console type :
Expected behavior should return 0 but returns Error: Block definition does not begin or end correctly Typing var2 returns 0 because defined in global
Likewise for "var1;", "experiment.var1", "main.var1", "experiment[0].var1", "main[0].var1"
Screenshots If applicable, add screenshots to help explain your problem.