Ertzel Posted December 1, 2009 Author Share Posted December 1, 2009 I am working on an advance Guild Message Of The Day code. Right now I have it so the Guild Owner can make the new message of the day by using a new frm I added in, then when they save the new GMOTD it puts it in an INI called GMOTD.ini with the GuildName and then the Message.The problem is, I can only figure out how to make the new INI file in the Client folder, but I need it to go into the Server Folder instead so I can do the next part of it so everyone in the guild sees.This would only make the guild Leader beable to see the GMOTD.Here is my current code that works, but makes the file in the Client Folder.```Private Sub Command1_Click()' GMOTD change Call WriteINI("GuildMessage", GetPlayerGuild(MyIndex), txtGMOTD, (App.path & "\GMOTD.ini")) FrmGMOTD.Visible = False FrmGuildOwner.Visible = TrueEnd Sub``` Link to comment Share on other sites More sharing options...
xeross Posted December 1, 2009 Share Posted December 1, 2009 You need to send a packet to the server with the GMOTD data and then make the server parse it and put it into an INI. after this you ofcourse need to add some code to the server to display the gmotd on login.I don't know a lot about the eclipse packet system so I can't give you any code. Link to comment Share on other sites More sharing options...
DrNova Posted December 1, 2009 Share Posted December 1, 2009 Way, way simple to do that with a few easy lines of sadscript Link to comment Share on other sites More sharing options...
Ertzel Posted December 1, 2009 Author Share Posted December 1, 2009 @DrNova:> Way, way simple to do that with a few easy lines of sadscriptYes, but this is not sadscripting, it is sourcing.I know how to do it with sadscripting, but those codes don't work in vb6 with the client. That is why Im asking how I would do it with source edits, not sadscripts. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted December 1, 2009 Share Posted December 1, 2009 You would have a SendDatatoCall SendDataTo("guildmotd" & SEP_CHAR & GetPlayerGuild(MyIndex) & SEP_CHAR & txtGulid & END_CHAR)Then in the server (I think IncomingData… Wherever packets are handled (looks like ScriptedItems with a select Case and stuff but with strings as cases).Case "gulidmotd" Call WriteINI("GuildMessage", Parse(1), Parse(2), (App.path & "\GMOTD.ini")) Link to comment Share on other sites More sharing options...
Kimimaru Posted December 1, 2009 Share Posted December 1, 2009 @[SB:> Soul link=topic=54866.msg580847#msg580847 date=1259699346]> You would have a SendDatato> > Call SendDataTo("guildmotd" & SEP_CHAR & GetPlayerGuild(MyIndex) & SEP_CHAR & txtGulid & END_CHAR)> > Then in the server (I think IncomingData… Wherever packets are handled (looks like ScriptedItems with a select Case and stuff but with strings as cases).> > Case "gulidmotd"> Call WriteINI("GuildMessage", Parse(1), Parse(2), (App.path & "\GMOTD.ini"))This needs a little fixing up:```Call SendData("guildmotd" & SEP_CHAR & GetPlayerGuild(MyIndex) & SEP_CHAR & txtGMOTD & END_CHAR)```Then in the Server:```Case "guildmotd" Call PutVar(App.Path & "\GMOTD.ini", "GuildMessage", Parse(1), Trim$(parse(2)))Exit Sub```The Server uses **PutVar** and **GetVar**, while the Client uses **ReadINI** and **WriteINI**, unless you've changed that, of course. Link to comment Share on other sites More sharing options...
Ertzel Posted December 1, 2009 Author Share Posted December 1, 2009 @Kimimaru:> ```> Case "guildmotd"> Call PutVar(App.Path & "\GMOTD.ini", "GuildMessage", Parse(1), Trim$(parse(2)))> Exit Sub> ```> The Server uses **PutVar** and **GetVar**, while the Client uses **ReadINI** and **WriteINI**, unless you've changed that, of course.Where do I put this part?I tried in```Sub IncomingData(Socket As JBSOCKETSERVERLib.ISocket, Data As JBSOCKETSERVERLib.IData)```but it wouldn't compile. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted December 1, 2009 Share Posted December 1, 2009 Search for HandleData?Just find where packets are handled.Sorry Kimi, I didn't have the source infront of me. Link to comment Share on other sites More sharing options...
Ertzel Posted December 1, 2009 Author Share Posted December 1, 2009 Woot, thx both of you, I got that part to work.Now im having a problem with my next part (Yes, Im a newb at this) :sad:How do I make it so when a Player logs into the game now, it displays the Guild Message Of The Day for their guild?But it would have to check to see if the Players Guild has a MOTD set, so each guild has its own MOTD.Right now my GMOTD.ini in my Server Folder looks like this[GuildMessage]Test=Guild Message Of The Day Test1Test is the name of my guild. Then after the = is the MOTD for the guild. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted December 1, 2009 Share Posted December 1, 2009 Well, you'd want to do the same thing, except "talk" via server and client.Like in the server:Case "readgmotd" Gmotd = ReadINI(App.Path & "\GMOTD.ini", "GuildMessage", Parse(1))Call SendDataTo(index, "gmotdres" & SEP_CHAR & Gmotd & END_CHAR)Exit SubThen in the clientCase "gmotdres"If Parse(1) <> "" ThenCall PlayerMsg(MyIndex, "Gulid Message of the Day: " & Parse(1), RED)End IfSo somewhere in the client (where it gets connected in frmMirage) you would have:Call SendData("readgmotd" & SEP_CHAR & GetPlayerGuild(MyIndex) & END_CHAR) Link to comment Share on other sites More sharing options...
Ertzel Posted December 1, 2009 Author Share Posted December 1, 2009 ```Case "readgmotd" Gmotd = ReadINI(App.Path & "\GMOTD.ini", "GuildMessage", Parse(1))Call SendDataTo(index, "gmotdres" & SEP_CHAR & Gmotd & END_CHAR)Exit Sub```Wont let me compile, it says ReadINI is not a command or w/e. Link to comment Share on other sites More sharing options...
Robin Posted December 2, 2009 Share Posted December 2, 2009 Use GetVar. Link to comment Share on other sites More sharing options...
Kimimaru Posted December 2, 2009 Share Posted December 2, 2009 @[SB:> Ertzel link=topic=54866.msg580864#msg580864 date=1259702272]> Woot, thx both of you, I got that part to work.> > Now im having a problem with my next part (Yes, Im a newb at this) :sad:> > How do I make it so when a Player logs into the game now, it displays the Guild Message Of The Day for their guild?> > But it would have to check to see if the Players Guild has a MOTD set, so each guild has its own MOTD.> > Right now my GMOTD.ini in my Server Folder looks like this> > [GuildMessage]> Test=Guild Message Of The Day Test1> > Test is the name of my guild. Then after the = is the MOTD for the guild.You should probably put this part in **Sub JoinGame(Index)** in **modGameLogic** in the **Server** source. It executes faster than sending a packet, and it takes up less code. In the sub, put something like this there:```Dim gmotd As Stringgmotd = GetVar(App.Path & "\GMOTD.ini", "GuildMessage", GetPlayerGuild(Index))If gmotd <> vbNullString Then Call PlayerMsg(Index, gmotd, YELLOW)End If```That's all you need. Link to comment Share on other sites More sharing options...
Ertzel Posted December 2, 2009 Author Share Posted December 2, 2009 Do I need to add Souls code to the Client still if I use that Server code Kimiaru? cuz im not getting a message when I login. Link to comment Share on other sites More sharing options...
Kimimaru Posted December 2, 2009 Share Posted December 2, 2009 No, you don't need to. Make sure that the **GetVar** statement I posted is correct. Link to comment Share on other sites More sharing options...
Ertzel Posted December 2, 2009 Author Share Posted December 2, 2009 I think its set up right..Right now I can make the GMOTD, but it still wont appear anywhere when I login, or when I change it…When I make the GMOTD it goes into GMOTD.INI in my Server Folder.Inside the folder looks like this[GuildMessage]Test=GMOTD TestingTest is the guild name, and GMOTD Testing is the Guild Message Of The Day.In my Server I have this in modGameLogic``` ' Send the player the welcome message. MOTD = Trim$(GetVar(App.Path & "\MOTD.ini", "MOTD", "Msg")) If LenB(MOTD) <> 0 Then Call PlayerMsg(index, "MOTD: " & MOTD, 11) End If ' Send the Guild Message Of The Day GMOTD = GetVar(App.Path & "\GMOTD.ini", GetPlayerGuild(index), "GuildMessage") If GMOTD <> vbNullString Then Call PlayerMsg(index, GMOTD, YELLOW) End If```I also tried putting the code in the same spot as the normal GMOTD without adding the ' Send the Guild Message Of The Day, but that didn't work either. Link to comment Share on other sites More sharing options...
Kimimaru Posted December 2, 2009 Share Posted December 2, 2009 Change the code to this:``` ' Send the player the welcome message. MOTD = Trim$(GetVar(App.Path & "\MOTD.ini", "MOTD", "Msg")) If LenB(MOTD) <> 0 Then Call PlayerMsg(index, "MOTD: " & MOTD, 11) End If ' Send the Guild Message Of The Day GMOTD = Trim$(GetVar(App.Path & "\GMOTD.ini", "GuildMessage", GetPlayerGuild(Index))) If GMOTD <> vbNullString Then Call PlayerMsg(index, GMOTD, YELLOW) End If```It should work now. Link to comment Share on other sites More sharing options...
Ertzel Posted December 2, 2009 Author Share Posted December 2, 2009 Nope, not getting a message when I login >.<Would it be easier to just make the GMOTD display in the Guild screen ingameI tried to do that, but I would have to make something like this..``` GMOTD = ReadINI(App.path & "\GMOTD.ini", "GuildMessage", GetPlayerGuild(MyIndex)) frmStable.GuildMsg.Caption = GMOTD```But ReadIni seems not to be a function in the Client Source, same with GetVar, so I have no clue how to make it display the GuildMsg Caption as the Guild Message Of The Day. Link to comment Share on other sites More sharing options...
Kimimaru Posted December 2, 2009 Share Posted December 2, 2009 Well, you'd have to read the INI file from the Server, since it's there, so this part of the code has to be put in the Server, unless you want to send a packet, but that's not necessary. My code should work if the file path, header, and variable is correct in the **GetVar** statement. Are you sure you put it in **Sub JoinGame(Index)** in **modGameLogic** in the **Server** source? Link to comment Share on other sites More sharing options...
Ertzel Posted December 2, 2009 Author Share Posted December 2, 2009 Yes im sure thats where im putting it, and its not working >.<I got this to kindda work..``` frmStable.GuildMsg.Caption = Trim$(ReadINI("GuildMessage", GetPlayerGuild(MyIndex), App.path & "\GMOTD.ini"))```This makes the GMOTD display in a text box in my guild window, which is good enough if I can't get it to display on login.The only problem is, its looking for GMOTD.ini in the Client Folder not the Server folder >.<So I need to send the GMOTD from the Server to the frmStable.GuildMsg.Caption =somehow to make the message show up. Link to comment Share on other sites More sharing options...
xeross Posted December 2, 2009 Share Posted December 2, 2009 This text only protocol still looks ugly to me. Link to comment Share on other sites More sharing options...
Kimimaru Posted December 3, 2009 Share Posted December 3, 2009 @[SB:> Ertzel link=topic=54866.msg581173#msg581173 date=1259789142]> Yes im sure thats where im putting it, and its not working >.<> > I got this to kindda work..> ```> frmStable.GuildMsg.Caption = Trim$(ReadINI("GuildMessage", GetPlayerGuild(MyIndex), App.path & "\GMOTD.ini"))> ```> This makes the GMOTD display in a text box in my guild window, which is good enough if I can't get it to display on login.> > The only problem is, its looking for GMOTD.ini in the Client Folder not the Server folder >.<> > So I need to send the GMOTD from the Server to the frmStable.GuildMsg.Caption => somehow to make the message show up.Well, all right. If the code for popping up your guild window is in the Server, then do this:Before the guild window code, put this:```Dim gmotd As Stringgmotd = Trim$(GetVar(App.Path & "\GMOTD.ini", "GuildMessage", GetPlayerGuild(Index)))Call SendDataTo(Index, "guildmotd" & SEP_CHAR & gmotd & END_CHAR)```Then, in the Client modHandleData:```If casestring = "gmotd" Then frmStable.GuildMsg.Caption = Trim$(parse(1))Exit SubEnd If```If the code for popping up your guild window isn't in the Server, then send a packet to the Server, and from there, retrieve the guild message and then send it back to the Client in a packet like I did. Link to comment Share on other sites More sharing options...
Ertzel Posted December 3, 2009 Author Share Posted December 3, 2009 To open up the Guild window that has the GuildMsg.Caption part in it, this is the script``` If KeyCode = vbKeyG And frmStable.txtMyTextBox.Visible = False Then frmStable.lblGuildName.Caption = GetPlayerGuild(MyIndex) frmStable.lblGuildRank.Caption = GetPlayerGuildAccess(MyIndex) frmStable.GuildMsg = Trim$(ReadINI("GuildMessage", GetPlayerGuild(MyIndex), App.path & "\GMOTD.ini")) If GetPlayerGuildAccess(MyIndex) = 4 Then frmStable.LabelLeader.Visible = True frmStable.picGuildMember.Visible = Not frmStable.picGuildMember.Visible Else frmStable.picGuildMember.Visible = Not frmStable.picGuildMember.Visible End If End If```(This is the one that needs to have GMOTD.ini in the client to use)Its in modGameLogic in my Client Source Link to comment Share on other sites More sharing options...
Kimimaru Posted December 3, 2009 Share Posted December 3, 2009 Okay, so change that code to this:```If KeyCode = vbKeyG And frmStable.txtMyTextBox.Visible = False Then Call SendData("gmotd" & SEP_CHAR & GetPlayerName(MyIndex) & END_CHAR)End If```Then in the Server **modHandleData**, put this:```Case "gmotd" Dim gmotd As String Dim Name As Long Name = FindPlayer(parse(1)) gmotd = Trim$(GetVar(App.Path & "\GMOTD.ini", "GuildMessage", GetPlayerGuild(Name)) Call SendDataTo(Name, "gmotd" & SEP_CHAR & gmotd & SEP_CHAR & Name & END_CHAR)Exit Sub```Head to the Client **modHandleData** now, and put this there:```If casestring = "gmotd" Then Dim gmotd As String Dim Name As Long gmotd = Trim$(parse(1)) Name = parse(2) frmStable.lblGuildName.Caption = GetPlayerGuild(Name) frmStable.lblGuildRank.Caption = GetPlayerGuildAccess(Name) frmStable.GuildMsg = gmotd If GetPlayerGuildAccess(Name) = 4 Then frmStable.LabelLeader.Visible = True frmStable.picGuildMember.Visible = Not frmStable.picGuildMember.Visible Else frmStable.picGuildMember.Visible = Not frmStable.picGuildMember.Visible End If Exit SubEnd If``` Link to comment Share on other sites More sharing options...
Ertzel Posted December 3, 2009 Author Share Posted December 3, 2009 When I do that and go to run the game it closes as soon as I hit G to open the guild window.Im running it through VB6 but the whole thing crashes each time so I can't find the error line. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now