Can't connect to server or channel?

Started by Icey, Sat 10/12/2011 15:43:40

Previous topic - Next topic

Icey

Code: ags

IRCConnect("irc.irchighway.net",6667);

IRCJoin("#Dissidia");


I added this to the game for when the button is pressed you should be able to join that server but you can't.

Can someone tell me what it is I'm doing wrong?

monkey0506

#1
Yes. Trying to make an MMORPG with AGS. :D

But seriously, if you can't connect to the server you're obviously not going to be able to join a specific chat hosted on it. The first thing you need to figure out is what's preventing you from connecting to that server (if indeed there is an issue there). If there's not a problem, then you need to figure out why the join command is failing.

So, on a more serious note, what you're doing wrong is that you haven't done any debugging. Or if you have, you haven't told us what debugging you have done. So that's what you're doing wrong.

Icey

Nope not anymore. Just some test chatting.

The server it self is not messing with the game. I think I am missing something or I just have something placed in the wrong spot or script.

monkey0506

Quote from: S3 on Sat 10/12/2011 16:08:32I think I am missing something or I just have something placed in the wrong spot or script.

Then how about actually showing us what you've done instead of the two lines that you assume aren't working without providing us the functions in the script that include those lines, or any debugging that you've done to try and determine whether said functions are ever being called; whether any error messages or return values were indicative of failure, or what exactly is notifying you that the code isn't working?

Why are you using this for "some test chatting" if you're not planning to use it in a game? Why are you trying to include features if you don't have the first clue how to properly implement them, or how to debug issues occurred in doing so?

I don't mind helping you, but you have to give us some information first. How do you not know this by now?

Icey

Im sorry. I lost internet connection for a long time. I am using this for test chatting cause one day I would like to know how to set up my on IRC server/channel and be able to include it in my game.
Code: ags

function Button50_OnClick(GUIControl *control, MouseButton button)
{
String nick;
String name; 

//StrCopy(name, txtboxname.Text);
nick = "Dave";
nick = Game.InputBox("Please enter a user name.");

String mystring = "name, txtboxname.Text";
String newstring = mystring.Copy();


Connect(nick);
//IRCConnect("#Dissidia", 6667);
IRCConnect("irc.irchighway.net",6667);*

IRCJoin("#Dissidia");*


TweenSoundVolume(1.0, 100, 0, eLinearTween, eBlockTween);
gGui7.Visible=false;  
gGui7.TweenTransparency(0.5, 100);
mouse.Visible = false;
muffy.ChangeRoom(17, 266, 213);
Dave.ChangeRoom(17, 156, 86);
Stars_of_Time.Stop();
TweenSoundVolume(0.1, 0, 100, eLinearTween, eBlockTween);
mouse.Visible = true;
gGui9.Visible = true;
gGui5.Visible = false;
gGui5.SetPosition(0, 0);
Button12.Visible = true;
Button13.Visible = true;
Button14.Visible = true;
Button15.Visible = true;
}


Everything in here works except the stared lines. I get an error usually saying I need to register first. How at one point I began to noticed that when I log in than exited the game and logged back in I noticed that the user name still existed however it was never shown in the IRC chat site.

Wyz

#5
Well the thing is you need to login with a nickname and user data before the IRC server will let you join any channels. I see in your code you use both IRCConnect and Connect. Connect will call IRCConnect, so if you want to use the IRC module manually instead of using the chat module, don't use the Connect function.

Connect will look something like this:
Code: ags

bool connected = false;

void Connect(String nick)
{
  if (!IRCConnect("irc.irchighway.net"))
  {
    Display("Connection failed!");
    return;
  }
  
  IRCNick(nick);
  IRCUser(nick, "agsIRC");

  connected = true;
}


You'll need to call that functions in that order. Because you'll not be connected right away you have to wait after you've called those function for the server response telling you you're logged in (welcome). Then you can join channels. Something like this:

Code: ags

function repeatedly_execute()
{
  if (!connected)
    return;
  
  IRCEventType type;
  
  type = IRCReceive();
  while (type != eIRCNone)
  {
    if (type == eIRCWelcome)
    {
      IRCJoin("#Dissidia");
    }
    
    type = IRCReceive();
  }
}
Life is like an adventure without the pixel hunts.

Icey

Ok so do I place the second script in the room script,gen script, or irc script?

Wyz

The global script, but you can also use the room's repeatedly executed event (room_RepExec usually). Athird possibility is to make a separate module and place the functions in there. If you do that the module needs to be below the IRC module in the list.
Life is like an adventure without the pixel hunts.

monkey0506

Quote from: S3 on Mon 12/12/2011 02:01:48Ok so do I place the second script in the room script,gen script, or irc script?

This just again goes to show that you don't have the slightest grasp on how scripts in AGS work.

You shouldn't be editing someone else's module unless you're specifically making modifications to the way those functions work.

The room script's repeatedly execute function is, by default, named "room_RepExec" not "repeatedly_execute", and although you can change the name of the function, it's one of the most common mistakes made around events to have the wrong name between the Events pane and what's actually in the script.

The "gen script" by which you mean GlobalScript.asc is just a script, same as any other. The only functions that must be placed in that script are character, GUI, GUI control, and inventory item events, because it's not currently possible to link those functions from another script. Any other function that you're putting into the script can be placed in any script, as long as it doesn't reference custom functions that haven't been defined yet. That is, you can't use the IRC functions in a script that is higher in the list than the IRC script.

Quote from: S3 on Sun 11/12/2011 01:43:10Im sorry. I lost internet connection for a long time. I am using this for test chatting cause one day I would like to know how to set up my on IRC server/channel and be able to include it in my game.

So basically, you've just contradicted what you said about this only being for testing purposes. It's cool if you want to set up an IRC chat for use within your game, but don't lie about it. Oh, and unless it is an MMORPG (which you've already said it's not), or the like, then I wouldn't recommend making your game rely on Internet-based functions.

Quote from: S3 on Sun 11/12/2011 01:43:10Everything in here works except the stared lines. I get an error usually saying I need to register first. How at one point I began to noticed that when I log in than exited the game and logged back in I noticed that the user name still existed however it was never shown in the IRC chat site.

Although you've now listed some of the symptoms, you've still never given any indication that you've attempted to do any form of debugging. If you don't learn how to debug, you're never going to be able to stand on your own feet in the field of programming. Just saying.

Icey

#9
I wasn't trying to edit his script yet only using the given functions he made in the IRC script.

Also I wasn't lying as I just wanted to try and connect to the FF dissidia channel through my game. It's for testing purposes cause not only do I want to learn how to do it for myself but I am not planning on releasing a game the can only chat from game to IRC chat room instead of game to game. The only reason I would have it do such a thing was if I wanted all my games on that server.

Also I only learn based off what I need to know. I wouldn't ask around about how to make a FPS game if I wasn't going to actually require that bit of knowledge.

SMF spam blocked by CleanTalk