About Store Forum Documentation Contact

Post Reply 
Visual Scripting
Author Message
Ashtefere Offline

Post: #1
Visual Scripting
Hi there.

So, after checking everything out foreeeeever... I have decided my first moneymaking project will be using esenthel. I have done plenty of large scale persistant world TC's using my own server/cluster tools and looks like this is the way to go.

However, it seems to me that esenthel is a little more complicated than I first though.

My main issue is I have been babied with easier to use modding tools in production games and the 'raw' nature of esenthel has thrown me off a little.

I see in the roadmap that full tool integration is is 95% complete (this makes me really happy) and that visual scripting is coming soonish (again, really happy) but I have a few queries/requests.

Basically, how high level is the esenthel scripting system? I know at the moment its using visual studio (which is probably too harcore for me) but when you say "visual scripting" do you mean you are just throwing in the visual studio window into the esenthel editor or are you doing an esenthel specific script language/buncha-functions?

I guess what I am asking for is a higher level list of functions optionally usable to ease me/other new devs into the engine, and then gradually we can go deeper into the coding.

A good example is the NWN1/2 scripting system -> http://www.nwn2scripting.com/index.php?ID=6

It has specific functions pre-made in the game include files that do the simple/most used things.

Stuff like:
  • "Getting" the object you will apply functions to.
  • Making the character perform actions.
  • Pre-defined common actions, like "speak string" and "play animation"
  • Assigning strings and vars to an object (which is gotten by GetXChar or whatever)
  • etc.

Also, there is a helper window at the bottom of the nwn script editor and a list of filterable functions at the side. Click a function and the list at the bottom describes the function.
Will there be something similar to this?

Also, is there a list of the already present esenthel functions so I can study/learn them? I am quite familiar with c style syntax and custom function building so this could help me out.

If there is in fact no intention to create a simplified scripting framework, I would like to try help build one - a framework of simple functions and actions and identifiers to help new users get into this engine.

I am certain that esenthel will be the default indie engine of choice very soon. Its power and flexibility is frankly ridiculous.

Looking forward to feedback/response.

12-10-2010 12:30 AM
Find all posts by this user Quote this message in a reply
Esenthel Online

Post: #2
RE: Visual Scripting
Hi and welcome!

Thanks for your opinion and ideas.

I'll most certainly check the nwn2 scripting.

I'm still at the phase of planning how the scripting will look like in EE, so any ideas are most welcome!
And hope to develop it soon, as I understand, lots of people will benefit from it.

For the list of available EE functions you can check SDK\Extra\Api Reference.chm
and SDK headers, I've tried making them extremely clean, so they will be easy to read and study.
12-10-2010 01:57 AM
Find all posts by this user Quote this message in a reply
Ashtefere Offline

Post: #3
RE: Visual Scripting
Im at work right now so cant check them out, but will respond nonetheless.

Please forgive my audacity wink

The nwn2 script functions are extremely robust in their current iteration, and allow literally any game to be made with a small amount of simple functions.

For example, NWN2's default combat system is turn based/round based and relies on an auto attack and ability cast system.
Using the NWscript I was able to completely override this into a twitch based real time rock/paper/scissors influenced combat system with a very small amount of code.

I would like to help out with the scripting you chose in esenthel.
Many of the people who have used the nwnscript syntax/functions have praised its simplicity and its great power.
While I am extremely happy with the nwscript functions/system its not perfect for everyone, and I understand you have your own ideas how you want your engine to work wink

In my opinion, the most important thing in scripting has to do with getting targets properly and re-using them, in addition to setting variables on objects.

Allow me to lay out some function requests (names and syntaxes are up to you) that I personally couldnt live without.

1: GetCurrentObject;
This would return the object that the script was fired by. Pretty simple.

2: GetObjectType(object);
Would return the type of object - player, npc, item, etc. Useful for determining if a object is valid or not, based on the scripters own rules.

3: GetTarget(Targetter);
This would get the target currently selected by targetter. Generally targetter would be the object that fire the script, but can also be used to determine NPC's current target for example.
Could be a clicked target or something under a reticule, or whatever.

