Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Old Scripting Engine (GS1) (https://forums.graalonline.com/forums/forumdisplay.php?f=154)
-   -   Teams? (https://forums.graalonline.com/forums/showthread.php?t=72900)

theHAWKER 03-18-2007 01:46 AM

Teams?
 
In an event i want to sort people into teams, but i don't even know how to start the script x.x this is how far i got:
PHP Code:

if (playerchats){
if (
startswith(#g,Events Team)){
if (strequals(#c,/teams)){
}
}


could somone get me started plz?

cbk1994 03-18-2007 02:02 AM

Quote:

Originally Posted by theHAWKER (Post 1289804)
In an event i want to sort people into teams, but i don't even know how to start the script x.x this is how far i got:
PHP Code:

if (playerchats){
if (
startswith(#g,Events Team)){
if (strequals(#c,/teams)){
}
}


could somone get me started plz?

Sure.
PHP Code:

function onPlayerChats()
{
  if ( 
player.guild.starts"Events Team" )
  {
     if ( 
player.chat == "/teams" )
     {
        
sortPlayersIntoTeams();
     }
  }


There you go :)

godofwarares 03-18-2007 02:09 AM

Quote:

Originally Posted by cbkbud (Post 1289814)
Sure.
PHP Code:

function onPlayerChats()
{
  if ( 
player.guild.starts"Events Team" )
  {
     if ( 
player.chat == "/teams" )
     {
        
sortPlayersIntoTeams();
     }
  }


There you go :)

Thats not what he meant, Nor did he want it in GS2.


I'd suggest you use a loop through all the players in the level, similar to:
PHP Code:

for (0playerscounti++)
{
     
with (players[i])
     {
          if (!(
i%2)) // Team 1
          
{
               
setstring this.team,"Red";
          } else { 
// Team 2
               
setstring this.team,"Blue";
          }
     }



killerogue 03-18-2007 02:14 AM

Quote:

Originally Posted by theHAWKER (Post 1289804)
In an event i want to sort people into teams, but i don't even know how to start the script x.x this is how far i got:
PHP Code:

if (playerchats){
if (
startswith(#g,Events Team)){
if (strequals(#c,/teams)){
}
}


could somone get me started plz?


EEW GS1!!! Dude, Gs2 is better than GS1, on top of that it's easier to use and is object based making things 1 thousand times easier in my opinion. :o

cbk1994 03-18-2007 02:14 AM

I'll make one for you, is GS2 okay? There's no way I'm going to script in GS1

Crow 03-18-2007 02:16 AM

Well I would set a guild tag right away ;o

PHP Code:

for (0playerscounti++) {
  
with (players[i]) {
    if (!(
i%2)) // Team 1
      
player.guild "Team Red";
    else 
// Team 2
      
player.guild "Team Blue";
    }
  }



cbk1994 03-18-2007 02:19 AM

Quote:

Originally Posted by killerogue (Post 1289818)
EEW GS1!!! Dude, Gs2 is better than GS1, on top of that it's easier to use and is object based making things 1 thousand times easier in my opinion. :o

I second that.

As I've always said, compare these ...

GS1
PHP Code:

setstring serverr.blah,strtofloat(#s(serverr.blah))+strtofloat(#t(1)); 

vs.

GS2
PHP Code:

serverr.blah += tokens[1]; 

You decide

godofwarares 03-18-2007 02:22 AM

Who cares if its GS1!
Apparently he's making it in GraalEditor (I'm not sure though), so cut him some slack. He may just be learning -_-


But I agree -- GS2 > GS1.


-Edit: Stan, I believe the phrase you're looking for is "Object Oriented Programming".

cbk1994 03-18-2007 02:34 AM

Quote:

Originally Posted by godofwarares (Post 1289823)
Who cares if its GS1!
Apparently he's making it in GraalEditor (I'm not sure though), so cut him some slack. He may just be learning -_-


But I agree -- GS2 > GS1.


-Edit: Stan, I believe the phrase you're looking for is "Object Oriented Programming".

No one is yelling at him. I'm simply refusing to script in GS1. I hate it. It gives me headaches ;)

killerogue 03-18-2007 02:38 AM

Quote:

Originally Posted by godofwarares (Post 1289823)
-Edit: Stan, I believe the phrase you're looking for is "Object Oriented Programming".

It's really all the same meaning. ;)

Crow 03-18-2007 02:59 AM

Quote:

Originally Posted by cbkbud (Post 1289829)
No one is yelling at him. I'm simply refusing to script in GS1. I hate it. It gives me headaches ;)

Which is proving that you dont really understand it. Pwnt.

napo_p2p 03-18-2007 03:27 AM

Quote:

Originally Posted by cbkbud (Post 1289822)
GS1
PHP Code:

setstring serverr.blah,strtofloat(#s(serverr.blah))+strtofloat(#t(1)); 


PHP Code:

setstring serverr.blah,#v(strtofloat(#s(serverr.blah))+strtofloat(#t(1))); 

:asleep:

cbk1994 03-18-2007 02:16 PM

Okay, I can't see any reason why you would make this on the editor, since you are the only player, and as far as I remember 'with' functions require an NPC-Server. If you are making it online, there's no reason why GS2 shouldn't work.

godofwarares 03-18-2007 02:59 PM

Quote:

Originally Posted by cbkbud (Post 1289966)
Okay, I can't see any reason why you would make this on the editor, since you are the only player, and as far as I remember 'with' functions require an NPC-Server. If you are making it online, there's no reason why GS2 shouldn't work.

Could be Unholy Nation :p

theHAWKER 03-19-2007 04:19 AM

T.T im using this for a server, i dont know how to know GS2 cause theres no tutorial or anything.... and i just want a team sorter plz?

godofwarares 03-19-2007 12:27 PM

Yes there's a tutorial on GS2 . . .
Go to WiKi
http://wiki.graal.net

P.S: You wouldn't happen to be working for Horizon, Would you?

Chompy 03-19-2007 04:13 PM

Quote:

Originally Posted by theHAWKER (Post 1290329)
T.T im using this for a server, i dont know how to know GS2 cause theres no tutorial or anything.... and i just want a team sorter plz?

Use the wiki, and also, it's against the rules to ask for scripts, it's ok asking for guidance, but it's not ok to ask for complete scripts, in that way you'll never learn..

theHAWKER 03-19-2007 10:30 PM

Quote:

Originally Posted by godofwarares (Post 1290449)
P.S: You wouldn't happen to be working for Horizon, Would you?

umm no im not, and thx for the link :D

godofwarares 03-19-2007 10:44 PM

Quote:

Originally Posted by theHAWKER (Post 1290699)
umm no im not, and thx for the link :D

No problem.

Angel_Light 03-19-2007 11:35 PM

Quote:

Originally Posted by Chompy (Post 1290506)
that way you'll never learn..

I disagree with this, the way I pretty much learned GS1 was by playing around wiih some of these really complex scripts by messing around with vars, changing number, etc...

Chompy 03-20-2007 03:39 PM

Quote:

Originally Posted by Angel_Light (Post 1290732)
I disagree with this, the way I pretty much learned GS1 was by playing around wiih some of these really complex scripts by messing around with vars, changing number, etc...

depends on how complicated the code is I would say..

Skyld 03-20-2007 03:41 PM

Quote:

Originally Posted by Angel_Light (Post 1290732)
I disagree with this, the way I pretty much learned GS1 was by playing around wiih some of these really complex scripts by messing around with vars, changing number, etc...

And in doing so, you will pick up the bad habits of the scripters who wrote the scripts you are editing. It's better to be helped but also left to think for yourself, rather than just being given complete scripts and being told to figure it out. That's the practice we try to work on in these forums.


All times are GMT +2. The time now is 05:17 AM.

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