Legacy GM Networking Help following an example

Hello currently i am following the example from the LAN Demo
http://help.yoyogames.com/hc/en-us/articles/216754698-Networking-Overview
i downloaded the demo and tested it out, it works. When i try to implement it in my game however i get this error message... i'm not entirely sure whats wrong, has anyone ever done this example before?? Not to mention im not even sure where the iServerName is being set... and ive searched every single object, constant, and scripts
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Alarm Event for alarm 1
for object oMenu:

Push :: Execution Error - Variable Get -1.iServerName(100629, -2147483648)
at gml_Object_oMenu_ObjAlarm1_1 (line 2) - var i = iServerName;
############################################################################################
 
Last edited:

Xer0botXer0

Senpai
the var i is being assigned to iServerName, which isn't declared before var i is being assigned.
What is iServerName suppose to be ?
 
the var i is being assigned to iServerName, which isn't declared before var i is being assigned.
What is iServerName suppose to be ?
I understand that part, and tbh looking over the networking example provided... im not entirely sure myself.... Lemme pull up the code


Code:
/// Start game - local client+server
var i;
i = iServerName;
global.ServerName = i.Text;
global.Server = instance_create(0,0,oServer);
if( global.haveserver == false ){
    show_debug_message("Cant create server");
}else{
    global.connectip="127.0.0.1";
    network_destroy(global.broadcast_server);
    global.broadcast_server = -1;
    show_debug_message("#######################################");
    show_debug_message("Start game");
    show_debug_message("#######################################");
    room_goto(Level1);
}
 
I forgot to mention that oServer is the only Obj that has that "Text" variable stored used to draw the Server name and the ip address. i dont think i'm supposed to change it seeing how it works on that demo...
 

Xer0botXer0

Senpai
This
/// Start game - local client+server
var i;
i = iServerName;
global.ServerName = i.Text;

is the same as

/// Start game - local client+server
global.ServerName = iServerName.Text;

You'd still get the error with the second version because iServerName is not being declared before it's being used, from what i can tell iServerName is an object, that holds the variable "Text" within it.


From what I can tell your above script is trying to assign a global variable to the variable within a separate object id stored within a variable.

So you want to go through your create events of your objects and find where iServerName is being declared and to what

Also the link you provided doesn't show anything about the code you're working on ?
What is your code trying to do, are you creating a server selection lobby ? Just store the server name in a global variable and then access it when you want to use it.

Reasons for using a server name can be to create a server selection lobby, or just to see the server name client side. maybe draw the name of the server server side.

You should check this out as it's what I read to learn about servers, alongside the gml manual.

http://gmc.yoyogames.com/index.php?showtopic=604116&hl=
 
Last edited:
This
/// Start game - local client+server
var i;
i = iServerName;
global.ServerName = i.Text;

is the same as

/// Start game - local client+server
global.ServerName = iServerName.Text;

You'd still get the error with the second version because iServerName is not being declared before it's being used, from what i can tell iServerName is an object, that holds the variable "Text" within it.


From what I can tell your above script is trying to assign a global variable to the variable within a separate object id stored within a variable.

So you want to go through your create events of your objects and find where iServerName is being declared and to what

Also the link you provided doesn't show anything about the code you're working on ?
What is your code trying to do, are you creating a server selection lobby ? Just store the server name in a global variable and then access it when you want to use it.

Reasons for using a server name can be to create a server selection lobby, or just to see the server name client side. maybe draw the name of the server server side.

You should check this out as it's what I read to learn about servers, alongside the gml manual.

http://gmc.yoyogames.com/index.php?showtopic=604116&hl=
i went through each one of my objects and the networking tutorial that was provided i think was meant as an "in-depth" on the networking stuff, i will take a look at the other link, the reason why i wanted to use this one was mostly because it had the very basic foundations of the sprite-updates and everything included. ill take a look over it again just to make sure im not missing anything
 

Xer0botXer0

Senpai
As far as I know the difference between LAN multiplayer and online is just the IP address thing, the other people on the lan only have to put in your local ip address assigned to you by the router or one custom set.
Regarding the server you can either create a standalone server or a server within the game so you'd have the options 'host' or 'join.

And yes I think you are looking at the indepth tutorial or rather an extras tutorial which isn't showing your the basics of networking rather an expansion of it.

From what I remember you want to look the networking functions, asynchronous networking event and buffers. Which is pretty much what FatalSheeps tutorial covers.
 
T

tcstarr

Guest
Hey I'm looking over the same tutorial now and am wondering if you ever figured out where iServerName was declared I've searched everywhere and am coming across the same problem.
 

Blaze

Member
Hey I'm looking over the same tutorial now and am wondering if you ever figured out where iServerName was declared I've searched everywhere and am coming across the same problem.
Shift+Ctrl F searches in all the code windows/scripts for keywords
 
T

tcstarr

Guest
So I went through looking for all declerations of iServerName and found it's only reference is in the alarm code where its actually used (look at the above code) where
//
var i = iServerName;
//
it's never actually declared, just referenced. Checked all the asynchronous network events, object creation codes, room creation codes, nothin.
I'm thoroughly confused about this as it goes against everything I've learned thus far as a programmer. I even checked the GML directory to see if iServerName was some kind of keyword or something or buffer or object that didn't have to be declared but was created during some other event and still found nothing. If anyone can offer any kind of help and or solution it would be greatly appreciated.

The code is Mike Dailly's netowrk demo example.
http://help.yoyogames.com/hc/en-us/articles/216754698-Networking-Overview
can be found here. Source Code is a link in first paragraph called network demo.
 

rogonow

Member
I found the problem. I post it here to help others. Due to a bug, object iServerName is only completely hidden in room Menu, you can't copy it to an other room or delete it. The workaround:
replace
GML:
/// Start game - local client+server
var i;
i = iServerName;
global.ServerName = i.Text;
by
GML:
/// Start game - local client+server
var i;
i = oTextBox;
global.ServerName = i.Text;//text box object has text
 
Top