Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Client and server


Sir Topham Hatt
 Share

Recommended Posts

Hey guys I am editing my source and I have ran into a problem I will try to explain what I want the best I can.

Client and Server
Client: Hey server, I need some info I need from /scripts/CHARAEXTRAS/Boren.ini. I need Boren's mining level.

Server: Sure his mining level is 20.

Client: Thank you I will put that in skills.frm in the Label4 spot and rename it to 20.

I hope you understand this as this is like the only way I can explain it.

The black circle is what I to rename to whatever level you have.

[![](http://www.freemmorpgmaker.com/files/imagehost/pics/9b51e643cb9418cd93a9f99e93ee7b0c.png)](http://www.freemmorpgmaker.com/files/imagehost/#9b51e643cb9418cd93a9f99e93ee7b0c.png)

The code.
Private Sub Close_Click()
  frmSkills.Visible = False
    frmStable.Visible = True

    Unload Me
End Sub

Private Sub Form_Load()

  Dim I As Long
    Dim Ending As String

    For I = 1 To 3
        If I = 1 Then
            Ending = ".gif"
        End If
        If I = 2 Then
            Ending = ".jpg"
        End If
        If I = 3 Then
            Ending = ".png"
        End If

        If FileExists("GUI\Skills" & Ending) Then
            frmSkills.Picture = LoadPicture(App.Path & "\GUI\Skills" & Ending)
        End If
    Next I
End Sub

Thank you for your help.

P.S. as this is source editing I put it in the source section. Move it if you believe it goes elsewhere.
Link to comment
Share on other sites

Well I'm guessing you saved his skill level serverside and that skillbox is clientside. Which means you need to send the data from server to client.

First of you need to tell the server that you need the specific variable. Go to the modGameLogic
And add a new sub

```
Public Sub GetPlayerSkills(ByVal Index As Long)
    Call SendData("getplayerskills" & END_CHAR)
End Sub

```
This sends a string to the server requesting the variable.

You also need something to get the answer and assign it to your caption once the server replies.
So in modHandledata client side you need a new case:

```
If casestring = "setplayerskills" Then
      NAMEOFTHELABEL.Caption = Val(parse(1))
      Exit Sub
End If

```
NAMEOFLABEL is the name of the label you wanna rename.

And server side you need to obtain the value from the playerfile and send it back to client. Plus you need something that receives the command to send it.
So go to modHandleData in the server and add a new case

```
Case "getplayerskills"
    Dim File As String
    Dim Skill As String
    File = App.Path & "\playerfiles\" & GetPlayerName(Index) & ".ini"
    Skill = GetVar(File, "SKILLS", "skill")
    Call SendDataTo(Index, "setresistances" & SEP_CHAR & skill & END_CHAR)
    Exit Sub

```
When you click to open your skills tab you can call the GetPlayerSkill sub. Or better yet is to create a variable that you load when you start your game so it only loads once and not everytime you open your skilltab. But then you also need to add a sub that sends the skill variable to the client each time you level up so it doesn't require a restart.

Works but not perfect. You need to edit some values so that it fits your project but this should give you a general idea on how server/client works.
Link to comment
Share on other sites

Thank you very much, I now see what I was doing wrong.
Eh messing with something like this with my level of knowage is not the easist thing I have done. Thanks again!

EDIT: on the client side the code   ```
If Casestring = "getplayerskills" Then
      Label4.Caption = Val(Parse(1))
      Exit Sub
End If
```
gets and error saying wrong Variable and such here is a image

![](http://www.freemmorpgmaker.com/files/imagehost/pics/34c31d74b9fdbbae1cc014b352f4785c.png)
Link to comment
Share on other sites

@Sir:

> Alright it has been a few days and I messed with the code a lot and I need some help. Read the above post please and thank you.

this is stupid but here:

instead of Label4.Caption = change it to

Eclipse Stable =

frmStable.Label4.Caption =

Eclipse Origins =

frmMainGame.Label4.Caption =

if that doesnt work, idk D:
Link to comment
Share on other sites

Not sure if I did that but I'll try it right now thanks for just looking at it I have been fighting with eclipse over this for like a week now and it is making me real mad now

EDIT: did it and no errors, but still it just reads MEXP. I shall jump into the code and edit it some more!
thanks GuzmanM it stopped the error.
Link to comment
Share on other sites

@Sir:

> did it and no errors, but still it just reads MEXP.
> thanks GuzmanM it stopped the error.

No prob dude, and why not checking names and stuff? thats might do it.

for changing a caption =
ES:
frmStable.[label name here].Caption =
EP:
frmMainGame.[label name here].Caption =

and, Soul, I prefer using it in my way. both worlk, aint I right?
Link to comment
Share on other sites

@Soul:

> Guzman is on the right track.
>
> Make it:
>
> skills.Label4.Caption =
>
> You don't need the form name when your in that form, but when referring to it from somewhere else (different module, or form) then you need to put the form name there as well.

I got that in there, now it doesnot have any errors, it does nothing. Nothing at all, I believe it is one of the other codes like server side this time, I'll problem slove it later right now it I have school/work/and my web site.
Link to comment
Share on other sites

@GuzmanM:

> @Sir:
>
> > did it and no errors, but still it just reads MEXP.
> > thanks GuzmanM it stopped the error.
>
> No prob dude, and why not checking names and stuff? thats might do it.
>
> for changing a caption =
> ES:
> frmStable.[label name here].Caption =
> EP:
> frmMainGame.[label name here].Caption =
>
> and, Soul, I prefer using it in my way. both worlk, aint I right?

No.
Link to comment
Share on other sites

@Sir:

> Don't fight on my thread, help me out or get off. Thank you.

It's not a fight, you can't argue about it. One way works and the other doesn't.

You added this line in the server in modHandleData:
    Call SendDataTo(Index, "setresistances" & SEP_CHAR & skill & END_CHAR)

It should be:
    Call SendDataTo(Index, "setplayerskills" & SEP_CHAR & skill & END_CHAR)
Link to comment
Share on other sites

Alright that did not work so here is what I am trying to get the data out of http://www.freemmorpgmaker.com/files/imagehost/pics/afdd9713caad30b1c57b6c1ef665a61b.ini
Maybe the way the data is stored is the problem. Who thought this would be such a pain in the tail.

P.S. Soul Sorry from my point of veiw it looked like you two were fighting, though your point is true.
Link to comment
Share on other sites

Try this as the new server packet:

```
Case "getplayerskills"
    Dim File As String
    Dim Skill As String
    File = App.Path & "Scripting\CHAREXTRAS\" & GetPlayerName(Index) & ".ini"
    Skill = GetVar(File, "Mining", "Exp")
    Call SendDataTo(Index, "setplayerskills" & SEP_CHAR & skill & END_CHAR)
    Exit Sub

```
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...