First: i think you’ll need to use the singular form — create-link-with. The plural form is used with agent setss
Next: As Michael wrote so succinctly: “myself” refers to the agent that is making this agent do things. In this case it’s the agent that ran “hatch” and is therefore making the new agent run it’s initial code.
That value is dynamic, and myself has meaning ONLY when an agent is being called to do stuff by another agent. It is not a fixed reference to a “parent”
You’ve made a link, but it is non-directional; so it doesn’t explicitly record who is the parent.
HOWEVER: Non-directional links use WHO number order to assign the agents to END1 and END2. END1 is always the turtle with the smaller WHO, so it is always the older agent, so in this case, [ END1 ] of the link between them is the parent.
If you otherwise needed an agent to remember its creator, you could add a variable like “parent” and assign “myself” to it in the Hatch code.
Likewise, you can use a local variable like “new-child”, assign SELF to it during hatching, then assign new-child to “child” after hatching.
;; turtles-own [ parent child ]
To make-linked-child
;; run by a turtle
Let new-child nobody
Hatch 1 ;; breed is inherited
[ Set new-child self
Set parent myself
Set child nobody
Create-link-with myself
[ ;; link runs this
;; note that here,
;; myself will refer to the new turtle
;; that ran “create-link”
;; note that [ myself ] of [ myself ] is just self.
]
Set child new-child
End