![]() |
Client <-> Serverside Function Caller
This is a set of functions I made after waitfor() was implemented.
The notification functions, which I made for my information system so the gui would open after the information was gotten and not before. Its used for the client and server function triggers to make the script wait until you've got the return of the function. PHP Code:
And here is the script I used to test it: PHP Code:
I don't know how this would affect script performance or anything, I just did it because using triggerServer() and triggerClient() and previously triggerAction() has always irritated me. |
Oooh, really nice Inver. Tho I doubt I may use these they seem to be really useful!
Rep++ 4 u! |
Well just think, if you have this around you don't need to use triggerServer() or triggerClient() anymore unless its some special case or so. And it would work for anything that has an identifier.
Hmm I just realized that since I'm using makevar() for triggering the function that I could probably just include the object identifier as part of the function name rather than separate :D Edit: Its not working for some reason :cry: *sulk* |
Here are some changes I did shortly afterwards.
Changes: Added serverFunction2() and clientFunction2() these functions continue the script rather than waiting that 0.05 second for a returned variable from the distant function. Also made it so if you leave the object null it will call the function realative to the system, meaning it can call globals. So on clientside you could do: System.serverFunction(null, "addweapon", "WeaponName"); PHP Code:
|
Trimmed the extra things. Also made it so the parameters weren't in array.
PHP Code:
|
Having temp. makes variable lookup faster.
PHP Code:
|
I'm using 20 different params and it doesn't work :S what now? [/lol]
|
Couldn't you just put the parameters in an array? =o
|
Hmmm Can't you just use params[] ? When you call a function of another object then the parameters are put in params[] (params[] always contains the parameters of the first function called).
|
Quote:
Well, some examples would be nice Invern :p Btw, here are some: PHP Code:
--------------- PHP Code:
--------------- PHP Code:
--------------- PHP Code:
PS: Might be some spelling mistakes, if there are, my excuse is: I'm Norwegian ^^ If anything is wrong, let me now =o |
Quote:
I had assumed params[] only worked with events because I couldn't get it to work with two functions in same object, never tried two functions in different objects. Edit: Chompy, first parameter needs to be a string or null, not an object. |
Quote:
|
Quote:
I think Stefan should make Graal's scripting language Stackless Python :D. |
Quote:
|
Quote:
|
Function calls take quite a lot of CPU time, thats why params[] is limited and not provided for each function. Also changing the behaviour now would break some stuff. There are e.g. scripts on Kingdoms that read #p() in sub-classes.
|
| All times are GMT +2. The time now is 11:25 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.