4: AffectObject(effecttype, object, effecter, "NameOfEffect"); / AffectLocation(effecttype, location, effector, "NameOfEffect")
This one is really a combination of a few functions, but allow me to explain.
effecttype could be an animation, a visual effect, damage, or even a script (and the script could optionally self-loop for "X over time" effects).
The name of the effect should be unique for referencing the effect (ending, overwriting, etc).

Each effect would have its own params (discussed below) so the command to animate a character would potentially look like "AffectObject(Animate("animationname", Duration, Speed, StartTime), animatedcharacter);"

Object would naturally be the target to 'effect'.

Affector would be the originator of the effect for purposes of spells, etc, and to determine the damager or the person to give xp to. Im not sure the best way to store this value on the object, but up to you. I think generally a single instance pointing to an object that is overriden each time would be most efficient.

The below are suggestions for types of effects for "AffectObject" and "AffectLocation"
4a: Animate("animation name", Duration, Speed, StartTime);
Animation name would be a simple string referring to the name of the animation.
Duration would be a float for the duration. A -1.0 here or similar could indicate it to be looping.
Speed would be a float for animation speed. 1.0 would be default.
StartTime (could also be StartFrame) would be an int referring the start point in the animation, if wanted. A 0 would be the 'start'.
If wanting to end an animation prematurely use a shorter duration than the animation.

4b: VisualEffect("Name of Visual Effect", Params, For, Visual, Effect);
I dont know how esenthel does visual effects, but the parameters for such would go here.

4d: Damage(DamageAmount);
Pretty self explanatory. Float or Int? Also, negative values could be used to heal? If not, have a specified heal function.
DamageAmount would be able to be changed by the scripter on various things like resists, etc.

4c: Whatever anyone suggests.

No longer in reference to AffectObject from here on.

5: GetVar(object, "varname");
Yup. Get a variable. Could be string/int/whatever. If the case/if statements used to make this function are too intensive, split into int/string/float forms.

6: SetVar(object, "varname");
Sets a var to an object. This var would be written to database with lazy cpu cycles or whatnot, and the cached var on the object would be referred to for speed. This is probably already used, and im probably just being pedantic.
This should be persistant.

7: Set/GetLocation(object);
Get the location of object as an mapname/X/Y/Z value. Additionally, a matching function to "set" the location (e.g., teleport, jump, etc)

8: SaveLocation(Object, ObjectToSaveTo, "NameOfLocation");
Saves a location for later usage/retrieval. Say, you want a mob to respawn after being killed. When it dies, run a script to find its original location (saved on spawn) and create a new one there, or near it.

9: GetSavedLocation(Object, "NameOfLocation");
This is the get function for SaveLocation. I suppose these two functions could be included in Set/GetVar, but not sure how esenthel handles these.

10: SaveObjectRef(ObjectToReference, ObjectToSaveTo, "NameOfReference");
This would be used to save a shortcut to an object on another object. Say you want to jump to the party leader, when you joined the party this function would have saved the party leader's shortcut to your character, and you could then use setlocation, getlocation, and GetSavedObjectRef to jump there.

11: GetSavedObjectRef(ObjectToGetFrom, "NameOfReference");
Retrieves the shortcut of an object from another object by string name.

12: Random(MinimumInclusiveNumber, MaxiumumInclusiveNumber);
Returns a random number between the minimum and max, including both. Thus, a random of Random(1,10) would return a number between 1 and 10, including 1 and 10 as possible returns.

13: IntToFloat, FloatToInt, StringToInt, StringToFloat, etc
These are probably already there, but just saying.

14: PlaySoundAtLocation("soundfile", Location, Duration, Radius)
Pretty self explanatory. A negative value for duration is looping.

15: AttachSoundToObject("soundfile", Object, Duration, Radius)
Same as above, but the sound follows the object.

16: RemoveEffectFromObject(object, "NameOfEffect"); / RemoveEffectFromLocation(Location, "NameOfEffect", RadiusFromLocation)
Removes an effect from an object/location, finished or not. For example an animation, or a looping sound.

I cant think of any other functions I have used in the last 10 years or so I have been scripting that arent inclusive of the above (off the top of my head) but if I do, I will post back.

