I found something interesting in a game called Dungeon Quest. The editor allow you to click on a object eg: wall, statue etc... and add a message to it.
I used a Coffin01 object in the editor, right clicked it and it has some properties id name, script and a few others. So the idea of the Script to the object was really cool you can add a script to the object in so many ways eg: The party can die, heal, spawn monster etc...
So I think it would be cool to right click a object in the editor and be able to add a script to it
Also the beauty of this idea is there are no added lua script objects or external lua file the whole object is the script
Imagine right clicking a object in the editor and you can add the scripting to it eg: onhit, onuse, any of the hooks that LOG 2 uses can be applied to the object it's self. If you download the Editor of this game you can see how objects are used this way so simple
Yes the game is for phones yeah but the idea is cool
The Game Forum:
Right Click Coffin Object Scripting Function:
message("Here lies Kealdar, king of goblins.");
Now let’s examine that piece of code to see what it actually does.
The first line is:
Basically it makes something happen upon clicking the coffin. The line could be ”translated” into:
If event use Which is not so hard to understand. In event of using. There are a number of these ”if lines” - for example writing:
makes something happen if the object is attacked (If event hit). I’ll go through the actual reason for writing if(evtuse()) and not If event use in the last, coding part of this manual.
The second line is a brace:
The last line is also a brace but turned the other way around.
You will have to write these two braces after an if line. Because what’s inside these, is what will happen if the if condition is met. And what is the middle line in this case?
It’s message(”Here lies Kealdar, king of goblins”);
Which is pretty self-explanatory.
All these commands are called functions. Your script contains two functions: an if() function and a message() function.
Why do I have to enter all these strange symbols, you may ask. These are simply commands to say what to do. Take the message example above. Without text it looks like:
The () is a signal to the Editor: within these is what the message will say. The ”” means that it’s text the message will say.
It’s almost the same with this line:
if(evtuse()) If is the function itself, and the condition is within the (). Evtuse is actually another functions, hence the (). But in this case nothing is needed - we’ll dig deeper into that in the script section.
So, in short the code says:
In event of using, show the message ”Here lies Kealdar, king of goblins”.
Not that hard, eh?