creatures caves
welcome, guest 

downloads   gallery   dev   community   creatchi   forum   mycaves
bookmarks | search | post new topic
 
Development Forum
old
Post your broken C2 CAOS -> Receive help   
GimmeCat

GimmeCat
United Kingdom  


  12/20/2016

I've always wanted to remain active on CC, but since I'm not currently playing the games I have very little to contribute. But then this idea occurred.

I know a fair bit about C2CAOS scripting. So if anyone is currently modding for C2 and running into problems, post a question or a block of code here, and I'll do my best to help.

Others are welcome to help too, and I'd encourage anyone who is adept with C3CAOS to post a separate thread in the same vein as this.

-----

Quick Reference Guide

Download a copy of the C2 CAOS Bible. Look there for:

Event numbers (p.36 )
-These are most commonly used as part of your script name. For example, a script ending in "scrp x x x 9" is a Timer script.

ATTR values ( p.37 )
-Attr determines how the object behaves physically in the world. If an object has its Attr set to 128, it is affected by gravity, but absolutely nothing else. To stack more effects, you add the numbers together. So, an object that suffers gravity, is carryable, and responds to collision, would have an Attr of 128+1+64 = 193.

BHVR values ( p.37 )
-Bhvr determines what the object does when touched by either the pointer or a Creature. Just like Attr, stack multiple behaviours by adding the number values together.

MESG values ( p.38 )
-Mesg is used when you want an object to broadcast a command to another object, in order to create a chain reaction.