If anyone has any requests or suggestions, please post here.
Also, if anyone wants to save Esenthel some work and actually write and include the code for the function or any of the ones I have listed, that is also welcomed.

From what I have read around these forums, this kind of customer support supplied by Esenthel is hilariously good - I am genuinely excited grin




Forgot about GUI manipulation. These are even looser suggestions, but I suppose something along the lines of:


MoveGuiObject("GUIObjectName", XPos, YPos);
Moves the GUI object to the X/Y position.

ToggleGuiObjectVisible("GUIObjectName", BOOLEAN);
Enables/Disables the GUI object.

Changes the texture used for the GUI object.

SetGuiProgressBar("GUIObjectName", Position%);
Set the progress bar position of the GUI object (if they indeed exist).

DisableGuiObject("GUIObjectName", BOOLEAN, Duration);
Sets the GUI object to unclickable/unusable, and if the object has a 'disabled state' texture, apply it.

CooldownGuiObject("GUIObjectName", Duration);
Sets a cooldown animation (brightness scaling up from bottom, or around in a circle?) on the gui object for the duration, also disabling it.

Get the string parsed to the object from the GUI function (below).

Get the GUI object that caused this script to run.

These would be the actions to fire when the gui is interected with.

RunScript(object, "scriptname", "StringToParseToScript");
This is for running a script and sending a var to the script. Object is what the script runs on.

Dont actually particularly need any more, as all the other functions can be run from the RunScript function, inside a script.


GetSubstringLeft("substring", "string");
Return all the characters in a string left of the substring. For example, lets look at the string Esenthelrocks.
If we had GetSubstringLeft("rocks","Esenthelrocks"); it would return "Esenthel".

GetSubstringRight("substring", "string");
Return all the characters in a string right of the substring. For example, lets look at the string Esenthelrocks.
If we had GetSubstringRight("Esenthel","Esenthelrocks"); it would return "rocks".

GetSubstringBetween("substringFirst", "substringLast", "string");
Similar to the above two, but gets the string between substringFirst and substringLast.
If we had GetSubstringBetween("Esen", "rocks", "Esenthelrocks"); it would return "thel".

If we combine the above with IntToString and IntToFloat, then use it with the GUI command RunScript, we can parse quite a lot of GUI information back to the script, allowing complex UI's and complex character leveling/progression systems.

(This post was last modified: 12-10-2010 06:02 AM by Ashtefere.)
12-10-2010 03:07 AM
Find all posts by this user Quote this message in a reply
runewake2 Offline

Post: #4
RE: Visual Scripting
I like the NWN scripting engine.

Esenthel: How are you planning on adding the language? Will it be added to the World Editor/Mesh Editor and you create a script with the object? This seems like the right topic to ask this.

Ashe: Those would be nice. Looked at NWN's scripting again. I really like it though I have not used NWN2's only NWN's still the language is easy and the way the editor is laid out is easy to understand. I was able to create a simple campaign very quickly with the language.
(This post was last modified: 12-10-2010 03:14 AM by runewake2.)
12-10-2010 03:10 AM
Find all posts by this user Quote this message in a reply
Ashtefere Offline

Post: #5
RE: Visual Scripting
Hi Rune.

Yeah, thats what Im getting at. There has never been a scripting system as powerful, easy to use, and fast to work with as nwscript.
But it can be refined. Lots of their functions are for nwn specific things that arent needed. Really, we only need the core, simple functions which we can then build our own more complex game specifric functions with, and share.

Something I neglected to add, was something that nwn/nwn2 does really well is being able to attach a script to potential event via GUI.
For example, fire X script when player dies, fire X script when object is damaged, etc.
[Image: modulescripts.jpg]
This is the MODULE script events, but ideally all objects you make in the GUI would have slots to attach scripts to.
At runtime, when an event such as these occur, the object experiencing the event would fire the attached script.

Makes it noob friendly, though again it would be optional for devs to use.
Same with the script system in general. If a dev with more programming skill than us noobs wants to use the deeper stuff, its there. They dont have to use any of these simplified scripting functions.
(This post was last modified: 12-10-2010 03:39 AM by Ashtefere.)
12-10-2010 03:39 AM
Find all posts by this user Quote this message in a reply
runewake2 Offline

