Mythruna
April 20, 2024, 02:45:40 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to the new forums. See "Announcements" for a note for new users.
 
   Home   Help Search Login Register  
Pages: 1 [2]
  Print  
Author Topic: Simple Script Engine [suggestion]  (Read 15551 times)
randomprofile
Global Moderator
Sr. Member
*****
Posts: 265


View Profile WWW
« Reply #15 on: September 15, 2011, 03:47:16 AM »

Well... now that you think about it... it would be a waste of time. But... crap... I once had a screenshot of Scripting lang dictonary I made for a game called Halo CE which most of you know, But that game didn't have a scripting lang yet. But I guess... no point inventing the wheel a second time Tongue
Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #16 on: September 15, 2011, 10:13:59 AM »

The scripting language defines the syntax and there are already plenty of good ones... but... the rest is specific to the game, the API, the "extensions" I add to the language, etc..  That stuff will certainly be worthy of all kinds of cheat sheets.

For example, here's a current snippet of my tree tools script:
Code:
...snip the other action definitions...

action( group:"Trees", name:"Tall Scrub Tree", type:ActionType.Block ) {

    console.echo( "Creating tree 3 at:" + it );
    if( it.side != Direction.UP ) {
        console.echo( "Trees must be placed on a vertical surface." );
        return;
    }

    loc = it.getBlock();
   
    factory = new ScrubTreeFactory2();
    factory.addTree( loc.x, loc.y, loc.z + 1, world, new Random() );
}

on( [playerJoined] ) {
    type, event ->

    println( "Adding tree tools to player:" + player );

    def refs = []

    ToolActions existing = player[ToolActions.class];
 
    if( playerData != null ) {         
        if( playerData.get( "grant.trees" ) != null ) {
            refs += actions.getRef( "Trees", "Simple Tree 1" );
            refs += actions.getRef( "Trees", "Simple Tree 2" );
            refs += actions.getRef( "Trees", "Maple Tree" );
            refs += actions.getRef( "Trees", "Tall Scrub Tree" );
            refs += actions.getRef( "Trees", "Clear Tree" ); 
        }
    }           
   
    println "Refs:" + refs;
   
    player << new ToolActions(refs, existing)
}   

action()?  on()?  "playerJoined"?  ActionType what?  What are these things?  I'm sure there will be some cheat sheets someday. Smiley
Logged
martinflok
Newbie
*
Posts: 1



View Profile
« Reply #17 on: October 03, 2011, 06:45:55 AM »

Ha, well, fun
Logged
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!