creatures caves welcome, guest
downloads   gallery   dev   community   creatchi   forum   mycaves
bookmarks | search | post new topic
Development Forum
old
When to LOCK?   
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  12/1/2011

Is there a way of predicting when you'll have to use LOCK on a script?

I mean, a way other than trial and error, or 'this is complex, I'd better lock it' - just after a rule of thumb here.


My TCR Norns
 
Ghosthande
Prodigal Sock

Ghosthande


 visit Ghosthande's website: Breeders Beware
  12/2/2011

Yeah, I usually use LOCK any time a script is long and/or does important things. Interruptions can be hard to test, but if there's even a slim chance that it could royally mess something up, it's good to play it on the safe side. :)

For instance, I'll admit I don't always LOCK my eat scripts, because most of the time they're only about three lines long anyways.

One example where I did use the LOCK command is the telescope from Devil's Reef. What it does, in a nutshell, is:
1.) verify that a Norn activated it
2.) determine its own location, and the relative position where the Norn should stand
3.) move the Norn there
5.) animate the telescope being rotated upward, and play a sound effect
4.) zombify the Norn so it won't move, and put it in a certain pose so it looks like it's looking through the telescope
5.) possibly make the Norn report its findings
6.) then un-zombify the Norn so it can move freely again
7.) animate the telescope being rotated downward, and play another sound effect

Given some of the telescope's behaviors (like zombifying the Norn) it could get pretty icky if it was interrupted partway through. So that's definitely something to use LOCK for.



 


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
1 online
Cervith
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