Scripting System Update!

The development of the game itself or new resources for it. Any new stuff you're working on would go here, as well as the discussion of in-development stuff.

Moderator: Developers

User avatar
Zefz
Squirrel Knight (Administrator)
Squirrel Knight (Administrator)
Posts: 3820
Joined: Wed Jul 23, 2008 1:27 am
Location: Norway
Contact:

Scripting System Update!

Post by Zefz »

Now I just made life easier for EgoScripters. I basically removed the need for a message.txt file since you can now specify actual strings in tmpargument! Just begin and end a string with a " symbol and you are good to go!

Example:

Code: Select all

IfSpawned
  tmpargument = "THIS ACTUALLY WORKS!"
  SendMessage
Example 2:

Code: Select all

IfBumped
  SetTargetToWhoeverBumped
  tmpargument = "Why hello there %t! My name is %n."
  SendMessage

The old message system also still works.
User avatar
woodmouse
Monolich (Senior Member)
Monolich (Senior Member)
Posts: 4586
Joined: Wed Jul 23, 2008 3:53 pm
Location: Finland
Contact:

Post by woodmouse »

:shock:

Yay, this is great! But is there a limit of how much text there can be? I mean like, can there be things like...

Code: Select all

  tmpargument = "sgpoäawipohtpäpsaifdäyiooäsäfjptjworyabnsdjfoywkppye
  snpoiyipäsjapyfdyäiwotpjäsfpokymdspknfyäpiwjayjoprdätkmsfdpmarkyäyy
  ynwpaijäyotpfjyopanwpotäospjropynpwnywopjepypowoeyjpweyåwyeåjy..."
  SendMessage
...or will it only work in a single line?
Once upon a time, when unicorns roamed the earth...
User avatar
Zefz
Squirrel Knight (Administrator)
Squirrel Knight (Administrator)
Posts: 3820
Joined: Wed Jul 23, 2008 1:27 am
Location: Norway
Contact:

Post by Zefz »

Only single line. Currently it uses max 80 characters (same limit as in message.txt)

Note that you don't need to use underscore (_) for spaces :P
User avatar
woodmouse
Monolich (Senior Member)
Monolich (Senior Member)
Posts: 4586
Joined: Wed Jul 23, 2008 3:53 pm
Location: Finland
Contact:

Post by woodmouse »

Zefz wrote:Only single line. Currently it uses max 80 characters (same limit as in message.txt)
Oh. :(

Well, anyway this is really cool. 8)
Once upon a time, when unicorns roamed the earth...
User avatar
octagon
Darkshine Knight (Extremist fanatic)
Darkshine Knight (Extremist fanatic)
Posts: 2589
Joined: Sat Feb 20, 2010 1:07 pm

Post by octagon »

Strings in script? Awesome. Is escaping with a backslash possible? (As in "\"Quoted and followed by itself is a quine\" quoted and followed by itself is a quine")
User avatar
Zefz
Squirrel Knight (Administrator)
Squirrel Knight (Administrator)
Posts: 3820
Joined: Wed Jul 23, 2008 1:27 am
Location: Norway
Contact:

Post by Zefz »

I have not implemented that. As far as I know there isn't any messages with double apostrophe ( " ) in egoboo. Instead we use the apostrophe ( ' ).
User avatar
woodmouse
Monolich (Senior Member)
Monolich (Senior Member)
Posts: 4586
Joined: Wed Jul 23, 2008 3:53 pm
Location: Finland
Contact:

Post by woodmouse »

Zefz wrote:I have not implemented that. As far as I know there isn't any messages with double apostrophe ( " ) in egoboo. Instead we use the apostrophe ( ' ).
*gasp*

I use tose for a lot of things, like "%n_reads_the_sign:_"BLAH_BLAH."." :oops:

Although it doesn't really matter since stuff (other than skins) I make won't be included in Egoboo, at least anytime soon, right...? :lol:
Once upon a time, when unicorns roamed the earth...
User avatar
woodmouse
Monolich (Senior Member)
Monolich (Senior Member)
Posts: 4586
Joined: Wed Jul 23, 2008 3:53 pm
Location: Finland
Contact:

Post by woodmouse »

Zefz wrote:Only single line. Currently it uses max 80 characters (same limit as in message.txt)
I know I shouldn't complain, but I hope the limit will be removed or something... I mean, it's... umm... kind of hard to have npcs that talk a lot of stuff because of that limit, without making it multiple messages. But yeah, it doesn't bother THAT much, but lol, you know. :P


EDIT: ugahhh double post... sorry.
Once upon a time, when unicorns roamed the earth...
User avatar
Zefz
Squirrel Knight (Administrator)
Squirrel Knight (Administrator)
Posts: 3820
Joined: Wed Jul 23, 2008 1:27 am
Location: Norway
Contact:

Post by Zefz »

Every message in the game has the 80 character limit. A message longer than that won't fit in the width of the screen!

If your NPC's have a lot to say, simply have them say it in more than one line. There is no limit on how many different lines you can have :)

