Development Forum |
|
|
the1whoscreams
|
7/28/2014 | |
I've been thinking about agent ideas,and I came up with a glitchy glitch blob of random colors that makes norns say random text like "tf$#5gy6%Dst%$fgu" when they eat it.(It's a blob of glitch.What do you expect?)I'm wondering how you do that.I know it's the sezz command,but how do I use it to get the desired result? |
Malkin
Manager
|
7/28/2014 | |
There are a few different concepts coming into play here.
To make something happen when the object is eaten, you must put the code in the eat script (script #12).
Don't forget to put in the stimulus, so that your norns get the proper nutrients from it!
To make sure that the correct norn says what you want it to say, you must make sure that the target is from.
To make them say something, use the SEZZ command:
sezz "The goggles, they do nuzzing!" |
It's good practice to shift the target back to the ownr...
before doing things like killing the food object
and ending the eat script.
To make whatever it is random, you'll need to add in the RAND command and a long DOIF statement, using a variable - essentially rolling the random dice and then the dice says 1, the norn says 'the goggles do nothing!' and if the dice says 2, the norn says 'Ay Carumba!', etc. etc. etc. until you end your doif statement with an endi.
You can see a worked example of that in the C3 meerk.cos file - first the variable (va00) is set to be a random number between 0 and 5, then the doif begins, continues with elif, the last one is an else, and the doif statement finishes with an endi.
setv va00 rand 0 5
doif va00 eq 0
doif carr eq null
gsub dig_
else
gsub sit_
endi
elif va00 eq 1
gsub sit_
elif va00 eq 2
negv ov10
elif va00 eq 3
gsub run_
elif va00 eq 4
reps 3
gsub push
repe
else
gsub walk
endi
endi
|
Hope this helps!
My TCR Norns |
Prodigal Sock
Ghosthande
|
7/28/2014 | |
^ Precisely.
"From" in CAOS is shorthand for "whatever just made this script run"... in this case, the Creature that ate the agent.
"Ownr" is shorthand for "the agent that this script belongs to". In this case that means the piece of food being eaten.
If you'd like more information on using variables, I have an old tutorial here that explains what they are and how they work. It doesn't go into randomisation... but I think Malkin's explained that well enough.
|
Peppery One
Papriko
|
7/29/2014 | |
You could make fully randomly generated texts too. On the other hand, this would require some complicated messing with loops and character manipulation and what not. This would lead too far.
When you wanna have a look anyways, I might set up an example script.
Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis... |
the1whoscreams
|
7/29/2014 | |
Well,that would make sense for the agent.It's an edible glitch blob. |
Malkin
Manager
|
7/30/2014 | |
I'd be interested in seeing a worked example of your idea, Papriko - I've not really used loops before in coding.
My TCR Norns |
Peppery One
Papriko
|
7/30/2014 | 1 |
Okay, I kinda thought of it like this:* our random garbage string
sets va00 ""
* how many characters long our garbage will be
* RAND is a randomizer command for whole numbers.
* syntax: rand minimum maximum
sets va10 rand 8 24
* our counter
setv va20 1
* beginning the loop. All code after it will be repeated over and over
loop
* CHAR command can not add new characters, so we have to add a dummy one
adds va00 "x"
* CHAR changes the character at the n-th position to a different one. New chars are taken as numbers, see Unicode
* Creatures3 probably just can display a tiny fraction of unicode, so let's go for the first 256 or so
* syntax: char string n newchar
char va00 va20 rand 0 255
* add 1 to our counter
addv va20 1
* check if our counter va20 finally reached our maximum va10. If so, we are done, if not we gotta repeat this whole debauchery starting at the LOOP line.
untl va10 = va20
|
Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis... |
Code Monkey
evolnemesis
|
7/30/2014 | |
Papriko's code looks good... but I would suggest using
or
instead of
If you just want characters that can definitely be displayed, like letters, numbers, spaces, and punctuation, go 32 to 127...
Going 32 to 255 will add all kinds of letters with accents, currency and trademark symbols, fractions, box parts, and some other less-used odd characters too, some of which may not display correctly since the creatures font might not have representations for them... In this case, you could get just squares or something else unpredictable for a lot of those characters... (that might be okay for a glitch blob though)
You probably do want to avoid anything below 32 though... those are all control characters and almost all will not display, and many could cause weird game behavior as well.
"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 |
Peppery One
Papriko
|
7/31/2014 | |
Thanks for the tip, I was guessing on that part.
Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis... |
the1whoscreams
|
10/4/2017 | |
So, I came back to this piece of garbage and shoved Papriko's code into a pointless glitch button. |
Uzag
|
10/4/2017 | |
(...I'm in love with this glitch blob. Hilarious, adorable and not very useful = amazing) |
|