![]() |
What did i do? - Printable Version +- Mirage Engine (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17) +---- Thread: What did i do? (/showthread.php?tid=1715) |
What did i do? - Pbcrazy - 28-04-2008 ok i wrote this little bit of code so that the program would get the variable MAX_PLAYERS from an .ini file in the server folder but i keep getting this error Compile error! Expected: end of statement and the code turns red. heres the code Code: Public MAX_PLAYERS = GetVar(App.Path & "/Settings.ini", "[Maxes]", "MAX_PLAYERS") Re: What did i do? - Stomach Pulser - 29-04-2008 Add a const between public and maxplayers Re: What did i do? - Pbcrazy - 29-04-2008 ok i added Const now it says "Constant expression required" Code: Public Const MAX_PLAYERS = GetVar(App.Path & "/Settings.ini", "[Maxes]", "MAX_PLAYERS") Re: What did i do? - Stomach Pulser - 29-04-2008 The variable needs to be set up at run time. Try: Code: Public Players As Integer Then, under your gameinit: Code: Players = GetVar(stuffsgoeshere) It won't be a constnt, but it should work. Re: What did i do? - Pbcrazy - 29-04-2008 ok thanks got it working finally, i think i havent compiled it yet so i dont know if it will work but VB isnt complaining ![]() Re: What did i do? - Pbcrazy - 04-05-2008 ok i just cant seem to get this right. i have another sub that im trying to get it to work on in the client side. Code: Private Sub Form_Load() i keeps saying runtime error 13 type mismatch and highlights this bit of code Code: frmMain.sockMain.RemotePort = Port please tell me what i did wrong Re: What did i do? - Soyokaze - 04-05-2008 Probably a type mismatch? (Captain Obvious, away!) When it comes up with the error, point your mouse over both sides of the equation. You should be able to figure something out from that. I'd tell you, but I'm a newbie to VB6. ^^; Re: What did i do? - Pbcrazy - 04-05-2008 well no duh its a type mismatch lol i just cant figure out what it was. ive looked over it like 5 times. Re: What did i do? - Pbcrazy - 04-05-2008 ahh duh stupid me :oops: thanks Re: What did i do? - shaded - 04-05-2008 Port = val(GetVar(filename, "[General]", Port)) Also, I don't think you need the [] around General. I could be wrong, but try it out. Re: What did i do? - Pbcrazy - 04-05-2008 well i had the[] around general because that is the way i have it in my .ini file and it works but there need to be " " around Port. but thank you. now i can finally get this to work. |