AlcScript indentation levels

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!

AlcScript indentation levels

Postby Grogyan » Sat Jan 10, 2009 12:02 am

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?
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: AlcScript indentation levels

Postby D'Lanor » Sat Jan 10, 2009 5:52 am

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.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: AlcScript indentation levels

Postby Trylon » Sat Jan 10, 2009 7:47 am

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.
One day I ran through the cleft for the fiftieth time, and found that uru held no peace for me anymore.
User avatar
Trylon
 
Posts: 1446
Joined: Fri Sep 28, 2007 11:08 pm
Location: Gone from Uru

Re: AlcScript indentation levels

Postby Chacal » Sat Jan 10, 2009 3:22 pm

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?
Chacal


"The weak can never forgive. Forgiveness is an attribute of the strong."
-- Mahatma Gandhi
User avatar
Chacal
 
Posts: 2515
Joined: Tue Nov 06, 2007 2:45 pm
Location: Quebec, Canada

Re: AlcScript indentation levels

Postby Lontahv » Sat Jan 10, 2009 5:14 pm

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
Currently getting some ink on my hands over at the Guild Of Ink-Makers (PyPRP2).
User avatar
Lontahv
Councilor of Artistic Direction
 
Posts: 1331
Joined: Wed Oct 03, 2007 2:09 pm

Re: AlcScript indentation levels

Postby Grogyan » Sun Jan 11, 2009 12:02 am

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.
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: AlcScript indentation levels

Postby Jojon » Sun Jan 11, 2009 4:51 am

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
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

Re: AlcScript indentation levels

Postby Grogyan » Mon Jan 12, 2009 12:21 am

Only thing is, it only works with this indentation scheme

More reason to why i'm confused with it
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: AlcScript indentation levels

Postby Jojon » Mon Jan 12, 2009 10:29 am

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
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

Re: AlcScript indentation levels

Postby Chacal » Mon Jan 12, 2009 11:21 am

Here's an intro called "Plasma 101" that was started by Hoikas some months ago.
http://www.guildofwriters.com/wiki/Plasma_101
Chacal


"The weak can never forgive. Forgiveness is an attribute of the strong."
-- Mahatma Gandhi
User avatar
Chacal
 
Posts: 2515
Joined: Tue Nov 06, 2007 2:45 pm
Location: Quebec, Canada

Next

Return to Building

Who is online

Users browsing this forum: No registered users and 4 guests

cron