ACTV values ( p.38 )
-Actv is the activation state of the object at any given moment. Objects are either inactive (they haven't been touched or activated), active (they have been touched or activated and are currently performing an action as a result), been hit, or been eaten.

MOV values ( p.38 )
-How the object travels the world, if at all. Most commonly 0 until it is picked up (if allowed by Attr).

STM# values ( p.38 )
-Used to infuse Creatures with a specific neurological stimulation. (Note: For delivering nutrition as part of a food's Eat script, use STIM instead)

Words ( p.39)
-The vocabulary of Creatures language.

Chemical list ( p.40 )
-The IDs of every defined chemical in the game, such as Glucose, Oxygen, Pain, Reward, etc. This is what you refer to when defining the Eat script (scrp x x x 12) of a food COB, for example.

--------

For Object ID numbers and Classification, download this, unzip the contents somewhere and then doubleclick the c2scrp.htm file. This is the raw Scripturium resource. With it, you can find out exactly what, for example, "scrp 2 16 1 9" means (2:System 16:Nests 1:Anthill 9:Timer).

--------

 
Venithil

Venithil



  12/20/2016

Given that your and Monica Darwin's COBs are responsible for 90% of my C2's norns diet, it'd make sense you were the person to make that sort of topic :P

I was going to just do one (or two) genetic things with C2 Creatures before moving onto C3, but I want to start learning CAOS too at some point so I can make other things as well. I'll bookmark this topic and get back when I start and yet hit a wall!


I document some of my playthroughs in a blog-style fashion with comments enabled. I may just change them into a blog, but if you're interested in reading such things beforehand, feel free!
 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  12/22/2016

When I was reconstituting Zap's Modified Carrots & Potatoes, I also had a look at the tomato (the nuts are essentially a reskinned tomato, code-wise).

The one problem that I don't even begin to know how to solve is that of the plants getting stuck in one pose. Does anyone have any ideas?

* Script 9 TIMER - tomato plant
scrp 2 4 1 9
setv var9 ownr
*if ov00 is 0
doif ov00 eq 0
*check if you're fullgrown
doif pose lt 6
setv var0 pose
addv var0 1
pose var0
else
*if you're fullgrown, vend a tomato
setv var1 posl
setv var2 post
*randomly choose to vend from the left or right tomato
rndv var0 0 1
*vend the left tomato
doif var0 eq 0
inst
subv var1 10
addv var2 5
setv ov00 1
*full, ripe tomato
new: simp toms 10 22 1100 0
setv cls2 2 25 1
*carryable, mousable, activatable, gravity, physics
setv attr 199
bhvr 0 67
setv size 50
mvto var1 var2
setv ov00 0
setv ov01 var9
rndv var8 500 1000
tick var8
slim
*set the plant's ov00 to 1 and strike a pose of the left tomato being eaten
targ ownr
setv ov00 1
pose 7
slow
*vend the right tomato
else
inst
addv var1 10
addv var2 20
setv ov00 3
*full, ripe tomato
new: simp toms 10 22 1100 0
setv cls2 2 25 1
*carryable, mousable, activatable, gravity, physics
setv attr 199
bhvr 0 67
setv size 50
mvto var1 var2
setv ov00 0
setv ov01 var9
rndv var8 500 1000
tick var8
slim
*decay and set ov00 to 3 for the plant, strike a pose of the right tomato being eaten
targ ownr
setv ov00 3
pose 11
slow
endi
endi
endi
targ ownr
*if the plant's ov02 is 1
doif ov02 eq 1
*if the plant's vended its left tomato, regrow
doif ov00 eq 1
doif pose lt 10
setv var0 pose
addv var0 1
pose var0
else
*if not, appear as having a fullgrown tomato
pose 6
addv ov01 1
setv ov00 2
endi
endi
*if the plant's vended its right tomato, regrow
doif ov00 eq 3
doif pose lt 14
setv var0 pose
addv var0 1
pose var0
else
pose 6
addv ov01 1
setv ov00 4
endi
endi
endi
targ ownr
*if ov01 is greater than 1, time to die
doif ov01 gt 1
setv ov00 5
endi
doif ov00 eq 2
inst
setv var1 posl
setv var2 post
subv var1 10
addv var2 5
setv ov00 1
*full, ripe tomato
new: simp toms 10 22 1100 0
setv cls2 2 25 1
*carryable, mousable, activatable, gravity, physics
setv attr 199
bhvr 0 67
setv size 50
mvto var1 var2
setv ov00 0
setv ov01 var9
rndv var8 100 150
tick var8
slim
*leftmost tomato eaten
targ ownr
pose 7
slow
endi
doif ov00 eq 4
inst
setv var1 posl
setv var2 post
addv var1 10
addv var2 20
setv ov00 3
*full, ripe tomato
new: simp toms 10 22 1100 0
setv cls2 2 25 1
*carryable, mousable, activatable, gravity, physics
setv attr 199
bhvr 0 67
setv size 50
mvto var1 var2
setv ov00 0
setv ov01 var9
rndv var8 100 150
tick var8
slim
targ ownr
*right tomato eaten
pose 11
slow
endi
*time to die
doif ov00 eq 5
doif pose lt 21
doif pose ge 15
setv var0 pose
addv var0 1
pose var0
else
pose 15
endi
else
kill ownr
endi
endi
endm



I think I've been able to refix the invisibility feature, and I've used the drop command in the eat script to try to force a dropping:


* Script 4 Picked up - tomato
scrp 2 25 1 4
doif ov00 eq 0
setv var9 ov01
enum 2 4 1
doif targ eq var9
setv ov02 1
endi
next
targ ownr
setv ov00 1
endi
endm


* Script 9 TIMER - tomato
scrp 2 25 1 9
doif ov00 eq 0
rndv var0 -1 1
mulv var0 10
setv velx var0
setv ov00 1
setv var9 ov01
etch 2 4 1
doif targ eq var9
setv ov02 1
endi
targ ownr
next
rndv var0 1000 1500
tick var0
stop
endi
doif ov00 eq 1
doif carr eq 0
doif grav eq 0
doif pose lt 4
setv var0 pose
addv var0 1
pose var0
rndv var0 100 300
tick var0
*if you're beginning to sprout, change your attributes and behaviour
doif pose gt 2
*Suffer collisions, invisible
setv attr 80
bhvr 0 0
endi
else
setv ov00 2
endi
endi
endi
endi
doif ov00 eq 3
doif pose lt 9
*mouseable, collisions, physics, invisible
setv attr 210
bhvr 0 0
setv var0 pose
addv var0 1
pose var0
else
setv ov00 2
endi
endi
doif ov00 eq 2
doif carr eq 0
doif intr ge 70
doif intr le 100
setv rnge 500
esee 2 4 1
addv var9 1
next
targ ownr
doif var9 lt 5
inst
setv var0 posl
setv var1 post
subv var1 24
*growing and decaying plant, also covers tomato plant growing from left-alone tomato
new: simp toms 27 0 1000 0
setv cls2 2 4 1
*mouseable, collisions, physics
setv attr 68
bhvr 0 0
setv size 50
setv ov00 0
mvto var0 var1
rndv var0 100 150
tick var0
endi
addv ontr 5
kill ownr
else
addv ontr 5
kill ownr
endi
else
addv ontr 5
kill ownr
endi
endi
endi
endm

* Eat Script - tomato
scrp 2 25 1 12
doif pose eq 0
snde chwp
pose 5
setv ov00 3
addv attr 16
stim writ from 0 255 0 0 73 100 70 30 79 30 37 100
drop
endi
doif pose eq 1
snde chwp
pose 6
setv ov00 3
addv attr 16
stim writ from 0 255 0 0 73 100 70 30 79 30 37 100
drop
endi
endm


My TCR Norns
 
GimmeCat

GimmeCat
United Kingdom  


  12/22/2016

Can you identify which pose it's getting stuck on? That would make a decent starting place to investigate the problem.
 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  12/22/2016

I think it's one of the growing poses, but that doesn't narrow it down any, really. Have you ever noticed your tomato or nut plants getting stuck in a pose? The sprite file also reuses a couple of images (25 and 26 are copypasted as 30 and 31).

My TCR Norns
 
GimmeCat

GimmeCat
United Kingdom  


  12/22/2016

It's possible I've noticed it at some point, but not recently enough to stick in the mind.

Alright, I'm running through the script logic in my head at the moment. I'm about halfway through. This part looks odd to me:

*if not, appear as having a fullgrown tomato
pose 6
addv ov01 1

ov01 is a persistent var that newly created tomatos are using to keep track of their owner plant (gained from setv var9 ownr in the plant's timer script and pushed to the tomatoes once they ripen). But the plant itself doesn't appear to be using ov01 for any other purpose.

Before this line, "addv ov01 1", ov01 is never defined on the plant itself, and as far as I can tell, has no value.

Another bit I'm struggling with is the use of var9 in the tomatoes. I'm not entirely sure of this, but it looks as if possibly it's using "enum" to count the number of existing tomato plants? But that alone won't count them, it just cycles through them. It would need to increment a separate variable in the enum loop to count them.

I'm assuming it's trying to count, from this line: "doif var9 lt 5", since the only way var9 wouldn't still be set to "plant owner" would be if it's being used as a tally.

Does any of that make sense? I'm dangerously low on blood sugar at the moment and could be talking nonsense. :P I need to go have dinner before I pass out!

 
GimmeCat

GimmeCat
United Kingdom  


  12/23/2016

After some food and a sleep, I definitely think var9 shouldn't be used as the plant tally in the tomato script.

This bit is the tomato finding its plant owner:

setv var9 ov01 <-- (ov01 is "plant owner" )
etch 2 4 1 <-- (finding any plants touching the tomato)
doif targ eq var9 <-- (if the touching plant = "plant owner" )
setv ov02 1
endi

And then later on, var9 is incremented with enum and addv, and that's where it doesn't make sense to me. I could be missing something, but I'm pretty sure that's an error.

However, I doubt any of that is causing the pose problem, but without knowing which pose it's getting stuck on, it's hard to know which part of the script might be having a problem.

 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  6/8/2017

I was trying to update the Electric Guitar so that creatures could push and pull it and have a bit more reward for actively playing it and picking it up, not just listening to it.

I'm completely unsure about the removal script, though. Modelling it on ylukyun's C2 sax, I've come up with the following:

Installation script:

inst
enum 2 13 17
setv actv 0
bhvr 0 3
next
endm


Removal script (includes default push and pickup scripts):

scrp 2 13 17 1
stim shou 0 255 0 0 36 20 42 20 44 20 45 20
doif carr ne 0
anim [012]
endi
setv actv 0
rndv var0 1 7
doif var0 eq 1
snde gui1
endi
doif var0 eq 2
snde gui2
endi
doif var0 eq 3
snde gui3
endi
doif var0 eq 4
snde gui4
endi
doif var0 eq 5
snde gui5
endi
doif var0 eq 6
snde gui6
endi
doif var0 eq 7
snde gui7
endi
endm
scrp 2 13 17 4
tick 5
endm
scrx 2 13 17 2
enum 2 13 17
setv actv 0
bhvr 0 1
next


Basically, I have no idea if that removal script will actually work. I understand if you're too busy or not inclined to help because I muffed it on the C2 tomatoes, but if you could just tell me how likely this removal script is to break everything, I'd be very grateful.


My TCR Norns
 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  7/20/2017

A potentially-immortal (but delicious) baby snake, with additional push, pull, hit and eat scripts, and with little half-second pauses at the end of each cycle (for world friendliness purposes). It's not perfect (keeps going backwards when played with), but the handful I've injected seem to keep my norns busy, before they discover the joys of SPLAT or CHOMP.

****************************
* INSTALL SCRIPT
*required files: snke.s16
*chwp.wav
*splt.wav - from helen's tutorial 10
****************************
inst
new: simp snke 16 0 3500 0
setv cls2 2 20 31501
setv attr 193
bhvr 1 75
slim
edit
tick 5
endm


****************************
* EVENT SCRIPTS
****************************
scrp 2 20 31501 1
stm# writ from 13
stim writ from 10 255 0 0 45 50 46 10 36 50 42 10
setv actv 0
doif velx gt 0
setv velx -6
base 8
anim [01234567]
over
base 0
else
doif velx lt 0
setv velx 6
base 0
anim [01234567]
over
base 0
over
endi
endi
tick 5
endm

scrp 2 20 31501 2
stm# writ from 13
stim writ from 10 255 0 0 45 50 46 10 36 50 42 10
setv actv 0
doif velx gt 0
setv velx -6
base 8
anim [01234567]
over
base 0
else
doif velx lt 0
setv velx 6
base 0
anim [01234567]
over
base 0
over
endi
endi
tick 5
endm

scrp 2 20 31501 3
stm# writ from 44
targ ownr
snde splt
kill ownr
endm

scrp 2 20 31501 9
rndv va00 0 1
doif va00 eq 0
reps 7
anim [01234567]
setv velx 6
over
repe
else
doif va00 eq 1
base 8
reps 7
anim [01234567]
setv velx -6
over
repe
base 0
endi
endi
tick 5
endm

scrp 2 20 31501 12
stm# writ from 26
stim writ from 10 255 0 0 37 80 73 100 74 100 79 100
stim writ from 10 255 0 0 72 100 150 100 151 100 0 0
targ ownr
snde chwp
kill ownr
endm



****************************
* REMOVE SCRIPT
****************************
rscr
inst
enum 2 20 31501
kill targ
next
scrx 2 20 31501 1
scrx 2 20 31501 2
scrx 2 20 31501 3
scrx 2 20 31501 9
scrx 2 20 31501 12
endm


My TCR Norns
 
GimmeCat

GimmeCat
United Kingdom  


  7/20/2017

How on earth did I miss that post about the Sax? I'm so sorry! Posting now just to let you know I'm not just ignoring you. I'll have a proper reply soon. :P
 
GimmeCat

GimmeCat
United Kingdom  


  7/20/2017

Okay, so first- the snake scripts look fine to me, but you say they're travelling backwards when interacted with? Do they also travel backwards when they move on their own? Because I noticed in the Timer script there's a missing "Base 0" before the first animation. Might be unnecessary, but for completeness sake, I'd probably add it in.

Additionally, the timer's on a very low tick value, and I must admit I don't remember whether timer scripts carry on firing when an object is being activated... so I'm wondering if the timer script is interrupting the activation scripts? That might be causing conflicting instructions. I'd stick a "tick 0" at the start of the activation scripts to prevent that happening (you already have "tick 5" at the end of them to reset the timer, which is good).

As for the Sax scripts, am I correct in assuming you're using the Removal script to re-inject the original object scripts back into the game? I've never seen that done before, but it looks legit. Did you end up trying it? You could check whether it had the desired effect by sending "dde: scrp 2 13 17 4" and examining the output.

 
Geat_Masta

Geat_Masta
United States  


  7/20/2017  1

I can tell you the timers do not interrupt other scripts, they just wait for them to finish before executing.

Donate to the development of Kreatures

(The unofficial Creatures 4)

 
Geat_Masta

Geat_Masta
United States  


  7/20/2017

Also if i have a piece of code like this:


inst
enum 2 25 8
setv va99 attr
andv va99 2
attr va99
next
endm

rscr
setv va98 notv 2
enum 2 25 8
setv va99 attr
andv va99 va98
attr va99
next


The remover script will sometimes delete the objects and sometimes not. I don't think the remover scripts are just scripts that run when the remover is used, they seem to follow different rules.

I know this because i once made a C3 agent that made it so creatures could pick up other creatures, and made a genome so ettins would take baby ettins back to the ettin terrarium.

I used to get reports that the remover script would delete all the creatures in the world, but i never was able to recreate the error.

Now that i think of it, why doesn't the ettin genome have dendrites from ettin home smell and i am holding something to drop? instead they have CAOS force them to drop, weird!


Donate to the development of Kreatures

(The unofficial Creatures 4)

 
GimmeCat

GimmeCat
United Kingdom  


  7/20/2017

I'm confused. That example you posted doesn't seem to delete objects at all.

What did the remover for that C3 agent look like? I'm curious about this issue. I thought the same thing, that they're just scripts to run when the remover is used. That has always seemed the case to me.

 
Geat_Masta

Geat_Masta
United States  


  7/20/2017

it was that code, except i hard coded numbers instead of using bitwise operators because i was a kid, but yeah it didn't delete objects at all!

Most of my agents were lost to time, not very good anyway, so i can't show the script, but there were no kill targs or otherwise on the script, it didn't delete anything, but objects got deleted.



Donate to the development of Kreatures

(The unofficial Creatures 4)

 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  7/21/2017

Thanks GimmeCat! That tip on the 'base 0' seems to have gotten it. :)

My TCR Norns
 


downloads
cobs
adoptions
creaturelink
metarooms
breeds
 
gallery
art
wallpaper
screenshots
graphics
promos
sprites
dev
hack shack
script reservations
dev resources
active projects
dev forum
 
community
links
advice
chat
polls
resources
creatchi
 
forum
bookmarks
general
news
help
development
strangeo
survivor
mycaves
log in
register
lost pw
4 online
C-Rex
Laura
Pilla
Yaravana
creatures caves is your #1 resource for the creatures artificial life game series: creatures, creatures 2, creatures 3, docking station, and the upcoming creatures family.

contact    help    privacy policy    terms & conditions    rules    donate    wiki