![]() |
People hate reading GS1 xD
|
Quote:
|
Quote:
|
Quote:
Do classes operate like global functions? Like, if I put all my functions into classes, I can call them up in any scripts on the server? |
Quote:
Lets say this is a class called fibonacci: PHP Code:
To use that function, I would have to do: PHP Code:
|
Quote:
|
one thing i always wondered when it comes to join(),
should i join it on serverside or clientside? or even both? |
Quote:
|
Quote:
sometimes clientside or serverside. |
Quote:
|
I've noticed on the clientside if you join a class clientside you can't use the functions from the class right away.
ex: PHP Code:
PHP Code:
|
Quote:
PHP Code:
|
It might take a minute to join, I've had trouble with that before as well.
|
Quote:
My above script didn't work with the trigger, however this worked fine and isn't noticable. PHP Code:
PHP Code:
|
You know, now that I think of it, it's requesting the script from the server when you call join(), which results in a small delay.
So, yea. It's easiest just to do all joins serverside. |
Jerret, you're actually missing something.
It's not being updated on clientside when you join it clientsided, true. But it's also not updated clientsided if you join it serversided. Note that sometimes both works, sometimes they don't - and when it doesn't work, it's updated if you reconnect with your client. This is why I never "release" an updated clientsided class before manually reconnecting all current clients to ensure that they all got the update. |
Ok, maybe I should ask this differently.. I wrote these scripts in GS1, but now I want to put them on my server, so can they be converted to GS2 easier with syntax changes? Or do I have to re-write them entirely?
|
Quote:
You can mostly go line-by-line and make a direct change from GS1->GS2. If you haven't checked it out already: http://wiki.graal.net/index.php/Creation/Dev/GS1_To_GS2 That article gives a pretty good overview of the types of changes you need to make. |
Quote:
PHP Code:
This script is something another scripter made/posted on my RC and I'm trying to learn off it and/or convert it to match what I have done in GS1, since it seems nearly identical but with strange syntax differences. This really confuses me as to why everyone says "GS2 is easier to understand" or "GS2 makes more sense" because GS1 makes sense to me, but looking at this stuff, I am like.. what?! |
Quote:
PHP Code:
|
Quote:
|
Quote:
"temp.i" is a variable, which is pointing to the image object. When you use 'showtext' or 'showimg', it returns the actual image created (can also be obtained through findImg(index)). Which means you could even do like (though it's not a good idea) PHP Code:
PHP Code:
PHP Code:
Quote:
Quote:
echo(message) simply outputs the message to NC (or RC if you have the server option enabled), and since he's echoing a function, it will echo whatever that function returns. And yes, you can take all the functions you want to be in a shared class from the individual scripts and put them in a class, then join that class. Edit (in response to designating clientside/serverside): PHP Code:
PHP Code:
|
Ok, so I put the functions in classes, and uploaded the rest of the main script as a weapon, and this is the errors I got:
Quote:
|
Quote:
What join() do, is that it takes the content of the class (all the functions and such) and applies it to the script/object that is joining the class. |
Quote:
PHP Code:
PHP Code:
PHP Code:
http://img404.imageshack.us/img404/2161/picture8h.png |
Quote:
The callstack overrun happens when your script is executing too many functions too quickly. It'll probably go away if you switch the script over to clientside. (I bet you have a 0.05 timeout, which is too much for the server to handle). |
Quote:
And yeah, I didn't think about the fact that //#CLIENTSIDE isn't required in the level editor for clientside scripts. Good catch. |
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
Quote:
|
Quote:
|
Ok, so I have inserted my baddy script into a class, if I wanted to place baddies on the map with the baddie class as their script, would I be able to do something like a weapon with a trigger and some sort of putnpc script referencing back to the class? How would I do that serverside? I want the baddie to be seen the same by all players... would putnpc work with a class?
|
These wiki pages should help you a bit with your understanding of clientside/serverside:
http://wiki.graal.net/index.php/Clientside http://wiki.graal.net/index.php/Serverside http://www.graal.net/index.php/Creat...Starting_Guide http://wiki.graal.net/index.php/Crea.../Script/Client (explains how to communicate between serverside and clientside) Quote:
Quote:
And yeah, GS1 just uglifies a beautiful script. GS2 is also considerably more efficient than GS1. Quote:
Quote:
Quote:
Quote:
Quote:
PHP Code:
PHP Code:
|
Quote:
I will have to lookup putnpc2 since I have never used it. Also, if I wanted to do something like a toggle, say: PHP Code:
|
Quote:
player.vars can be added serverside or clientside (and changed), but there are some disadvantages (and advantages). For serverside, you can add a player.var. This is not synchronized with clientside. For example, "player.staffLevel = 4". On clientside, you can use it for storing objects or something. However, they are cleared when the player logs off. You can do stuff like "player.equippedItem = this" for equipping standard weapons. Quote:
PHP Code:
Quote:
PHP Code:
|
Quote:
Another thing, I was under the impression that variable type is automatically detected, but it seems like setting a variable to a string of text doesn't work? Trying to do something like this: PHP Code:
PHP Code:
PHP Code:
Doesn't this work? PHP Code:
|
Ugh, I don't know how else to do this.
I want the weapon icon to be displayed dependant on the type of weapon equipped, so.. PHP Code:
PHP Code:
|
Quote:
PHP Code:
Quote:
Quote:
Plus.... you're combining GS1 and GS2 in a horrible way >_< Quote:
PHP Code:
And, I'm pretty sure you're adding an extra parameter to showimg almost everywhere. Press F2 and click on "Scripts", it may be giving an error. |
Quote:
Quote:
PHP Code:
Edit: Bah, I got it to work with #s. *slap forehead* |
You can use GS2 now! Don't be a slave to GS1 conventions.
PHP Code:
|
Quote:
PHP Code:
|
| All times are GMT +2. The time now is 03:52 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.