Mythruna

Modder's Workbench => Scripting => Topic started by: pspeed on January 03, 2012, 10:52:43 AM



Title: Scripting API Wish List
Post by: pspeed on January 03, 2012, 10:52:43 AM
Just trying to catch some things as we find them together and make sure they don't get lost.

Also, this is a good place to collect work-arounds until new features are implemented that make them irrelevant. :)


Title: Re: Scripting API Wish List
Post by: pspeed on January 03, 2012, 10:54:16 AM
And I will start if off with this one:

-unified per-player script variables that work in all of the various scripts: action, shell commands, dialogs, etc.

Work-around:
-in shell commands you can access the shell environment directly (90% sure).  ie: foo = "Hello, World"
-in other scripts you should be able to access those with shell.shellEnvironment.variables.foo = "Hello, World"


Title: Re: Scripting API Wish List
Post by: Toboi on January 03, 2012, 02:50:08 PM
I don't know if there's already a feature like this, but I would like it if it was possible to get a list with all players near to some point. I thought about scripting a "real-world" chat-script, which would make conversation somewhat more realistic, and, if many people are on the server, also more useful probably. The change would be that you could only read what was "said" near to you. And probably there are many other uses of such a function.

Beside this:
Probably it would help everyone if you could document the existing API, paul ;)


Title: Re: Scripting API Wish List
Post by: pspeed on January 03, 2012, 03:27:07 PM
Finding nearby players is not hard... though it's not a built in.  The manual effort is not difficult.

Today it goes something like:
Code:
def nearby = []
def myLocation = getLocation(connection)
server.connections.each{
    def loc = getLocation(it)
    if( loc.distance(myLocation) < 32 ) {
        nearby += it
    }
}

Or something like that.  This will be more straight forward when players are treated like every other object (later in physics integration).

Also, localized chats are something I intend to implement and I will keep in mind the desire to hook that into scripting and also the need for scripts to grab entities in a certain area.  Would be good for lots of things.


And the problem with documenting the API is that it's still a moving target and once I document it then I have to support it. :)

When I add things that I feel like are finalized then I will write something.  Maybe start some section of the wiki.


Bottom line: wish list item noted! :)


Title: Re: Scripting API Wish List
Post by: ayoriceball on January 03, 2012, 03:29:55 PM
Also, localized chats are something I intend to implement and I will keep in mind the desire to hook that into scripting and also the need for scripts to grab entities in a certain area.  Would be good for lots of things.

And the problem with documenting the API is that it's still a moving target and once I document it then I have to support it. :)

Could this even be used for npcs?


Title: Re: Scripting API Wish List
Post by: pspeed on January 03, 2012, 03:42:09 PM
Also, localized chats are something I intend to implement and I will keep in mind the desire to hook that into scripting and also the need for scripts to grab entities in a certain area.  Would be good for lots of things.

And the problem with documenting the API is that it's still a moving target and once I document it then I have to support it. :)

Could this even be used for npcs?

What do you mean?  Like could a script grab all of the NPCs within a certain distance?  Or like the chats from an NPC would only be heard nearby.  Yes, to both if that's what you meant.


Title: Re: Scripting API Wish List
Post by: ayoriceball on January 03, 2012, 03:54:34 PM
Also, localized chats are something I intend to implement and I will keep in mind the desire to hook that into scripting and also the need for scripts to grab entities in a certain area.  Would be good for lots of things.

And the problem with documenting the API is that it's still a moving target and once I document it then I have to support it. :)

Could this even be used for npcs?

What do you mean?  Like could a script grab all of the NPCs within a certain distance?  Or like the chats from an NPC would only be heard nearby.  Yes, to both if that's what you meant.

Hurray. That just makes things easier for me in the long run >:)


Title: Re: Scripting API Wish List
Post by: pspeed on January 03, 2012, 04:17:56 PM
Also, localized chats are something I intend to implement and I will keep in mind the desire to hook that into scripting and also the need for scripts to grab entities in a certain area.  Would be good for lots of things.

And the problem with documenting the API is that it's still a moving target and once I document it then I have to support it. :)

Could this even be used for npcs?

What do you mean?  Like could a script grab all of the NPCs within a certain distance?  Or like the chats from an NPC would only be heard nearby.  Yes, to both if that's what you meant.

Hurray. That just makes things easier for me in the long run >:)

I'll go over more details on the crazy flexibility of Mythruna's "entity system" sometime.  And I really just wanted to nest the quotes one more time. :)


Title: Re: Scripting API Wish List
Post by: ayoriceball on January 04, 2012, 09:53:28 PM
Also, localized chats are something I intend to implement and I will keep in mind the desire to hook that into scripting and also the need for scripts to grab entities in a certain area.  Would be good for lots of things.

And the problem with documenting the API is that it's still a moving target and once I document it then I have to support it. :)

Could this even be used for npcs?

What do you mean?  Like could a script grab all of the NPCs within a certain distance?  Or like the chats from an NPC would only be heard nearby.  Yes, to both if that's what you meant.

Hurray. That just makes things easier for me in the long run >:)

I'll go over more details on the crazy flexibility of Mythruna's "entity system" sometime soon. Or eventually. Or when I feel like it. Or perhaps as a birthday present! Hurray! And I really just wanted to nest the quotes one more time. :)

 :-*