Post: #6
RE: Visual Scripting
Why not have a "Write a Script" feature that allows you to make your own using Esenthel C++ and then tie all those scripts together in a visual scripter? Not sure how that would work beyond concept but that would be nice.
12-10-2010 06:34 PM
Find all posts by this user Quote this message in a reply
Ashtefere Offline

Post: #7
RE: Visual Scripting
Well, adding your own functions through includes is easy enough anyway. It would serve the same purpose.

12-10-2010 11:44 PM
Find all posts by this user Quote this message in a reply
Esenthel Online

Post: #8
RE: Visual Scripting
Thanks very much!

Soon I'll be brainstorming about the scripts.
12-10-2010 11:51 PM
Find all posts by this user Quote this message in a reply
Ashtefere Offline

Post: #9
RE: Visual Scripting
Good to hear! I'll be there to whisper in your ear wink

12-11-2010 03:12 AM
Find all posts by this user Quote this message in a reply
runewake2 Offline

Post: #10
RE: Visual Scripting
I'll be right with Ashe...
12-11-2010 06:00 PM
Find all posts by this user Quote this message in a reply
runewake2 Offline

Post: #11
RE: Visual Scripting
I have been thinking about a good way to do this and the best way I can think is by writing a system of easy to use scripts and triggering events like Ashe suggested.

I would like to build on that a little however:
1. First off you should work in a way to write your own scripts and then create an easy way to exchange these scripts. This would take a lot of the work off of you, Esenthel, and place it on the programmers.
2. Some basic functions such as just adding a Character controller then setting the speeds of movements and controls would be a nice feature.
3. Premade functions to create and show menus for changing game controls and options would be nice. You could check which buttons are used by the other generated code and then create a list from that (not sure about how this would work).
4. I don't think that having EE look at and interpret code would be the best idea. Perhaps you could have the program/tool create a C++ file and leave it in the projects Source folder? Not sure how this would work but it seems like this would be faster and it would have the added benifit of the programmer/script writer being able to go in and look at the script and figure out how it works.
5. Being able to declare custom events/triggers would also be a nice addition by simply allowing the player to write an function that on returning true executed the event/trigger.

Hope this helps.
12-16-2010 06:34 PM
Find all posts by this user Quote this message in a reply
Dwight Offline

Post: #12
RE: Visual Scripting
In Realm Crafter Standard, we did the following (how easy can you get it?!) :
1. You can create a script in the tool : Script Editor
2. While creating your world, when you placed a character, you have a menu which shows all at once (not all included, but only the relevant):
  • Script to run (always)
  • Right click script
  • Death script
  • Numbers to spawn
  • Walking radius (makes a ball as the area where it can walk)
    • Scripting was done in BVM which is ridiculously easy to learn and makes life very easy.
      Some commands:

      Downturn : You could only apply scripts to characters, and not to objects. That would be a huge improvement in EE.

      Perhaps I could help!

SnowCloud Entertainment - We are recruiting!
12-17-2010 10:58 AM
Find all posts by this user Quote this message in a reply
runewake2 Offline

Post: #13
RE: Visual Scripting
With my suggestion of just a code database and attaching scripts once the basic attach a script to a trigger is added then the triggers and scripts could be written by the EE community.
12-17-2010 04:49 PM
Find all posts by this user Quote this message in a reply
Ashtefere Offline

Post: #14
RE: Visual Scripting
Esenthel, please take a look at this:


It presents a pretty unique opportunity in the case of esenthel.

Esenthel does not yet have a simplified visual scripting system. If we were to use a system similar to fluent scripting (which can work along side traditional scripting) it would allow even more users to actively script.

While I myself am a fan of the standard scripting route, something like this would allow total noobs to do the basics without much thought.

01-13-2011 12:33 AM
Find all posts by this user Quote this message in a reply
Chris Offline

Post: #15
RE: Visual Scripting
I think he already understands this quite well smile

01-13-2011 12:48 AM
Find all posts by this user Quote this message in a reply
Post Reply