Just to clarify: There is a limit of 80 letters per message, there is no limit on the number of messages per object.
User avatar
woodmouse
Monolich (Senior Member)
Monolich (Senior Member)
Posts: 4586
Joined: Wed Jul 23, 2008 3:53 pm
Location: Finland
Contact:

Post by woodmouse »

Zefz wrote:Every message in the game has the 80 character limit. A message longer than that won't fit in the width of the screen!
Ohhhh. I thought it'd continue under it, lol. Then I understand the limit. :P
Zefz wrote:If your NPC's have a lot to say, simply have them say it in more than one line. There is no limit on how many different lines you can have :)

Just to clarify: There is a limit of 80 letters per message, there is no limit on the number of messages per object.
I thought there was. Good thing there isn't! :o
Once upon a time, when unicorns roamed the earth...
User avatar
Zefz
Squirrel Knight (Administrator)
Squirrel Knight (Administrator)
Posts: 3820
Joined: Wed Jul 23, 2008 1:27 am
Location: Norway
Contact:

Re: Scripting System Update!

Post by Zefz »

New update! This one is pretty awesome: You can now spawn any object from any script file through a string. Egoboo will automatically load the object at game startup into a free slot number if it is needed.

Example:

Code: Select all

tmparugment = "#sword.obj"
tmpx = selfx
tmpy = selfy
tmpdistance = selfz
SpawnExactCharacterXYZ
The code above will spawn a sword.obj, it will scan both the local object folder and the global object repository for the folder you specified. If it is already loaded, it will simply spawn the object with the correct slot number. Magic!

I had to use the # symbol so that EgoScript knows the difference between a message string and a object reference. I havent implemented yet so that you can spawn from the random treasure tables. This now means that exported objects (such as spells) can now spawn any other object in the game (so scrolls that spawn monsters are now possible for example)
User avatar
woodmouse
Monolich (Senior Member)
Monolich (Senior Member)
Posts: 4586
Joined: Wed Jul 23, 2008 3:53 pm
Location: Finland
Contact:

Re: Scripting System Update!

Post by woodmouse »

:shock:

Zefz, you need some partying for how awesome you are: :cheers: :woo: .
Once upon a time, when unicorns roamed the earth...
User avatar
octagon
Darkshine Knight (Extremist fanatic)
Darkshine Knight (Extremist fanatic)
Posts: 2589
Joined: Sat Feb 20, 2010 1:07 pm

Re: Scripting System Update!

Post by octagon »

:woo:
That's awesome. Once I am finished with school, prepare for some contributions from me.
User avatar
Zefz
Squirrel Knight (Administrator)
Squirrel Knight (Administrator)
Posts: 3820
Joined: Wed Jul 23, 2008 1:27 am
Location: Norway
Contact:

Re: Scripting System Update!

Post by Zefz »

I've added a new SetTargetToNearbyWeapons function. This severely simplified and optimized many AI scripts that searched for nearby weapons to grab.

Basically the function searches the nearby vicinity if there is a weapon lying on the ground that the character can use. The search automatically skips weapons that cannot be used (lack of skill, class, etc.)
Spoiler: Old vs New comparison
OLD SCRIPT
[code]
IfUnarmed
tmpx = 0
tmpargument = [SWOR]
tmpdistance = BLAHITEMS
SetTargetToWideBlahID
tmpx = 1
Else
tmpargument = [CLAW]
tmpdistance = BLAHITEMS
SetTargetToWideBlahID
tmpx = 1
Else
tmpargument = [MACE]
tmpdistance = BLAHITEMS
SetTargetToWideBlahID
tmpx = 1
Else
tmpargument = [SPEA]
tmpdistance = BLAHITEMS
SetTargetToWideBlahID
tmpx = 1
//and so on and so on for every weapon type

tmpy = 1 //if tmpx == 1 then we found a weapon
IfXIsEqualToY
tmpx = targetx
tmpy = targety
ClearWaypoints
AddWaypoint
Else
//no weapon found! what to do?
[/code]

NEW SCRIPT
[code]
IfUnarmed
SetTargetToNearbyMeleeWeapon
tmpx = targetx
tmpy = targety
FindPath //Move toward the weapon
Else
//No weapon found! what to do?
[/code]
bgbirdsey
{]-[0{0|307 (Developer)
{]-[0{0|307 (Developer)
Posts: 1864
Joined: Wed Jul 23, 2008 4:22 am
Location: Minnesota, USA

Re: Scripting System Update!

Post by bgbirdsey »

Looking at your example script above, it seems like the script parser is looking for "#blah.obj" to see what the dependencies are, for the spawning from a string?

My original idea was to have an OnLoad OnLoad keyword/section that could have a DeclareDependency keyword. For instance,

Code: Select all

OnLoad
  tmparugment = "sword.obj"
  DeclareDependency

IfSpawn
  ...

If...

End
Then you would just run the OnLoad section of the script when the script is loaded into memory.
Post Reply