|
Development Forum |
 |
|
 Tea Queen
Laura
    

|
4/2/2014 | |
Can someone tell me why these parts of my code show up as red syntax errors, please?
*install invisible flag agent:
new: simp 1 205 14868 "blnk" 0 0 9000
*this is the script that the patch core will trigger when it's time to spawn a flower:
setv name "spawn_script" 1000
*sprite image file and frame when the plant is fully grown:
sets name "sprite_file" "eggstravaganza"
* Randomly choose one of the 241 frames
* 240 in the command for 241 eggs, since it starts counting by 0
setv name "sprite_pose" rand 0 240
* offset the generic growing sprites, so they do not get picked as ripe frame
addv name "sprite_pose" 10
*classifiers:
setv name "prod_fmly" 2
setv name "prod_gnus" 11
setv name "prod_spcs" 14868
***set va00 to targ, enumerate all the instances of the patch core agent, send a message to that patch core agent that script 1000 is being targetted:
seta va00 targ
enum 1 1 22929
mesg wrt+ targ 1000 va00 0 0
next
*spawn:
scrp 1 205 14868 1000
inst
* Randomly choose one of the 241 frames
* 240 in the command for 241 eggs, since it starts counting by 0
setv va00 rand 0 240
* offset the generic growing sprites, so they do not get picked as ripe frame
addv va00 10
new: simp 2 7 14868 "eggstravaganza" 1 va00 name "patch_plane"
*flower properties:
*attr 80 = growth stages invisible to creatures so they won't be picked up, and don't want them to suffer physics just yet:
attr 80
bhvr 32
accg 2
perm rand 40 60
elas 20
aero 1
fric 100
*move to co-ords sent by the core patch agent:
mvto _p1_ _p2_
setv name "patch_id" mame "patch_id"
*replaced the "tick rand mame" and tick condition sections with this. We need to know the exact TICK because of what we'll be doing later. Originally the default was 500 ticks = about 25 seconds. We're going to set it to run about once every second.
tick 20
*and this is going to be our counter. We don't need to set a variable to zero, but I wanted to make a point to mention it now since we'll be using it later on.
setv ov95 0
targ ownr
slow
endm
*timer:
scrp 2 7 14868 1001
*age it every tick:
addv ov00 1
*if it's not fully grown, grow it to the next stage (only on every other tick):
doif ov00 le 16
doif ov00 eq 1
elif ov00 eq 3
elif ov00 eq 5
elif ov00 eq 7
elif ov00 eq 9
elif ov00 eq 11
elif ov00 eq 13
elif ov00 eq 15
else
setv va00 pose
addv va00 1
*if it is fully grown, make sure creatures can see/grab it.
attr 67
stop
pose va00
endi
endi
*added 7 steps to the growth process so make number 37, instead of 30, so eggs have more time before rotting:
*EDIT THIS if you want it to rot sooner/later. Smaller number = sooner.
elif ov00 gt 25
*if it's older then 20 ticks, let it rot. Fully rotten frame is 10:
doif pose eq 10
kill targ
endi
endi
*no intermediate sprites, has a closed 'night' sprite instead, so just set pose as 10:
pose 10
*if it's fully grown and has been sitting on the plant for 10 turns, it should fall off the patch. Added 7 steps, so number is 21 instead of 14:
*EDIT THIS if you want it to become grabbable sooner/later.
elif ov00 eq 17
doif attr eq 67
setv name "patch_id" 0
attr 195
stop
endi
endi
endm
*pickup:
scrp 2 7 14868 4
inst
endm
*remove:
rscr
|
Thank you!  |
 Code Monkey
evolnemesis
    
