Version Problems!?

Started by Flash1225, June 12, 2014, 08:26:00 PM

Previous topic - Next topic

Flash1225

I'm not sure if it was the fact that I used V 1.04 or 1.64 for a while (now I'm up to date),but I couldn't get any scripts to work. I have Notepad ++, and I can compile, but it wouldn't work before. Any issues?
Considering how many turns my life has taken (good and bad), I'm still fairly neutral to it all. I take the hits, I don't react overly.

Relli

I can think of a few things that might cause that sort of problem. If it were actually the version, then your problem is that your code uses commands that didn't use to exist in the older versions, and thus cannot be run. But if that were the case, the code wouldn't compile correctly. So it's likely not that.

You say you have notepad++, and that it compiles alright. The next step would be putting that code on a CRPLCore unit. Then when you exit edit mode, and unpause the game, it should do what it was meant to. If the code is not on a core, then it can't do anything. If it is, and still nothing is happening, then we would need to see the code itself to see what might be causing it to fail.

Flash1225

I'm starting to notice a thing with some scripts I'm compiling, particularly my modified variations of the examples. They compile right, but it says "1 opcode" along with the rest of what the rest of the sentence that states how many scripts are compiled into however many opcodes the scripts total to. Here's one script I tried to make to create mobile Gliders that produce creeper:
# RailWalker.crpl
# ------------------------------------------

$MIN_TERRAIN_HEIGHT:1
$MAX_TERRAIN_HEIGHT:3
$SPEED:2

once
# Initialize our last position since we don't have one.
-1 ->lastCellX
-1 ->lastCellY
endonce

#If we aren't moving, choose a new location.  The location will be a neighboring cell.
GetQueuedMoveCount eq0 if
@ChooseNewCell if
<-chosenX <-chosenY <-SPEED QueueMove
CurrentX ->lastCellX
CurrentY ->lastCellY
endif
endif


:ChooseNewCell
-1 ->chosenX
-1 ->chosenY

# Get a list of the neighbors that we can move to.
# This call returns the coordinate pairs on the stack.
@GetPossibleCells

# Choose a random location within the list
0 <-count RandInt ->randCellNumber

# Go through the list and pop all of the coordinates off the stack.
# As we pass the coordinates that we chose in our random number above, remember them.
# Those are the coordinates we will be returning.
<-count 0 do
->y
->x
I <-randCellNumber eq if
<-x ->chosenX
<-y ->chosenY
endif
loop
# Return if we chose a new location
<-chosenX -1 neq


:GetPossibleCells
#Check the four neighboring cells to see if they are acceptable terrain heights.
0 ->count
CurrentX 1 add ->cx CurrentY ->cy @CheckCell #Right
CurrentX ->cx CurrentY 1 sub ->cy @CheckCell #Up
CurrentX 1 sub ->cx CurrentY ->cy @CheckCell #Left
CurrentX ->cx CurrentY 1 add ->cy @CheckCell #Down

# By default, we won't return the last cell coordinates.  This is so the patrolling unit
# doesn't return back to where it came from immediately.  But, if the only choice is to return
# to the previous cell, then that is what we have to do.
<-count eq0 if
<-lastCellX
<-lastCellY
1 ->count
endif


:CheckCell
#Check to see if the cell we are looking at is the last cell, if so ignore.
<-cx <-lastCellX neq <-cy <-lastCellY neq or if
# Check if the target cell is an acceptable terrain height.  If so, push the
# coordinates to the stack and increment count.
<-cx <-cy GetTerrain ->terrainHeight
<-terrainHeight <-MIN_TERRAIN_HEIGHT gte <-terrainHeight <-MAX_TERRAIN_HEIGHT lte and if
<-cx
<-cy
<-count 1 add ->count
endif
endif

This is just the example. I actually spliced a SetCreeper command somewhere in the sets of if-endifs (not including the if-endif that lasts for the entire script). The script compiles fine, but the SetCreeper command doesn't work. Explain.
Considering how many turns my life has taken (good and bad), I'm still fairly neutral to it all. I take the hits, I don't react overly.

Grayzzur

That script doesn't contain a SetCreeper command anywhere in it. We can't guess what's wrong with your script if you don't post the actual broken version.
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker