Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   New Functions? (https://forums.graalonline.com/forums/showthread.php?t=58394)

Rick 04-07-2005 12:57 AM

Quote:

Originally Posted by jake13jake
Wow, return actually returns now? Sweet Deal!
Wnyway, what I am now wondering: What did scripters who used return before it actually returned a value use it for?

NPC Code:
function stupidgs1function() {
thing = retvalue;
}


-Ramirez- 04-07-2005 02:20 AM

Quote:

Originally Posted by jake13jake
Wnyway, what I am now wondering: What did scripters who used return before it actually returned a value use it for?

NPC Code:

function test() {
if (a == 1) return;
say2 Hey, I get to execute#bif a isn't 1!;
}


Velox Cruentus 04-07-2005 02:54 AM

Quote:

Originally Posted by jake13jake
What did scripters who used return before it actually returned a value use it for?

It completely stops the function:

PHP Code:

if (playerchats)
{
  
money int(strtofloat(#c));
  
drop();
}

function 
drop()
{
  if (
money =< 0) return;
  
//DROP HERE



jake13jake 04-07-2005 03:27 AM

hmmm... so I take it that break only works in loopdy loops?

Velox Cruentus 04-07-2005 05:42 AM

So long for my little private scratch book of notes. :(

Yea, I suppose so. (as well as while loops... And do-while loops? As well as switch statements)

Dach 04-07-2005 05:51 AM

Quote:

Originally Posted by Velox Cruentus
[...] As well as switch statements)

to clarify
In a different manner than with that of the loops.

Rick 04-07-2005 10:42 AM

Break halts execution of any loop.

Admins 04-07-2005 11:02 AM

Quote:

Originally Posted by Velox Cruentus
onplayerlogout for NPC-Control.

You mean for scripts on serverside?

Quote:

Originally Posted by Velox Cruentus
triggeraction to all players clientside (insecure, but none-the-less, useful. Such as Chat Messages instead of using the server's CPU for that.)

Since you are not doing that too often it shouldn't be a problem, scripts are not really that slow

Quote:

Originally Posted by Velox Cruentus
public variables accessible by other characters:
VChp := findplayer("Velox Cruentus").clientr.hp;

Whats the problem with that? You mean you want to access other peoples clientr variables on clientside?

Quote:

Originally Posted by Velox Cruentus
OTHER:
Stop the crashing when going between servers (with GUI).

Need to debug that more

Quote:

Originally Posted by Velox Cruentus
Hrm...
makevar("Items." @ number) works when the Items database NPC was created after the last server reset. If I reset the server, the strings are inaccessible by the top example untill I reset the NPC itself.

makevar(Items.(@ number))
It can only resolve the variable name if the dot is not in a string

Velox Cruentus 04-07-2005 07:11 PM

Quote:

Originally Posted by Stefan
You mean for scripts on serverside?

Yes. On Control-NPC, I have this party system that I wish to remove the person from the party when they leave the server. I resolved that by doing a timeout loop. I do not believe that timeout loops are the best technique, provided that I can do it with a onplayerlogout.


Quote:

Originally Posted by Stefan
Since you are not doing that too often it shouldn't be a problem, scripts are not really that slow

It has actually caused quite considerible lag in the past, I do believe (when players use it as a chat room, and there are 30 players actively talking?)

Quote:

Originally Posted by Stefan
Whats the problem with that? You mean you want to access other peoples clientr variables on clientside?

Yea. It would be a lot neater... Such as -- I'd be able to access the other player's health stats, and perhaps make a heat-sensor a lot dimmer when they have low health, or perhaps other stimuli for it.

Quote:

Originally Posted by Stefan
makevar(Items.(@ number))
It can only resolve the variable name if the dot is not in a string

Okay -- That should do... Although, it does work after the Database NPC was updated.

Admins 04-08-2005 01:43 PM

Quote:

Originally Posted by Velox Cruentus
Yes. On Control-NPC, I have this party system that I wish to remove the person from the party when they leave the server. I resolved that by doing a timeout loop. I do not believe that timeout loops are the best technique, provided that I can do it with a onplayerlogout.

Right now onplayerlogout is only working on clientside. On serverside the problem is that the player object needs to be removed physically because the gserver is saving the player object and updates couldn't be sent to the gserver anymore after player logout, also if the player is logging in again there could be problems if the old player object is still existing. So it could be possible to make a onplayerlogout event but just with the account name as parameter, without being able to access the player object directly.

Quote:

Originally Posted by Velox Cruentus
It has actually caused quite considerible lag in the past, I do believe (when players use it as a chat room, and there are 30 players actively talking?)

Shouldn't be a problem, all messages on Graal Kingdoms are sent by script and there are a lot of them. The same on Zone.

Quote:

Originally Posted by Velox Cruentus
Yea. It would be a lot neater... Such as -- I'd be able to access the other player's health stats, and perhaps make a heat-sensor a lot dimmer when they have low health, or perhaps other stimuli for it.

There are a lot of variables for the players, sharing those would mean a lot of traffic. It is better to use a #P(1..30) parameter, in new scripting player.attr[1..30] because those are visible for all clients. On clientside use #P(1..30,playerindex) for accessing them.

Velox Cruentus 04-08-2005 09:59 PM

Quote:

Originally Posted by Stefan
Right now onplayerlogout is only working on clientside. On serverside the problem is that the player object needs to be removed physically because the gserver is saving the player object and updates couldn't be sent to the gserver anymore after player logout, also if the player is logging in again there could be problems if the old player object is still existing. So it could be possible to make a onplayerlogout event but just with the account name as parameter, without being able to access the player object directly.

That would suffice.

As for the attr's, that too would work quite well!

Thanks.

Velox Cruentus 04-10-2005 08:50 AM

G3:
PMs with only a smilee don't show up at all.
When answering PMs, the client will suddenly crash.


All times are GMT +2. The time now is 04:31 AM.

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