|
4/2/2014 | |
looks like you have some nesting problems with if statements if i understand the code correctly..
for example, above the comment *added 7 steps ...
(if i understand it right) you have an
if (c1)
- if (c2)
- elseif (c3)
- elseif (c4)
- ...
- else
- - some stuff
- endif
endif
anyway, the code seems to have 2 nested if statements that are both closed before that comment, but after the comment you have an
elseif (c5)
- if (c6)
- - some stuff..
- end if
end if
that elseif after the comment seems to have no matching if (maybe that elif should be a doif? it would fix your nesting syntax but i dont know about the logic... if that's not it, then I think you need to move the 'else' clause and matching endifs above it down some )
same problem for the next elsif after the '*if it's fully grown...' comment, it seems that all the if clauses are closed already before you get to it, changing it to a doif would at least fix your nesting, if that's not good for the logic though, then that 'else' needs to be moved all the way below it.
It figures you would have a problem with nesting while making this particular patch plant... 
"For small creatures such as we, the vastness is bearable only through love."
"We are a way for the cosmos to know itself." - Carl Sagan |
 Tea Queen
Laura
    

|
4/2/2014 | |
Thanks Evolnemesis, that fixed it. I swear, I should never attempt to code after three glasses of birthday champagne. No more syntax errors show up, but now I get this error whenever I try to inject the install and event scripts via the CAOS Tool:
Script 1 205 14868 1000 caused an error or exception:
Start transaction failed. |
 Code Monkey
evolnemesis
    
|
4/2/2014 | |
That one I'm clueless about sorry to say... it definitely seems to be some problem trying to install it or get it running, but I really haven't made any working agents yet myself.
"For small creatures such as we, the vastness is bearable only through love."
"We are a way for the cosmos to know itself." - Carl Sagan |

Malkin
     Manager

|
4/3/2014 | |
That error, according to a post on Creaturetopia, is a result of having trouble talking to the game - do you have the main GB injected into that world?
My TCR Norns |
 Tea Queen
Laura
    

|
4/3/2014 | |
Yeah, it was one of the first things I checked. I've also tried starting afresh with a new world before trying to inject the scripts again, but that didn't work either. |
 Patient Pirate
ylukyun
     Manager
|
4/3/2014 | |
What version of the game is it, and do you have the Remastered Patch installed? |
 Tea Queen
Laura
    

|
4/3/2014 | |
It's GOG.com's Creatures Exodus and yes, the patch was installed before I started.  |
 Prodigal Sock
Ghosthande
    

|
4/3/2014 | |
Did you start up Exodus first, or the CAOS Tool?
I've actually had it before where I'd start the CAOS Tool before C3/DS, and it would look for the wrong game... C3 when I'm running DS, or vice-versa. Slim chance but that might be what's going on here.
 |
 Tea Queen
Laura
    

|
4/3/2014 | |
Yeah, I booted up DS before opening the CAOS Tool. I am completely stumped right now. I've just tried reinstalling the CAOS Tool, starting a completely fresh .cos file and writing my code over again from scratch (here it is so far):
*install:
new: simp 1 205 14868 "blnk" 0 0 9000
setv name "spawn_script" 1000
sets name "sprite_file" "eggstravaganza"
setv name "sprite_pose" rand 0 240
setv name "prod_fmly" 2
setv name "prod_gnus" 11
setv name "prod_spcs" 14868
seta va00 targ
enum 1 1 14868
mesg wrt+ targ 1000 va00 0 0
next
*spawn:
scrp 1 205 14868 1000
inst
setv va00 rand 0 240
addv va00 10
new: simp 2 11 14868 "eggstravaganza" 1 va00 name "patch_plane"
*properties:
attr 80
bhvr 48
accg 2
perm 64
fric 100
elas 30
aero 2
mvto _p1_ _p2_
setv name "patch_id" mame "patch_id"
tick rand mame "tickfrom" mame "tickto"
doif tick eq 0
tick 200
endi
endm |
And I still get the same error. I think I'm running out of ideas. ![[noddeye] [noddeye]](/images/smilies/emot_oddeye.gif) |
 Prodigal Sock
Ghosthande
    

|
4/3/2014 | |
Transaction failure is an issue between the programs; the code isn't the problem here, so changing it won't really make any difference.
What version of Windows are you running? On Vista I have to run the game and any development programs in administrator mode to keep Windows from interfering; and I've seen others have similar problems on some of the other new-ish versions of Windows.
 |
 Tea Queen
Laura
    

|
4/3/2014 | |
I'm running Windows Vista as an adminstrator. After turning off user account control, and reinstalling the CAOS Tool a second time, I no longer get the Transaction Failure error, but now when I go to inject the install and event scripts nothing happens. The Garden Box is injected but nothing happens. Here's an updated code:
*install:
new: simp 1 205 14868 "blnk" 0 0 9000
setv name "spawn_script" 1000
sets name "sprite_file" "eggstravaganza"
setv name "sprite_pose" rand 0 240
addv name "sprite_pose" 10
*classifiers:
setv name "prod_fmly" 2
setv name "prod_gnus" 11
setv name "prod_spcs" 14868
seta va00 targ
enum 1 1 14868
mesg wrt+ targ 1000 va00 0 0
next
*spawn:
scrp 1 205 14868 1000
inst
*randomly choose one of the 241 frames
*240 in the command for 241 eggs, since it starts counting by 0
setv va00 rand 0 240
*offset the generic growing sprites, so they do not get picked as ripe frame
addv va00 10
*create eggstravaganza plant:
new: simp 2 11 14868 "eggstravaganza" 1 va00 name "patch_plane"
*properties:
attr 80
*bhvr 48
accg 2
perm 64
fric 100
elas 30
aero 2
mvto _p1_ _p2_
setv name "patch_id" mame "patch_id"
tick rand mame "tickfrom" mame "tickto"
doif tick eq 0
tick 200
endi
endm |
|
 Tea Queen
Laura
    

|
4/3/2014 | |
Nevermind: I put 'enum 1 1 14868' instead of 'enum 1 1 22929'. 
EDIT: Now I have a different issue! The patch plant will only inject once (i.e. showing an egg next to the cursor) and not a second time.  |
 Code Monkey
evolnemesis
    
|
4/3/2014 | |
Could this be an issue?
*create eggstravaganza plant:
new: simp 2 11 14868 "eggstravaganza" 1 va00 name "patch_plane"
Is that supposed to be "patch_plane"? Even if it is though, from the problem you are having and how the code looks, it seems your issue has to be somewhere around that line.
EDIT: never mind... i've been looking at code for other patch plants... that seems right... I still think the issue is around there... I don't know what things restrict or allow more than one copy of an agent in a world though... I know there are a lot of agents that restrict the number of copies in a world to one.
"For small creatures such as we, the vastness is bearable only through love."
"We are a way for the cosmos to know itself." - Carl Sagan |

Malkin
     Manager

|
4/3/2014 | |
Laura wrote: Nevermind: I put 'enum 1 1 14868' instead of 'enum 1 1 22929'. 
EDIT: Now I have a different issue! The patch plant will only inject once (i.e. showing an egg next to the cursor) and not a second time. 
What happens when you try to draw the area where you want them to grow at that point?
My TCR Norns |
 Tea Queen
Laura
    

|
4/3/2014 | |
It doesn't even let me do that.  |

Malkin
     Manager

|
4/3/2014 | |
Do you have autokill on? Maybe turning it off for a bit will give you an error that you can use.
My TCR Norns |
 Tea Queen
Laura
    

|
4/3/2014 | |
Autokill has always been off, and it doesn't throw up any errors. >< |
 Prodigal Sock
Ghosthande
    

|
4/3/2014 | |
Are you sure there's no possibility that it's injecting more? I've had it happen multiple times that an agent "doesn't inject" but has no errors... and it almost always turns out that the agent actually is injecting, but it's sending the agent to some funky location I can't see. Such as, exactly behind the last one, or somewhere outside of the metaroom. This can happen for a lot of reasons... it isn't FRELing when it's supposed to, the bit of code that calculates its coordinates is borked, etc.
Usually when I think that might be happening, I break out the cheat "outv totl [agent's classifier]", which returns how many of the given agent exist in the world. Just to be absolutely sure there's only one. Might help here?
 |
 Tea Queen
Laura
    

|
4/4/2014 | |
Ah okay, that seems like a possibility! I'll break out the 'outv cheat' and see what happens. Also, if anybody wouldn't mind helping me investigate this issue further, and doesn't mind spoilers, holler and I'll provide the C16 file. I really appreciate everyone's help so far, thank you! It's getting frustrating because I just want to get on and code this thing! Maybe I'm missing something glaringly obvious.
EDIT: Huh, it suddenly seems to be working now... So far! I'm not gonna hold my breath though. This is before I've tried any cheats. |

Malkin
     Manager

|
4/4/2014 | |
Sometimes it's just a case of clearing out the old code by turning the game off and on again. Perhaps it was the catalogue files needing to be in the right place?
My TCR Norns |
 Tea Queen
Laura
    

|
4/4/2014 | |
Well, I did have to restart my laptop, because my antivirus software needed to update; perhaps that was it? I also installed the catalogue files correctly before injecting the Garden Box. |