Eclipse - Free 2D Mmorpg Maker
September 02, 2010, 10:31:38 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Shop Arcade chat Login Register  
 
 
   
 
collapse

* No Spam Or Websites

Refresh History
  • Ertzel: So... Anyone with basic/none/limited photoshop or even paint skills want to make some money converting sprites for me?
    Today at 10:07:35 PM
  • Gamma™: weaver why are you oflfine on H&H? :S
    Today at 10:04:26 PM
  • Ertzel: Ya, only one try per knife, my one try failed :(
    Today at 10:00:17 PM
  • LegendWeaver: is it one use?
    Today at 09:43:15 PM
  • Ertzel: Wish I didnt spend my 1k+ credits to buy the stupid knife that failed at stealing Robins credits >.<
    Today at 09:42:42 PM
  • Wraith: ) Kreator!
    Today at 09:06:52 PM
  • Wraith: yes! you were! (in red text
    Today at 09:06:46 PM
  • ToshiroHayate: Kreator!
    Today at 08:25:02 PM
  • Kreator: o_0 Was I supposed to Wraith?
    Today at 08:16:02 PM
  • [Pie] ICT: Don't worry.. I commented.
    Today at 07:55:08 PM
  • Wraith: Ay, kreator, wtf is up with you not posting anything about my new cliffs??
    Today at 07:50:36 PM

* Recent Topics

[EO] Attaching Problem. by 314piwm
[Today at 10:21:04 PM]


Project Vertigo [2d Tile-based Side-Scrolling Engine] by Miguu
[Today at 10:03:22 PM]


Zacaras Empire (Hiring) by Ertzel
[Today at 08:43:54 PM]


custom cliff tiles by ToshiroHayate
[Today at 08:29:15 PM]


.: RPG Kingdom :. by LegendWeaver
[Today at 08:25:20 PM]


What do you think? by [Pie] ICT
[Today at 07:54:54 PM]


[Show Off] Aztec Stuff by [Pie] ICT
[Today at 07:50:07 PM]


So I herd you liek mudkipz by Kreator
[Today at 07:36:52 PM]


Haven and Hearth: Epic Screenshot Thread by Tompwnage™
[Today at 07:14:21 PM]


The Lonliest Star [RP] by DDunit
[Today at 07:09:46 PM]


* Who's Online


Pages: [1] 2
Site Author : Topic: WriteINI from Client to the Server. (Solved)  (Read 795 times)
0 Members and 1 Guest are viewing this topic.
December 01, 2009, 10:56:05 AM
Donated
Advanced Member
*
User No : 13723
Posts: 700
  • 859 credits
  • View Inventory
  • Send Money To Ertzel
  • Location : Canada
    • View Profile
    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.
    Code: [Select]
    Private Sub Command1_Click()
    ' GMOTD change
        Call WriteINI("GuildMessage", GetPlayerGuild(MyIndex), txtGMOTD, (App.path & "\GMOTD.ini"))

        FrmGMOTD.Visible = False
        FrmGuildOwner.Visible = True
       
    End Sub

    « Last Edit: December 04, 2009, 05:19:47 AM by [SB]Ertzel » Logged

    December 01, 2009, 11:25:31 AM
    Veteran
    Teh Uberleet
    *
    User No : 259
    Posts: 2208
  • 50 credits
  • View Inventory
  • Send Money To Xeross
  • Location : Oosterhout, Noord-brabant, The Netherlands
    • View Profile
    • WWW
    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.
    Logged

    December 01, 2009, 11:52:29 AM
    When I crash and burn, I want it to at least be Spectacular
    Donated
    Demi God
    *
    User No : 1466
    Posts: 4884
  • 1352 credits
  • View Inventory
  • Send Money To DrNova
  • Location : My own personal hell
    And boom goes the dynamite
    • View Profile
    Way, way simple to do that with a few easy lines of sadscript
    Logged

    Its shiny. By video game rules, it must be important.


    December 01, 2009, 12:02:22 PM
    Donated
    Advanced Member
    *
    User No : 13723
    Posts: 700
  • 859 credits
  • View Inventory
  • Send Money To Ertzel
  • Location : Canada
    • View Profile
    Way, way simple to do that with a few easy lines of sadscript

    Yes, 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.
    Logged

    December 01, 2009, 12:29:06 PM
    Global Moderator
    Teh Uberleet
    *
    User No : 13370
    Posts: 3669
  • 432 credits
  • View Inventory
  • Send Money To Soul
    • View Profile
    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"))
    Logged
    December 01, 2009, 12:34:46 PM
    Advanced Member
    ****
    User No : 12189
    Posts: 996
  • 0 credits
  • View Inventory
  • Send Money To Kimimaru
    • View Profile
    • WWW
    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:

    Code: [Select]
    Call SendData("guildmotd" & SEP_CHAR & GetPlayerGuild(MyIndex) & SEP_CHAR & txtGMOTD & END_CHAR)
    Then in the Server:

    Code: [Select]
    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.
    Logged



    Server is:
    December 01, 2009, 12:40:59 PM
    Donated
    Advanced Member
    *
    User No : 13723
    Posts: 700
  • 859 credits
  • View Inventory
  • Send Money To Ertzel
  • Location : Canada
    • View Profile
    Code: [Select]
    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
    Code: [Select]
    Sub IncomingData(Socket As JBSOCKETSERVERLib.ISocket, Data As JBSOCKETSERVERLib.IData)but it wouldn't compile.
    Logged

    December 01, 2009, 01:00:13 PM
    Global Moderator
    Teh Uberleet
    *
    User No : 13370
    Posts: 3669
  • 432 credits
  • View Inventory
  • Send Money To Soul
    • View Profile
    Search for HandleData?

    Just find where packets are handled.

    Sorry Kimi, I didn't have the source infront of me.
    Logged
    December 01, 2009, 01:17:52 PM
    Donated
    Advanced Member
    *
    User No : 13723
    Posts: 700
  • 859 credits
  • View Inventory
  • Send Money To Ertzel
  • Location : Canada
    • View Profile
    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.
    Logged

    December 01, 2009, 01:29:02 PM
    Global Moderator
    Teh Uberleet
    *
    User No : 13370
    Posts: 3669
  • 432 credits
  • View Inventory
  • Send Money To Soul
    • View Profile
    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 Sub

    Then in the client

    Case "gmotdres"
    If Parse(1) <> "" Then
    Call PlayerMsg(MyIndex, "Gulid Message of the Day: " & Parse(1), RED)
    End If

    So somewhere in the client (where it gets connected in frmMirage) you would have:


    Call SendData("readgmotd" & SEP_CHAR & GetPlayerGuild(MyIndex) & END_CHAR)
    Logged
    December 01, 2009, 01:41:34 PM
    Donated
    Advanced Member
    *
    User No : 13723
    Posts: 700
  • 859 credits
  • View Inventory
  • Send Money To Ertzel
  • Location : Canada
    • View Profile
    Code: [Select]
    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.
    Logged

    December 01, 2009, 04:53:28 PM
    Head Developer
    Epic Poster
    *
    User No : 5176
    Posts: 9557
  • 1265 credits
  • View Inventory
  • Send Money To Robin
  • Location : Yorkshire, UK
    • View Profile
    Use GetVar.
    Logged

    Real men use Eclipse Origins v1.1.0 to create their games!

    December 01, 2009, 05:47:37 PM
    Advanced Member
    ****
    User No : 12189
    Posts: 996
  • 0 credits
  • View Inventory
  • Send Money To Kimimaru
    • View Profile
    • WWW
    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:

    Code: [Select]
    Dim gmotd As String
    gmotd = GetVar(App.Path & "\GMOTD.ini", "GuildMessage", GetPlayerGuild(Index))
    If gmotd <> vbNullString Then
        Call PlayerMsg(Index, gmotd, YELLOW)
    End If

    That's all you need.
    Logged



    Server is:
    December 02, 2009, 03:37:42 AM
    Donated
    Advanced Member
    *
    User No : 13723
    Posts: 700
  • 859 credits
  • View Inventory
  • Send Money To Ertzel
  • Location : Canada
    • View Profile
    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.
    Logged

    December 02, 2009, 04:01:14 AM
    Advanced Member
    ****
    User No : 12189
    Posts: 996
  • 0 credits
  • View Inventory
  • Send Money To Kimimaru
    • View Profile
    • WWW
    No, you don't need to. Make sure that the GetVar statement I posted is correct.
    Logged



    Server is:
    December 02, 2009, 05:08:45 AM
    Donated
    Advanced Member
    *
    User No : 13723
    Posts: 700
  • 859 credits
  • View Inventory
  • Send Money To Ertzel
  • Location : Canada
    • View Profile
    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 Testing

    Test is the guild name, and GMOTD Testing is the Guild Message Of The Day.

    In my Server I have this in modGameLogic
    Code: [Select]
            ' 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.

    Logged

    December 02, 2009, 09:59:23 AM
    Advanced Member
    ****
    User No : 12189
    Posts: 996
  • 0 credits
  • View Inventory
  • Send Money To Kimimaru
    • View Profile
    • WWW
    Change the code to this:

    Code: (vb) [Select]
            ' 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.
    « Last Edit: December 02, 2009, 10:00:55 AM by Kimimaru » Logged



    Server is:
    December 02, 2009, 10:43:34 AM
    Donated
    Advanced Member
    *
    User No : 13723
    Posts: 700
  • 859 credits
  • View Inventory
  • Send Money To Ertzel
  • Location : Canada
    • View Profile
    Nope, not getting a message when I login >.<

    Would it be easier to just make the GMOTD display in the Guild screen ingame

    I tried to do that, but I would have to make something like this..
    Code: [Select]
           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.
    « Last Edit: December 02, 2009, 11:52:27 AM by [SB]Ertzel » Logged

    December 02, 2009, 12:59:36 PM
    Advanced Member
    ****
    User No : 12189
    Posts: 996
  • 0 credits
  • View Inventory
  • Send Money To Kimimaru
    • View Profile
    • WWW
    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?
    Logged



    Server is:
    December 02, 2009, 01:25:42 PM
    Donated
    Advanced Member
    *
    User No : 13723
    Posts: 700
  • 859 credits
  • View Inventory
  • Send Money To Ertzel
  • Location : Canada
    • View Profile
    Yes im sure thats where im putting it, and its not working >.<

    I got this to kindda work..
    Code: (vb) [Select]
            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.
    « Last Edit: December 02, 2009, 02:05:26 PM by [SB]Ertzel » Logged

    Pages: [1] 2
     


    Powered by MySQL Powered by PHP Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
    SimplePortal 2.3.1 © 2008-2009, SimplePortal
    Valid XHTML 1.0! Valid CSS!
    Page created in 0.398 seconds with 31 queries.