AT Scripting Language documentation

Discussions of the development process of the game.
User avatar
Zukero
Lead Developer
Posts: 2028
Joined: Thu Jul 21, 2011 9:56 am
android_version: 8.0
Location: Eclipse

Re: AT Scripting Language documentation

Post by Zukero »

PK17 wrote: Also Zuk, as I was reading through this for the third or fourth time, I notice you said you couldn't think of any reasons to use the map.onENTER trigger for anything besides the map.

I always thought it would be cool if say you entered feygard territory and all (or some) feygard items recieved a boost, same for the blackwater items if you are in/near blackwater, and all (some) other faction related locations. Also, let's say in map 'elytharashrine5' there is a shrine that when upon entering the map it automaticly removes any kazual or shadow items equiped then forbids you from equipping them.
Thanks for being so brave PK17 ! Reading this three or four times, you must be an expert now !

Actually, in your examples, I think it should still be the map that have the map.onEnter script. If it is an effect specific to 'elytharashrine5', it should not be part of the items definition. To be more clear, here's how I would do it (some functions do not exist yet) :
map 'elytharashrine5' has property 'scripts' with value 'remove_kaz_shad_items;prevent_kaz_shad_equip'
then, in a scripts definition file :

Code: Select all

"remove_kaz_shad_items" map.onEnter [
player.unequip("kazaul_item_1");
player.unequip("kazaul_item_2");
player.unequip("shadow_item_1");
player.unequip("shadow_item_2");
][Unequips all items imbued with the spirit of Kazaul or the Shadow]

"prevent_kaz_shad_equip" item.onEquip [
if (item.id == "kazaul_item_1") {
  cancelAction();
} else if (item.id == "kazau_item_2") {
  cancelAction();
}<...>
][Prevents equiping all items imbued with the spirit of Kazaul or the Shadow]
Or, you could make the "remove_kaz_shad_items" script give an actor condition to the player that lasts forever (removed when you exit, with another script), that itself prevents equiping the kaz_shad items (so the player can see what happens).
Or, you could also use a player.statsUpdated script that will nullify the effects of the equiped items.

Many possibilities with slightly different effects, but still no need to attach a map.onEnter script to anything else than a map.

One potential effect of attaching a map.onEnter script to a weapon for example, is that when this weapon is equipped, you gain 1HP each time you enter a new map... doesn't make sense to me, as the only game object who can have a notion of whether the map limits are indeed limits in the game world are the maps themselves ! Then again, it would still work, so if someone, someday, comes up with a good idea using this, it would work !
Lvl: 78, XP: 8622632, Gold: 271542, RoLS: 1, ElyR: -, RoL: -, ChaR: 1, GoLF: 1, ShaF: 1, SRoV: 1, VSH: 1, WMC: 1, GoW: 1
HP: 71, AC: 301%, AD: 38-47, AP: 3, ECC: 50%, CM: 3.75, BC: 101%, DR: 2
Pyrizzle
VIP
Posts: 6435
Joined: Sat Jun 25, 2011 1:00 am
android_version: 6.0 - Marshmallow
Location: Fire Nation HQ

Re: AT Scripting Language documentation

Post by Pyrizzle »

I have a plan in the work for 2 temples to be built.

1) A temple of Light
~Elyr and other "Light" items would receive a boost
~ROLS: Shadow Regeneration will not work while within the temple walls

2) A temple of Shadow
~ROLS and other "Shadow" items would receive a boost
~ELYR: Would loose it's bonus 2 AP effect while within the Temple walls

I have also been working on a few ideas for more "Light" and "Dark" items that would be effected by the temples... I might even work on a quest concept I've had where you can have an item "blessed" by one of the Temples for a non-permanent boost to one of your "Light" or "Dark" items.

So many concepts floating around in this noggin... Time to put some more onto paper and eventually onto the forums for some feedback.
---------------------------------------------------------------------------------------

Player Name:Pyro
Lvl:24XP:244KAP:2/10HP:80AC: 189%AD:13-21CHS:-6CM: 0BC: 20%DR:2
IF:2Reg:2FSDW:1

