Jump to content
  • Advertisement
  • entries
    503
  • comments
    1888
  • views
    335406

Scripting Functions

Sign in to follow this  
EDI

99 views

So I was adding to my ever growing list of scripting functions, and I thought you might like to see the current set of functions that S3Engine exposes to lua to allow interaction. It might invoke some ideas if you are working on similar games or systems =)


//System functions
mainEntity(entity); //set the entity that responds to user control

//camera control functions
watchEntity(entity); //make the camera focus on entity

//map creation functions
createMap(file,alias,script); //create a map with a .map file, an alias, and a .script file

//map control functions
selectMap(map); //make 'map' the current map

//entity creation functions
createEntity(file,script); //create a new entity with a .entity file and a .script file
destroyEntity(entity); //GC the entity

//entity control functions
visible(entity,bool); //set entity visiblility
clickable(entity,bool); //set entity cilickability
color(entity,r,g,b,a); //set entity color
place(entity,node); //place entity on node
remove(entity); //remove an entity from the current map
look(entity,direction); //make an entity look at a direction
lookAt(entity,entity); //make an entity look at another entity
engage(entity,entity); //make both entities look at each other
move(entity,node); //move the entity to 'node'
anim(entity,name,interupt,restart); //animate the entity
pause(entity,millis); //set a waitable milliseconds timer on the entity

//topic creation functions
createTopic(entity,name,topic,visible); //create a topic for the entity
//topic control functions
beginDialogue(); //begin the dialogue mode (contingent on topic rules)
endDialogue(); //end the dialogue mode
showTopic(entity,name); //make the topic visible
hideTopic(entity,name); //make the toppic invisible
setTopic(entity,name,state); //set the topic state to 'state'
incTopic(entity,name); //increment the topic state by 1
decTopic(entity,name); //decrement the topic state by 1

//inventory control functions
addItem(entity,entity); //place in inventory
removeItem(entity,entity); //remove item from inventory

//synchronization functions
beginScene();//used for locking out player interaction
endScene();
beginEntity();//used for gaining exclusive access to an entity
endEntity();
wait(entity,event);//used to wait for synchronized events

Sign in to follow this  


5 Comments


Recommended Comments

So, overall how did you find Lua? Is it easy to bind C functions? How much versatility does it allow, and what kind of syntax does it use? Can you have multiple control paths, like -
// script for mushu's drunken flirting strategy

if ( isAttractive( currEntity ) ) {
attemptToGetDrunk( currEntity );
} else {
nextEntity( currEntity );
}

Or is it solely linear?

Basically, on a scale of 42 to Awesome, how did you find it?

Oh, and what is a "sheet editor"? :X

Share this comment


Link to comment
That's a pretty neat system. Sounds a bit like the godmode function in MW, and the mana refill function (those two put together are why I beat the last battle in under a minute. >_>), except with other stuff added in like the selectEntity one (you could only control Morning!).

Share this comment


Link to comment
@Mushu - The sheet editor allows us to trim transparent areas, group animations, and store anchor points. It loads the frames, trimming off all of the excess transparent data, leaving us with a smaller image. So, we offset the anchor point to represent the loss of image data, and then save that to a .sheet file. Then, the loaded image files are saved in a sequentially named sequence, ie before it was frame0001.png - frame0010.png, now its Walk0001.png - Walk0010.png.

It also allows for deletion of frames and insertion of frames.

Edit: This is how I've been designing it anyway, but I could be completely wrong (I'm not the best at understanding how people want things done.)

Share this comment


Link to comment
Man, that kind of simplicity would be nice. Our engine-script interface functions take well over 100KB of code to declare (and that's with minimal commenting).

Welcome to the wide and chaotic world of scripting [grin]

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!