Page 1 of 2

AlcScript indentation levels

PostPosted: Sat Jan 10, 2009 12:02 am
by Grogyan
I'm reading through many scripts which use responders, and I realised that I don't know what the indentation levels mean or what needs to be
here is an example
Code: Select all
OneShotRgn:
    logic:
        modifiers:
          - tag: OneShotRgn
            activators:
             - type: objectinvolume
               triggers:
                - enter
            conditions:
             - type: volumesensor
               satisfied: true
               direction: enter
            actions:
             - type: responder
               ref: OneShotSeekPt
        actions:
          - type: responder
            name: OneShotSeekPt
            responder:
               states:
                - cmds:
                   - type: oneshotmsg
                     params:
                        receivers:
                         - oneshotmod:OneShotSeekPt

I'm just trying to get my head around for what I need to do now and in the future when I start implementing a rather complex puzzle, right now its triggering a oneshot avatar animation with a region

I've also seen similar with callbacks and markers

Can someone please explain to me what these indentation levels mean and why they are the spacing they have to be?

Re: AlcScript indentation levels

PostPosted: Sat Jan 10, 2009 5:52 am
by D'Lanor
Alcscript is parsed by YAML. So if you really want to know you may want to look into some basic YAML documentation. For example here.

Re: AlcScript indentation levels

PostPosted: Sat Jan 10, 2009 7:47 am
by Trylon
I made a quick example of the structure below. The indentation levels indicate groups and subgroups

Code: Select all
BLENDER_OBJECT_NAME:
    group 1:
        subgroup 1:
            key 1: // has list of string items as value
              - "string item one"
              - "string item two"
              - "string item three"
            key 2: 2.0 // numeric value
        subgroup 2:
            key 3: // has list of subgroups as value
              - key A: value1 // the dash indicates start of 1st list item (list item being a subgroup)
                key B: string
                key C: 1.0
              - key A: value2 // the dash indicates start of 2nd list item (list item being a subgroup)
                key B: string
                key C: 2.0
              - key A: value3 // the dash indicates start of 3rd list item (list item being a subgroup)
                key B: string
                key C: 1.0
   category 2:
       key4: value


I hope this gives a general idea of the structure.

Re: AlcScript indentation levels

PostPosted: Sat Jan 10, 2009 3:22 pm
by Chacal
Pardon my noobness, but it seems to me AlcScript isn't a script at all, it's a set of keys and values.

Wasn't a markup language named XML invented for precisely that purpose?

Re: AlcScript indentation levels

PostPosted: Sat Jan 10, 2009 5:14 pm
by Lontahv
Chacal wrote:Pardon my noobness, but it seems to me AlcScript isn't a script at all, it's a set of keys and values.

Wasn't a markup language named XML invented for precisely that purpose?


Heh yeah. AlcScript is sorta like Python-style markup language--YAML.

I didn't used to like XML but now I use the built-in Python XML parser for configs for my apps and I'm really happy. :)

Maybe PyPRP2 and have some kind of simplified PRC system. But then again, now that the AlcScript-plague has spread people will want AlcScript so they can use their old "scripts" with a new plugin. :P

Re: AlcScript indentation levels

PostPosted: Sun Jan 11, 2009 12:02 am
by Grogyan
It wouldn't be so much of a problem if the scripting for a responder looked like it makes sense, to a guy like me anyway.

while I can follow each indentation meaning a new block
a hyphen meaning the start of a list

I can't understand what the white spaces mean for responders, cause as I look at it in notepad++, there is 1 space, 2 spaces, and 1 space backwards.

Image

So the original question is, in terms of AlcScript, what do these levels of indentation mean?

And seeing as YAML, yes I did some research into it, is the best platform for data serialization, would it be possible as a feature request for PyPrp2 to use a better standard of having data in blocks, as a physical tab indent, and limit listing data to just 2 white spaces after the first hyphen declaring a list?

Edit: I made a small mistake in the picture above, in the second red line, I should have put in that, that indentation is incorrect, if you compare it with the -tag at near the start of the script. Its from this and followed on that the indentation makes absolutely no sense, and to me its laughable when YAML prides itself in human readability.

Re: AlcScript indentation levels

PostPosted: Sun Jan 11, 2009 4:51 am
by Jojon
While I have not read up on YAML and stuff, I'd put that down to the parser being lenient on syntax, or rather not really care just how much you indent as long as it's larger than that of the previous level. I'd stick with 4 spaces (I wickedly use tabs though :P) for normal indentations and 2space-hyphen-space for list initiators. This should arrange things neatly in steps of 4 characters (well, as long as the font is non-proportional).

I was going to say something about looking at it as a tree structure, but that screenshot takes care of that. :7

Re: AlcScript indentation levels

PostPosted: Mon Jan 12, 2009 12:21 am
by Grogyan
Only thing is, it only works with this indentation scheme

More reason to why i'm confused with it

Re: AlcScript indentation levels

PostPosted: Mon Jan 12, 2009 10:29 am
by Jojon
Oh, that seems odd to me - hopefully somebody with a bit of knowledge will weigh in on the matter, but that makes me half a-wonder whether it's really we who do things wrong, or if maybe we can blame the parser... :P


Also, if some developer could find time to outline, in layman's terms, how the whole responder thing fits together and how alcscript represents it, that would be more useful than most other things they might write about, I believe -- there are lots of things that has made myself shy away from poking further than surface-deep into alcscript -- I am guessing that quite a bit of AS list stuff is referenced by order of appearence, but idunno and I can't see anyone telling... :7

Re: AlcScript indentation levels

PostPosted: Mon Jan 12, 2009 11:21 am
by Chacal
Here's an intro called "Plasma 101" that was started by Hoikas some months ago.
http://www.guildofwriters.com/wiki/Plasma_101