Graal Forums

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

Velox Cruentus 05-04-2005 07:09 AM

Functions & Parameters
 
Functions should be able to handle extra parameters that are undeclared, much like trigger events:

PHP Code:

// EVENT
  
player.trigger("addWeapons","Message","TempPlayer","Login");
// CLOSE EVENT

public function onaddWeapons()
{
  for (
weapparams)
    
this.addWeapon(weap);


To...

PHP Code:

// EVENT
  
player.addWeapons("Message","TempPlayer","Login");
// CLOSE EVENT

public function addWeapons()
{
  for (
weapparams)
    
this.addWeapon(weap);


While I'm at it -- You may as well add a addWeapons() function O,o; It might serve it's purpose... Or let everyone who wants to do that do like me?

Reenable this.destroy() == Deleting the weapon
(client & serverside) and let protectedweapon prevent it from deleting serverside?

Umm... Removing weapons with GUI Control doesn't delete the GUI Control.

Kaimetsu 05-04-2005 07:35 AM

Quote:

Originally Posted by Velox Cruentus
Functions should be able to handle extra parameters that are undeclared

Since when did we declare parameters for functions?

Velox Cruentus 05-04-2005 08:07 AM

Since GS2?

function addWeapons(parameter,parameter)?

Kaimetsu 05-04-2005 08:11 AM

Quote:

Originally Posted by Velox Cruentus
function addWeapons(parameter,parameter)?

Huh. I don't remember naming the params, but I suppose I haven't used GS2 in over a year now.

Why don't you just accept an array as one of the parameters?

Admins 05-04-2005 05:57 PM

Yes you can pass parameters as array, like myfunction(p1,p2,{p3,p4,p5}), then
function myfunction(p1,p2,openparams) {
echo(p1 @ "," @ p2 @ "," @ openparams[0] @ "," @ openparams[1]); // etc.
}

Velox Cruentus 05-05-2005 03:59 PM

Thanks -- Although, it's a weird way to do such thing.

This should go in Tech:
fuction x(){ return {list};}

sendtonc(x());
== CRASH!

This should go here, however ('creates new thread')
return should be able to return string lists?

This too:

Instead of saving the strings with """Text""" in a string list, you could do:

{"Test","Other"}

Where everything in the " to the last " aren't shown, and the "'s in text can be worked out with the escape character, such as: \"
Thus:
{"John: And then, bobby said \"Maipas!\","Billy: No?! REALLY!?"}
INSTEAD OF:
"John: And then, bobby said ""Maipas!""","Billy: No Really?!"

If would make the strings a lot more readable, especially in multidimensional arrays:
"Ditto,""prop,prop"",Ditto,""prop,prop""","Ditto," "prop,prop"""",prop""""""","Ditto,""prop,"""
Instead of:
{{"Ditto",{"prop","prop"},"Ditto",{"prop","prop"}} ,{"Ditto",{"prop","prop"}}}

The second form is a lot easier to read then the first one, and we can establish a more direct meaning between the tring being a string, string list, or variable.

Admins 05-10-2005 11:58 PM

Quote:

Originally Posted by Velox Cruentus
This should go in Tech:
fuction x(){ return {list};}

sendtonc(x());
== CRASH!

It's crashing the npcserver?

Velox Cruentus 05-11-2005 12:47 AM

... Yea?

Rick 05-11-2005 12:58 AM

Uhhh, you can already use escape sequences for strings.

Velox Cruentus 05-11-2005 01:02 AM

I was referring to the string lists... In /open Velox Cruentus list.... O,o;

Inverness 05-15-2005 12:14 AM

I agree with Velox, having string arrays saved as:
string=1,2,"3,32,33",4
istead of something like:
string={1,2,{3,32,33},4}
is annoying.


All times are GMT +2. The time now is 09:39 PM.

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