Graalians

Graalians (https://www.graalians.com/forums/index.php)
-   GraalOnline Era (https://www.graalians.com/forums/forumdisplay.php?f=13)
-   -   Small Script Help! Can't get Statue working (https://www.graalians.com/forums/showthread.php?t=7791)

Johnaudi 07-13-2012 09:03 AM

Okay Thanks Emera...
am currently working on an Event, but is there a way to find (in the level) the guy with the most ... lets say clientr.ec
anyway I can warp him and find the command? like is there something like player.most.clientr.ec.setlevel2?

Emera 07-13-2012 12:27 PM

Use for (temp.pl : players) { to scan through all of the players in the level. You can then use temp.pl.clientr.ec to check their ec clientr flag.

Johnaudi 07-13-2012 02:14 PM

Quote:

Posted by Emera (Post 160646)
Use for (temp.pl : players) { to scan through all of the players in the level. You can then use temp.pl.clientr.ec to check their ec clientr flag.

I know that, I just wanted to know, how can I created something to make the one with the MOST EC's be warped or uses chat for a certain thing...
something like for (winner: playerwithmostclientr.ec) {
isnt there something like this similar? like I will use winner.setlevel2() if it worked etc..

callimuc 07-14-2012 08:59 PM

You could do something like this:
PHP Code:

this.mostec NULL;
for (
temp.plplayers) {
  
temp.track findPlayer(this.mostec);
  if (
temp.pl.clientr.event_ec temp.track.clientr.event_ecthis.mostec temp.pl;
}
findPlayer(this.mostec).setLevel2(levelnamexy); 


Emera 07-14-2012 11:02 PM

Quote:

Posted by callimuc (Post 161529)
You could do something like this:
PHP Code:

this.mostec NULL;
for (
temp.plplayers) {
  
temp.track findPlayer(this.mostec);
  if (
temp.pl.clientr.event_ec temp.track.clientr.event_ecthis.mostec temp.pl;
}
findPlayer(this.mostec).setLevel2(levelnamexy); 


Beat me to it :(

Johnaudi 07-15-2012 06:42 AM

Quote:

Posted by callimuc (Post 161529)
You could do something like this:
PHP Code:

this.mostec NULL;
for (
temp.plplayers) {
  
temp.track findPlayer(this.mostec);
  if (
temp.pl.clientr.event_ec temp.track.clientr.event_ecthis.mostec temp.pl;
}
findPlayer(this.mostec).setLevel2(levelnamexy); 


Thank you, but I still don't see the usage of temp.pl and not plys. Like I use, what's the difference?

callimuc 07-15-2012 08:24 PM

You can call it however you want to. You can also call it temp.stefan, temp.john, ... . On Graal it's mostly called temp.pl for one player and temp.plyrs/temp.plys for more players. It's just easier for others to see what you want to do with it. Kinda like organisation but there are no rules for that.
The 2nd "param", in this case players, is always an array. In this case players is an array, just like allplayers, serveroptions.staff, ... . You could also do something like
PHP Code:

temp.testarray = {"hello""my""name""is""calli"};
for (
temp.whatevertemp.testarray) {
  echo(
temp.whatever);


Basicly its the same (in this case) as
PHP Code:

temp.testarray = {"hello""my""name""is""calli"};
for (
temp.i=0temp.i<temp.testarray.size(); temp.i++) {
  echo(
temp.testarray[temp.i]);


in my opinion.

I just prefer the for() loop in this case

Emera 07-15-2012 08:39 PM

Quote:

Posted by callimuc (Post 162284)
PHP Code:

temp.testarray = {"hello""my""name""is""calli"};
for (
temp.i=0temp.i<temp.testarray.size(); temp.i++) {
  echo(
temp.testarray[temp.i]);



Sorry, but it was my understanding that coders styled their code. I must be mistaken? DO IT AGAIN!

callimuc 07-15-2012 09:01 PM

Quote:

Posted by Emera (Post 162289)
Sorry, but it was my understanding that coders styled their code. I must be mistaken? DO IT AGAIN!

What?

Johnaudi 07-16-2012 09:07 AM

Quote:

Posted by callimuc (Post 162284)
You can call it however you want to. You can also call it temp.stefan, temp.john, ... . On Graal it's mostly called temp.pl for one player and temp.plyrs/temp.plys for more players. It's just easier for others to see what you want to do with it. Kinda like organisation but there are no rules for that.
The 2nd "param", in this case players, is always an array. In this case players is an array, just like allplayers, serveroptions.staff, ... . You could also do something like
PHP Code:

temp.testarray = {"hello""my""name""is""calli"};
for (
temp.whatevertemp.testarray) {
  echo(
temp.whatever);


Basicly its the same (in this case) as
PHP Code:

temp.testarray = {"hello""my""name""is""calli"};
for (
temp.i=0temp.i<temp.testarray.size(); temp.i++) {
  echo(
temp.testarray[temp.i]);


in my opinion.

I just prefer the for() loop in this case

I know about the type of calling, but why temp. not this.? I'm still getting confused as this point

IPAD* 07-16-2012 11:43 AM

Quote:

Posted by callimuc (Post 162295)
What?

What the **** cant you read he said you cant style

callimuc 07-16-2012 11:46 AM

Quote:

Posted by IPAD* (Post 162480)
What the **** cant you read he said you cant style

So captain obvious tell me what is not styled on that.

Quote:

Posted by Johnaudi (Post 162468)
I know about the type of calling, but why temp. not this.? I'm still getting confused as this point

temp.flags only stay in the function. Using this.flags will be usable in the whole script and can be changed external through other scripts (thats why i made it this.mostec since you might need it later on). There is no need in using this.flags in that case but its up to you.

IPAD* 07-16-2012 12:52 PM

Quote:

Posted by callimuc (Post 162481)
So captain obvious tell me what is not styled on that.



temp.flags only stay in the function. Using this.flags will be usable in the whole script and can be changed external through other scripts (thats why i made it this.mostec since you might need it later on). There is no need in using this.flags in that case but its up to you.

I just answered chapter 1 I didn't prepare for chapter 2 man!

Johnaudi 07-16-2012 01:48 PM

Quote:

Posted by callimuc (Post 162481)
So captain obvious tell me what is not styled on that.



temp.flags only stay in the function. Using this.flags will be usable in the whole script and can be changed external through other scripts (thats why i made it this.mostec since you might need it later on). There is no need in using this.flags in that case but its up to you.

Oh alright!! Got that!! Thanks.
Quote:

function onCreated() {
this.number=0;
}
function onPlayerTouchsMe() {
if (this.number==0) {
this.chat="you touched me! I feel so special!";
this.number=1;
} else {
this.chat="Stop touching me! You already did!";
}
}
So exactly what I'm asking is : so temp.number can't replace this.number in this case?
And second : is there any other way without using this.number?
Thanks a lot!
P.S @iPad : his script style is readable and nice to the eye.

Emera 07-16-2012 02:53 PM

Quote:

Posted by callimuc (Post 162481)
So captain obvious tell me what is not styled on that.

Spaces between symbols like + and =
Nothing big mango, just pointing it out ;)

Quote:

Posted by Johnaudi (Post 162499)
Oh alright!! Got that!! Thanks.

So exactly what I'm asking is : so temp.number can't replace this.number in this case?
And second : is there any other way without using this.number?
Thanks a lot!
P.S @iPad : his script style is readable and nice to the eye.

Speaking of styling, there's an absence of it in your code. You'll have to get acquanited with styling your code so others can read it. It's hard to read when there's no styling.

Here's some links to help get you started:
http://forums.graalonline.com/forums...ad.php?t=61805
http://fp4.ca/gs2beautifier/

Also, I don't get what you're trying to say about this.number and temp.number.


All times are GMT. The time now is 02:02 PM.

Powered by vBulletin/Copyright ©2000 - 2025, vBulletin Solutions Inc.