May Elythara bless you and light your path!

---------------------------------------------------------------------------------------
User avatar
Covenant
Posts: 176
Joined: Wed Oct 09, 2013 11:44 am
android_version: 11 - Android 11
Location: Sydney, Australia

Re: AT Scripting Language documentation

Post by Covenant »

1. Is it possible to put complex expressions directly within the while/if statements condition? Or does the condition need to be pre-calculated in separate code (before the if statement and before/within the while loop) and the result assigned to a local variable? The local variable (only) then being used as the if/while condition. I assume yes, since it's all C syntax style anyway. - never mind, examples have demonstrated this. I assume that basically any valid code syntax from javascript/c style programming here is valid, the limitations being the data types, operators and available objects?

2. Any handling for floating point values? If not storable in local variables, what is your recommendation for handling the results of calculations that are not while numbers? I've assumed that the definition of "numeric" actually means unsigned integer (although that doesn't seem right). - never mind, I kept reading and had it answered.

3. Can we use the short circuit operators || and && in conditions and scripts?objects? - again, I've been typing my questions before finishing reading and have an answer for this already, sorry.

4. I Agree with not having operator precedence. More so because I like the idea of forcing lazy programmers to use parenthesis for precedence - which makes for much easier reading of code anyway.

5. Love your work. Simple, logical, elegant.
User avatar
Zukero
Lead Developer
Posts: 2028
Joined: Thu Jul 21, 2011 9:56 am
android_version: 8.0
Location: Eclipse

Re: AT Scripting Language documentation

Post by Zukero »

@Pyrizzle : I had an idea close to this. In a temple (of shadow ?), a priest allows you to prove your faith, and then be introduced to the local "god" thingy, so you're left alone in a room (actually a "dream"), and a "voice" asks you which path you seek : power, wisdom, or peace. Then, depending on the path, you are faced with a different ordeal. For power, you have to battle fierce monsters, for wisdom, you have to solve a riddle/puzzle/whatever using brains in a limited time (no potions can give you HP, and life is drained by an actor condition), and for peace, you have to survive a battle where your AC & AD are set to zero (opponent has an actor condition draining life from it). If you win, you receive a reward depending on the path chosen, if not (death), you are simply awaken from your dream, not loosing anything. --But that's more suited for another topic.

@Covenant : thanks for #5. Hope it'll end up having a quality as high as my hopes on it :D
Covenant wrote:I assume that basically any valid code syntax from javascript/c style programming here is valid, the limitations being the data types, operators and available objects?
Yeah, we could more or less say that. The key word being "expression", whatever evaluates to a boolean can be used in a if or while condition. However, there is no static type checking, so if you try to do while (9+5) {...} , the compiler won't complain but the script will crash when run, potentially crashing the game itself (depending on the thread calling the engine for this script instance).
Lvl: 78, XP: 8622632, Gold: 271542, RoLS: 1, ElyR: -, RoL: -, ChaR: 1, GoLF: 1, ShaF: 1, SRoV: 1, VSH: 1, WMC: 1, GoW: 1
HP: 71, AC: 301%, AD: 38-47, AP: 3, ECC: 50%, CM: 3.75, BC: 101%, DR: 2
User avatar
Covenant
Posts: 176
Joined: Wed Oct 09, 2013 11:44 am
android_version: 11 - Android 11
Location: Sydney, Australia

Re: AT Scripting Language documentation

Post by Covenant »

Zukero wrote:However, there is no static type checking, so if you try to do while (9+5) {...} , the compiler won't complain but the script will crash when run, potentially crashing the game itself (depending on the thread calling the engine for this script instance).
So to achieve the same effect as a high level language, I'd have to represent the expression more explicitly with a logical or comparison operator such as the below?

Code: Select all


if ( (9+5) > 0 ) {
    //do some script stuff here
}
else if ( (9+5) == 14 ) {
    //do some script stuff here
}

