In netlogo I have a procedure that calls another procedure. How can I go about getting the value
for example, I have two breeds of agents, a hub and a link. A hub has a local variable called 'budget' and I'm trying to modify its value.
hubs-own [
budget
]
to go
ask hub 0 [
do-ivalue
]
end
to do-ivalue
ask links [
;; I'm trying to set the local variable budget of the hub that's calling this link
set self.budget newvalue ;; this is obviously wrong, how can I fix this?
]
end
what you want to do is use is 'myself', it refers to the caller (asker): the one who asked to run the code where the 'myself' is located.
The 'self' refers to the agent running the code. It is similar to 'this' in Java.