Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Azimuth

Pages: 1 ... 129 130 131 132 133 [134] 135 136 137 138 139 ... 233
1996
8080 is a proxy server port for a start, and you only need to specify the web port (80) in the connect function, not the send one.
Can you tell me how accurate I was on how I explained it, anything I missed?

1997
Exactly.  You can change the name of it from blocklandConnect to whatever you like.

1998
Off Topic / Re: Most days of school missed
« on: June 26, 2009, 11:25:51 AM »
I get annual ear infections.  Have to stay out a week.

1999
Off Topic / Re: England
« on: June 26, 2009, 11:24:32 AM »
I don't think "lol" should be worthy of a post.
lol

2000
Off Topic / Re: 1-piece swim suits
« on: June 26, 2009, 11:23:56 AM »
we like our asians fruity

2001
Drama / Re: General Zackinlego - handicap Extrodinare!
« on: June 26, 2009, 11:17:27 AM »
hahaha

2002
I need to know the %triggernum numbers.  0 is shoot, etc.  I need to know for my mod.

2003
Well, you use TCPObjects to connect to the internet.  Here is an example of creating one.

Code: [Select]
new tcpObject(blocklandConnect);

Now that we have the object, we need something to connect to.  Lets say Blockland, for instance.

Code: [Select]
$connectionAddress = "blockland.us:80";

We define this as a global variable so it can be used again later.

Now, lets define some basic functions for our tcp object.  We like to have some output as to how its going.

Let's start with the ::onConnect method.  It has no arguments.

Code: [Select]
function blocklandConnect::onConnect()
{
      echo("blocklandConnect: Connected!");
}

This is for whenever a connection sucessfully connects to the server.  echo("string"); outputs whatever is in that string to the console, which is useful for knowing when things happen, without doing anything complicated.  We also define functions using the syntax
Code: [Select]
function functionName(%argument,%arguments,%argumenta)
{
      //stuffHere
}

Next, we will do ::onConnectFailed().  It's when it fails to connect to a server for any reason.  I believe it has no arguments.

Code: [Select]
function blocklandConnect::onConnectFailed()
{
      echo("blocklandConnect: Connection FAILED!");
}

One last thing thats also good to know, ::onLine(%line).  %line is an argument because we receive data back from the server.

Code: [Select]
function blocklandConnect::onLine(%line)
{
      echo("BLC: " @ %line);
}

Servers usually send back headers when dealing with web pages.

There is also ::onTimeout for when a connection times out, and ::onDisconnect for whenever it disconnects.

Now, let's start connecting.

Code: [Select]
blocklandConnect.connect($connectionAdress);

This connects us to the address we defined as $connectionAdress.  You should receive a message in console saying "blocklandConnect: Connected!".  Now, we are connected.  We should send something to the server.  We do this by calling the .send() method on it like .connect().  After taking a look at RTB, I found that they sent
Code: [Select]
"GET /blockland/rtbModServer.php?c=GETFILEDL&n="@urlEnc($Pref::Player::NetName)@"&arg1="@%this.SO.file_id@" HTTP/1.1\r\nHost: returntoblockland.com\r\nUser-Agent: Torque/1.0\r\n\r\n"

Now, this is a bit more than we need, so lets trim it down.  GET is something that tells the server that we're requesting a page.  There is aditionally POST, and probably others.  I do not know, I don't work with TCPObjects often.  Next we see /blockland/rtbModServer.php?c=GETFILEDL&n="@urlEnc($Pref::Player::NetName)@"&arg1="@%this.SO.file_id@" .  Well, this is the file we are requesting.  You could basically just say /textfile.txt if you wanted to request a text file.  Next is some stuff I don't know what to call, really.  In this case, we use HTTP/1.1\r\nHost:  -  I know that all of this is nessecary, and has to do with something important.  Where you see returntoblockland.com, you replace with the host.  From what we're working on, we use blockland.us because we're connected to blockland.us. Next is \r\nUser-Agent: Torque/1.0\r\n\r\n - we use this to tell our User-Agent and also have more escape characters.  I'm not one to say what the escape characters are, but you can leave this part alone.  Now, lets go make our connection string.

Code: [Select]
$connectionString = "GET /index.php HTTP/1.1\r\nHost: blockland.us\r\nUser-Agent: Torque/1.0\r\n\r\n";

If you listened to what I said, you should understand the important parts you should change.  Now, this sends a request for the page "index.php" - the main page.  You then use
Code: [Select]
blocklandConnect.send($connectionString);

to send the request for the page.  The server then returns the stuff (which can also be based on user agent, useful) in console from the onLine() method.  Now that we have that stuff, we can disconnect.

Code: [Select]
blocklandConnect.disconnect();

If you need any additional clarification, help, or anything to do with this, just ask.  I might be wrong on certain things, so do ask for help from other people like Ephialtes, as they may be more knowledgeable to this.


You should be knowledgeable enough with the PHP server-side code to not need help (your site seems good).  Also, don't be afraid to experiment.  You may mess something up, but that's just how you should learn - from your mistakes.  I really think you may know alot of this stuff, and some stuff you can do.  Best of luck with this,
               Azimuth

2004
I'm working on editing the tank so you can shoot fire with it.

2005
Creativity / Re: The new and improved 3D model topic!
« on: June 26, 2009, 10:16:18 AM »
Did someone say, "Tank!"?



Treads aren't done yet.
i love youuuuuuuuuu

2006
Drama / Re: Will you loving stop?
« on: June 26, 2009, 10:05:50 AM »
http://forum.blockland.us/index.php?topic=58370.0

i say its the person that drugged her fault
moar threads plsazazazsaazSZAZSASZSzZaZ

"were you bombed at birth" looool

2007
Off Topic / Re: 1-piece swim suits
« on: June 26, 2009, 10:02:04 AM »
Yeah not really.

2008
Off Topic / Re: 1-piece swim suits
« on: June 26, 2009, 10:01:00 AM »
Post real life pictures of hot girls you don't know, actually.

2009
Suggestions & Requests / Re: Heedicalking's Suggestions.
« on: June 26, 2009, 09:59:53 AM »
I think ephi should do something with rtb for num 1

2010
Suggestions & Requests / Re: Text-reader sort of event function.
« on: June 26, 2009, 09:59:24 AM »
Microsoft Sam.
Still have to have people without download all of the sounds.

Pages: 1 ... 129 130 131 132 133 [134] 135 136 137 138 139 ... 233