(note I'm using parenthesis appropriately) :D
User avatar
Zukero
Lead Developer
Posts: 2028
Joined: Thu Jul 21, 2011 9:56 am
android_version: 8.0
Location: Eclipse

Re: AT Scripting Language documentation

Post by Zukero »

Exactly !
(note that I'm using the exclamation mark appropriately too :lol:)
Lvl: 78, XP: 8622632, Gold: 271542, RoLS: 1, ElyR: -, RoL: -, ChaR: 1, GoLF: 1, ShaF: 1, SRoV: 1, VSH: 1, WMC: 1, GoW: 1
HP: 71, AC: 301%, AD: 38-47, AP: 3, ECC: 50%, CM: 3.75, BC: 101%, DR: 2
User avatar
cccd3cpt
Posts: 114
Joined: Wed Nov 14, 2012 5:30 am
android_version: 4.2

Re: AT Scripting Language documentation

Post by cccd3cpt »

Love how this is growing so quickly, Zukero!

It'll make programming the game very simple. It's kinda like a library, yes? For robotics in C, libraries make everything 1000% easier and faster to do.

Lol, it makes life easy for everyone except the one actually writing the script; amazing work as always!
Maybe you could move the documentation to github as a wiki page?
User avatar
Zukero
Lead Developer
Posts: 2028
Joined: Thu Jul 21, 2011 9:56 am
android_version: 8.0
Location: Eclipse

Re: AT Scripting Language documentation

Post by Zukero »

New updates with many new features : new triggers item.onEquip & item.onUnequip. Many new fields accessible on actor & player.

@cccd3cpt : it's not really like a library. A library is written in the same language as the project, and is meant to be used by the same language, simply providing higher-level, reusable functions. This is called a DSL : Domain Specific Language. A custom language made to express in the most simple & direct way ideas specific to a topic, in this case, andor's trail game engine.

Moving this documentation to a wiki page is on the plan, but only after this is merged in the main game code, and there are at least two features that I want to implement before :
- attack related triggers (attack.onTry, attack.onHit, attack.onMiss, actor.onKilled, actor.onHitReceived)
- all skills feature (reimplment the whole skill system using scripts)
Lvl: 78, XP: 8622632, Gold: 271542, RoLS: 1, ElyR: -, RoL: -, ChaR: 1, GoLF: 1, ShaF: 1, SRoV: 1, VSH: 1, WMC: 1, GoW: 1
HP: 71, AC: 301%, AD: 38-47, AP: 3, ECC: 50%, CM: 3.75, BC: 101%, DR: 2
User avatar
cccd3cpt
Posts: 114
Joined: Wed Nov 14, 2012 5:30 am
android_version: 4.2

Re: AT Scripting Language documentation

Post by cccd3cpt »

Ummm. Thanks for clearing it up :)

Look forward to seeing the wiki when the merge comes along then :D
Sarumar
VIP
Posts: 3275
Joined: Sat May 07, 2011 4:36 pm
android_version: 4.1 - Jellybean
Location: www.hel.fi

Re: AT Scripting Language documentation

Post by Sarumar »

Pyrizzle wrote:I have a plan in the work for 2 temples to be built.

1) A temple of Light
~Elyr and other "Light" items would receive a boost
~ROLS: Shadow Regeneration will not work while within the temple walls

2) A temple of Shadow
~ROLS and other "Shadow" items would receive a boost
~ELYR: Would loose it's bonus 2 AP effect while within the Temple walls

I have also been working on a few ideas for more "Light" and "Dark" items that would be effected by the temples... I might even work on a quest concept I've had where you can have an item "blessed" by one of the Temples for a non-permanent boost to one of your "Light" or "Dark" items.

So many concepts floating around in this noggin... Time to put some more onto paper and eventually onto the forums for some feedback.
+1 Nice ideas Pyro!
Sarumar
..dansing left foot polka with Hirathil

Lvl 313|XP 559721474|Gold 7965188|AP 3/12|AC 516|AD 161-175|ECC 48|CM 6|BC 311|HP 591|DR 2|RoLS 3|RoL 2|ElyR 2|ChaR 45|GoLF 3|ShaF 9|SRoV 28|VSH 13|GoW 1|WMC 1
Post Reply