Wow, complicated but getting it.
Wow, complicated but getting it.
How to contact me?
In-game name currently: ZombiEk" Ciprioni
Current gang owned: Mayhem
Skype: ek_graal
Facebook: Shannon Gallagher
Email: [email protected]
Push notifications: enabled
Ask me any questions/concerns!
Can we start easy?
How to contact me?
In-game name currently: ZombiEk" Ciprioni
Current gang owned: Mayhem
Skype: ek_graal
Facebook: Shannon Gallagher
Email: [email protected]
Push notifications: enabled
Ask me any questions/concerns!
Oh yes poorface, I think we stopped at loops...
They're pretty easy to learn, I guess I can include them in my next tutorial, but here's an overview.
A loop can be either infinite, or specific, and the only way to stop a loop is to put 'break;' or 'return;' if it is infinite.
Lot's of ways to have loops on Graal.
I'm going to teach you the for(); loop today. Let me show you how it works correctly.
what this will echo is:PHP Code:
function onCreated() {
for (i = 0; i < 6; i++) {
echo(i);
}
}
So how does this work? You have three arguments to have in a for() loop.0
1
2
3
4
5
You can replace all of the above this way:PHP Code:
for (i = 0; // This will be read once at the beginning
i < 5; // this will be checked everytime
i += 1 // or whatever you want to change every time the loop starts (WARNING, this does not take a semi colomn
) {
echo(i);
}
PHP Code:
function onCreated() {
i = 0;
if (i < 5) break;
echo(i);
i += 1; // or i++; whatever
if (i < 5) break;
echo(i);
i +=1;
if (i < 5) break;
echo(i);
i += 1;
if (i < 5) break;
echo(i);
i += 1;
if (i < 5) break;
echo(i);
i += 1;
// etc
}
-Johnaudi
Wow. So it is like counting, or continous things it says?
How to contact me?
In-game name currently: ZombiEk" Ciprioni
Current gang owned: Mayhem
Skype: ek_graal
Facebook: Shannon Gallagher
Email: [email protected]
Push notifications: enabled
Ask me any questions/concerns!
well, I understand now what "break;" does, I don't understand what not make them like a line like so:
PHP Code:
function onActionServerSide(pl, this.lucky) {
for (pl : players) {
if (pl.level == "era_lucky-grab.nw") {
pl.setlevel2("era_luck-grab.nw", 30, 30);
triggerclient("gui", name, pl)
}
if (this.lucky == true)
pl.setlevel2("era_lucky-grab.nw", 30, 40);
}
pl.setlevel2("era_start.nw", 30, 30);
}
}
function onCreated() {
for (this.num = 0; this.num < 5; this.num--) {
}
}
//#CLIENTSIDE
function onPlayerChats() {
this.staff = "Events Team";
if (player.guild in this.staff && player.chat == "down") {
triggerserver("gui", name, NULL);
}
}
function onActionClientSide(pl) {
this.lucky = "Yay I'm luck!";
if (player.guild in this.staff && player.chat == ":timer") {
player.chat = "kicking in: " @ this.num;
if (player.this.staff.chat == "0")
sleep(3);
if (pl.level == "era_lucky-grab.nw" && player.chat == "Yay I'm lucky!")
triggerserver("gui", name, pl, this.lucky)
}
if (player.chat != this.lucky) {
triggerserver("gui", name, NULL)
}
}
}
}
Last edited by Striker; 07-16-2013 at 02:18 PM. Reason: added extras
Striker*-Have any question, concerns or problems?Message me on forums, click on the link if you need help: http://era-go.com/forum/member.php?410-StrikerNeed help on iEra P.M my nick name is Striker*-Need further help? My email is:[email protected]ENjOY PLAYING IERA!!!!!-Gani Artist
Striker*-Have any question, concerns or problems?Message me on forums, click on the link if you need help: http://era-go.com/forum/member.php?410-StrikerNeed help on iEra P.M my nick name is Striker*-Need further help? My email is:[email protected]ENjOY PLAYING IERA!!!!!-Gani Artist
Serverside and clientside aren't even operated on the same things.
Clientside is compiled then sent off to be executed on the client whilst serverside is compiled then sent off to be executed by the server.
Therefore, this. variables will go through the whole script, but only on the size it's instanced on. So, a this.timer = 5; declaration on serverside will not set this.timer = 5; on clientside and vice versa.