Question about variables - Weird behavior?

Started by DeSangre, February 08, 2017, 04:17:35 PM

Previous topic - Next topic

DeSangre

Hi everybody!
I made a basic test script for moving a CRPL core and it works fine in the test map.

$Speed:1
71 30 <-Speed QueueMove


So, after this worked, I tried to use the same command in a slightly more complicated code:

$Speed:1

5 5 GetCellOccupiedCount 1 lt if
once
ClearConversation
0 "foo" AddConversationMessage
ShowConversation
PauseGame
12 30 <-Speed QueueMove
20 0 do
CurrentCoords 105 105 2 50 CreateSpore
Delay 25
loop
endonce
endif


The weird thing is that the Core is not moving in this second example. It fires spores though, so I'm sure the code is getting executed.
I'll add that by replacing <-Speed with a number, the core moves!

I'm probably missing something very obvious, so please excuse my probably stupid question... :)

planetfall

Insulting sanity checks:
Is the core already at the coords 12,30?
Check the core itself to make sure speed is not 0
Did you reload the game? Script behavior can be a little wonky if you reload the map without recompiling.
You have PauseGame in there, did you make sure to unpause?

Mostly unrelated: Delay 25 should be either 25 Delay or Delay(25)

And one technical note: be very wary of using delay inside loops, as per this bug.
Pretty sure I'm supposed to be banned, someone might want to get on that.

Quote from: GoodMorning on December 01, 2016, 05:58:30 PM"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.