-
Hi there, based on the Circle tutorial, I'm using An agent could randomly pick up another agent, replicating another one's status in my new model. But some errors occurred when I tried to use First, the definition of 1D message array AND agent functions: message = model.newMessageArray('variant')
message.setLength(5)
message.newVariableInt('var')
@pyflamegpu.agent_function
def output_message(message_in: pyflamegpu.MessageNone, message_out: pyflamegpu.MessageArray):
message_out.setIndex(pyflamegpu.getID() - 1)
message_out.setVariableInt("var", pyflamegpu.getVariableInt("var"))
return pyflamegpu.ALIVE
@pyflamegpu.agent_function
def input_message(message_in: pyflamegpu.MessageArray, message_out: pyflamegpu.MessageNone):
interlocutor = pyflamegpu.random.uniformInt(0, 4)
msg = message_in.at(interlocutor)
pyflamegpu.setVariableInt("var", msg.getVariableInt('var'))
return pyflamegpu.ALIVE When I ran the programme, the first error:
Thx a lot! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
This appears to be a bug within the agent python transpilation. Two things stand out:
It's possible array messages haven't been as thoroughly tested as other types within agent python. I'll create an issue, and try to reproduce/fix it later in the week. Thanks for the thorough post. |
Beta Was this translation helpful? Give feedback.
This appears to be a bug within the agent python transpilation.
Two things stand out:
MessageArray3D
but you appear to be usingMessageArray
.getVariableInt
which should actually begetVariable<Int>
It's possible array messages haven't been as thoroughly tested as other types within agent python.
I'll create an issue, and try to reproduce/fix it later in the week.
Thanks for the thorough post.