question

Ignacio H2 avatar image
0 Likes"
Ignacio H2 asked Ignacio H2 commented

Configuración del código

Hola, mi problema es que el siguiente código me devuelve los valores 0, 1, -1 y yo necesito que me devuelva -1, 0, 1. Me podrian ayudar? gracias!


/**Ajustar la ubicación del artículo*/

Objeto actual = objetopropietario(c);

Elemento de objeto = param(1);

puerto int = param(3);

// Obtener el desplazamiento y la ubicación del cambio

int offset = (current.stats.input.value)%3 - 1; // entrada mod 3 - 1 -> devuelve 0, 1, -1 en orden repetitivo

elemento.ubicación.y += elemento.tamaño.y * desplazamiento*1.1; // moverse hacia arriba por el tamaño y del elemento multiplicado por el resultado del cálculo anterior


codigo.png

FlexSim 22.1.0
entry triggercodigoentry
codigo.png (13.1 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Ignacio H2, was Jason Lightfoot's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·
Ignacio H2 avatar image Ignacio H2 Jeanette F ♦♦ commented ·
Hecho!
0 Likes 0 ·

1 Answer

·
Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered
int offset=(current.stats.input.value-1)%3-1;
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.