Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Announcements (https://forums.graalonline.com/forums/forumdisplay.php?f=240)
-   -   NPCServer updates (6) (https://forums.graalonline.com/forums/showthread.php?t=60137)

Admins 07-24-2005 07:32 AM

NPCServer updates (6)
 
There are new versions of gserver and npcserver, they are uploaded to all machines, but might need to be restarted manually. There are a few updates for the new scripting engine:

- Fixed Switch-in-switch commands, before the switch command was eating the case label that was in front of it
- new onInitialized() event for database npcs when the server has been restarted
- You can create scriptable objects now (besides players and npcs):
this.item1 = new TStaticVar();
this.item1.join("itemfunctions");
...
this.item1.destroy();
Differences to normal objects:
- they are never copied, they are only linked - same behaviour like with GUI objects and players or npcs, if you do pl = player then pl will not recreate the player, if you access pl.account then it will actually access player.account
- they are scriptable, which means they can join classes and run scripts (think of living inventory objects)
- they are destroyed once no variable is linking to it anymore (e.g. if you do this.item1 = NULL; this is using a garbage collector system like in Java), or if you call destroy() for the object
- they can have a name, you can do this.item1 = new TStaticVar("MyFirstItem") and then also access it directly by name, e.g. MyFirstItem.subvar = 123

Rick 07-25-2005 04:08 AM

Wahoo! Stefan added my suggestions!

This makes me very happy. :)

Malinko 07-25-2005 03:55 PM

Quote:

Originally Posted by Stefan
this.item1.join("itemfunctions");
...
this.item1.destroy();

Thanks.

Quote:

Originally Posted by Rick
Wahoo! Stefan added my suggestions!

This makes me very happy. :)

Now you can own all playerworlds with Era.

MAYBE. ;)

Inverness 07-27-2005 04:20 AM

Would it be possible to do:

new TStaticVar("Test123") {
h = 3;
}
and then use Test123.h to get 3?
I'm basing this off of the Gui Controls...

napo_p2p 07-28-2005 04:02 AM

It seems that Aeon didn't go up after the update ...

ChibiChibiLuc 07-28-2005 05:21 AM

I really can't see any use for this.. Can someone give me an example?

Why not just use something like whatever.huh = 3?
Unless I'm mislead on how it functions..

Admins 07-28-2005 02:24 PM

You would need to do this.h = 3
Like I said, it can join classes, then you can define public functions in the class and then you can do stuff like object.functionname(). Also it can use timeouts and such. I guess it's good for inventory systems, and for complex data.

ChibiChibiLuc 07-28-2005 03:37 PM

Oh, sorry, I was being an idiot.

For some reason, I thought it could only hold variables.. And then I read it again and I'm like.. Wow..

Inverness 07-29-2005 03:41 AM

This works fine, thanks for help.

Having its own timeout is very nice.

It would be useful if it was possible to call public functions without an object like you do with normal functions.

Admins 07-29-2005 11:44 PM

What doesn't work with those functions ?

Inverness 07-30-2005 02:31 AM

When you do call a public function you have to put the weapon name before it, i'd like to be able to call it without using the weapon object:
addItem()
instead of:
weaponname.addItem()

I'd also like to be able to call functions clientside<->serverside. It would help greatly in my inventory system.

Rick 07-30-2005 02:42 AM

Quote:

Originally Posted by Inverness
When you do call a public function you have to put the weapon name before it, i'd like to be able to call it without using the weapon object:
addItem()
instead of:
weaponname.addItem()

Why? This obfuscates your code.

Quote:

Originally Posted by Inverness
I'd also like to be able to call functions clientside<->serverside. It would help greatly in my inventory system.

While I agree, I find that using triggers is more logical. Your scripts should be designed to do as little as possible between server and client to keep network usage down.

napo_p2p 08-02-2005 05:02 AM

Quote:

Originally Posted by Stefan
- new onInitialized() event for database npcs when the server has been restarted

Is that when the whole server restarts, or also when the NPC server is restarted?

I have in a database NPC:
NPC Code:
function onInitialized() {
echo("Test");
}




But when I restart the NPC server, it doesn't work.


All times are GMT +2. The time now is 07:29 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.