|
Development Forum |
 |
|

Malkin
     Manager

|
8/14/2012 | |
How would you go about making a 'smart' vendor - ie. a vendor that doesn't vend if there are many of its vended items lying about close nearby... (Yes, I'm talking to YOU, vendor-addicted norns!)
Assuming the vended item has a tick, so it will eventually vanish... Does the following look right?
*Vendor Push
scrp 2 23 X 1
*Stimulate
stim writ from 90 1
*Only vend if there aren't already many clouds nearby.
rnge 300
setv va66 0
esee 1 1 X
addv va66 1
next
doif va66 le 4
mesg writ ownr 1001
endi
endm
|
and for completeness' sake, the 1001 script is
2 23 X 1001
lock
pose 1
*Get positions
setv va00 posl
subv va00 4
setv va01 post
subv va01 30
snde "spry"
reps 16
inst
targ ownr
new: simp 1 1 X "smoke" 15 30 6000
attr 64
alph rand 100 200 1
setv ov01 rand 20 30
doif tmvt va00 va01 = 1
mvto va00 va01
else
mvsf va00 va01
endi
tick 5
slow
wait 5
repe
endi
slow
targ ownr
** wait a while
wait 10
pose 0
endm |
My TCR Norns |

Moe
  

|
8/14/2012 | |
It looks fine at a glance. Are you having trouble? |

Malkin
     Manager

|
8/14/2012 | |
I'm kind of used to always having things crash on me, and I can't double-check it with the CAOS Tool, so I prefer to ask about anything I'm not sure about as soon as I can. ![[nblush] [nblush]](/images/smilies/emot_blush.gif)
My TCR Norns |
 Peppery One
Papriko
    
|
8/15/2012 | |
Bell pepper says: "Seems legit."
I for myself always put the creation code directly into the if-statement and don't mesg ownr with a second script, but the solution you presented should work.
Btw: Is it just me or is there really no unlock command to in the 1001 script?
When I remember right does endm have the same effect too, still wanted to mention it.
Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis... |

Moe
  

|
8/15/2012 | |
Yes, ENDM releases the lock. When a script ends, there's nothing left to be locked, after all. |

AquaShee
   
|
8/17/2012 | |
I'm gonna have to join the " Yup, this code seems fine!" chorus. 
It's annoying that you can't 'spellcheck' you CAOS code without a Mac version of the CAOS Tool. :/ Does the game itself at least give you readable errors when injecting?
The Community Scribble: make (y)our own metaroom! |

bailey76


|
8/17/2012 | |
Would it be possible to make a smart vendor for Creatures 1 or Creatures 2? I see esee which is probably not in there. |

Malkin
     Manager

|
8/17/2012 | |
My Mac gives me no error messages at all... ![[heart] [heart]](/images/smilies/heart.gif)
I mean, I've learned a couple of basic rules to troubleshoot myself (check all doifs have a corresponding endi), but it would make writing code so much simpler if I could have a non-human grammar checker. 
Hi Bailey, not sure if you've seen this, but here you can get a list of the CAOS language for C1, and here you can get the same for C2. (Direct links, a PDF and a .DOC file, sorry!)
I imagine you could make a smart vendor for C1 by checking the total (TOTL) of the vended items, rather than looking nearby for vended items, and making sure the items decay after a period of time. That way, even if the things scattered around the world, they would eventually bite the dust, and the vendor could vend anew. Not sure about C2 - I've never tried writing for it. 
My TCR Norns |

AquaShee
   
|
8/17/2012 | |
I'm not sure what options are available for Macs, but you could try looking for a text editor that has custom syntax highlighting.
I personally use Notepad++ for writing HTML and CSS and it lets you define your own language. It's not available for Macs, but there must be similar software out there. 
I'll have a look during my lunch break at work when work starts again in a few weeks (I get to use a mac there) to see if I can find something that works for you.
The Community Scribble: make (y)our own metaroom! |

bailey76


|
8/18/2012 | |
Thanks Malkin I'm going to try making a smart vendor. |

Malkin
     Manager

|
8/18/2012 | |
How does highlighting help to learn CAOS? RProgrammer wrote some highlighting addons for Jedit (as discussed here), which I have gotten to work, but I haven't quite gotten the knack of how the colour-coding helps. I have been using TextWrangler, as it comes with a 'find the differences' tool included, which I've found helpful, and it preserves line breaks in CAOS, which Liam and Moe find helpful when they try to look at my cos files. TextEdit, the Mac equivalent of Notepad, doesn't seem to have that functionality enabled by default, so all of my CAOS written with it will look like a big string on a PC. 
Bailey, I don't know how comfy you are with CAOS, but you might like to look at these C1 COB tutorials. 
My TCR Norns |

bailey76


|
8/18/2012 | |
Thanks Malkin. I am pretty comfy with CAOS but these could be useful - I like the norn underground. Currently having sprite issues.  |

Malkin
     Manager

|
8/18/2012 | |
Aww - good luck! 
Just as a further question - is the way I've got the push script set up friendly to this agent being pushed by other agents, such as Tails or the Prate? I think that was one of the features requested on the Creatures Development Standards, but I don't know how to achieve it.
My TCR Norns |

AquaShee
   
|
8/18/2012 | 1 |
Most stim commands and similar just silently fail when performed on a non-creature object. So there's usually very little you have to worry about unless you are doing some very specific things to the creature that pushed it.
If you want to play it really safe, you can use a doif to skip the creature-specific bits if needed, but your example above seems perfectly fine.
Syntax highlighting helps with things like missing endi, endm and similar. Without those I'd never manage to write complex nested doifs in my agents.
The CAOS syntax highlighting also helps a lot because it shows when all the variables a command needs have been satisfied. 
The Community Scribble: make (y)our own metaroom! |