🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Scripting Functions

posted in A Keyboard and the Truth for project 96 Mill
Published April 19, 2006
Advertisement
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 functionsmainEntity(entity); //set the entity that responds to user control//camera control functionswatchEntity(entity); //make the camera focus on entity//map creation functionscreateMap(file,alias,script); //create a map with a .map file, an alias, and a .script file//map control functionsselectMap(map); //make 'map' the current map//entity creation functionscreateEntity(file,script); //create a new entity with a .entity file and a .script filedestroyEntity(entity); //GC the entity//entity control functionsvisible(entity,bool); //set entity visiblilityclickable(entity,bool); //set entity cilickabilitycolor(entity,r,g,b,a); //set entity colorplace(entity,node); //place entity on noderemove(entity); //remove an entity from the current maplook(entity,direction); //make an entity look at a directionlookAt(entity,entity); //make an entity look at another entityengage(entity,entity); //make both entities look at each othermove(entity,node); //move the entity to 'node'anim(entity,name,interupt,restart); //animate the entitypause(entity,millis); //set a waitable milliseconds timer on the entity//topic creation functionscreateTopic(entity,name,topic,visible); //create a topic for the entity//topic control functionsbeginDialogue(); //begin the dialogue mode (contingent on topic rules)endDialogue(); //end the dialogue modeshowTopic(entity,name); //make the topic visiblehideTopic(entity,name); //make the toppic invisiblesetTopic(entity,name,state); //set the topic state to 'state'incTopic(entity,name); //increment the topic state by 1decTopic(entity,name); //decrement the topic state by 1//inventory control functionsaddItem(entity,entity); //place in inventoryremoveItem(entity,entity); //remove item from inventory//synchronization functionsbeginScene();//used for locking out player interactionendScene();beginEntity();//used for gaining exclusive access to an entityendEntity();wait(entity,event);//used to wait for synchronized events
0 likes 5 comments

Comments

ildave1
Engine is progressing nicely. Keep up the smashing good work dood!
April 19, 2006 11:48 AM
Mushu
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
April 19, 2006 12:59 PM
Twisol
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!).
April 19, 2006 01:08 PM
Programmer16
@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.)
April 19, 2006 01:20 PM
ApochPiQ
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]
April 19, 2006 04:00 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement