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

[EO 2.0/3.0] Guilds


Scott
 Share

Recommended Posts

@Joost:

> Did you add a file named Guildlist.txt in the guilds folder? Not sure if the code actually sets up the text if none if found.

Yes, I am sure. The path is correct, and no the code will not create the list. I was doing that after I got this to work. Something is really messed up.The .dat files are not creating anymore.

Found the issue with the dat files. Got them working again, however it is not writing into the txt file still.

It is writing in the file, but it is only adding returns. No text just new lines, it is also not checking. I added a guild name is manually it still allowed me to make it again in game.
Link to comment
Share on other sites

  • Replies 328
  • Created
  • Last Reply

Top Posters In This Topic

```
    'Check to see if guild name exists. If not Write to file
    If FindGuild(True) Then
        PlayerMsg Founder_Index, "That Guild name already exists!", BrightRed
        Exit Sub
    End If

    'Write to text file to save guild name.
    Call SaveGuild(Guildname)
```This sub is still broken. FindGuild(True) is not working because it needs to be FindGuild(Whatever variable is defined as the guild name) and SaveGuild(Guildname)  should be SaveGuild(Whatever variable is defined as the guild name). I dont know what variable stores the guild name so youll have to find that yourself.
Link to comment
Share on other sites

@Joost:

> ```
>     'Check to see if guild name exists. If not Write to file
>     If FindGuild(True) Then
>         PlayerMsg Founder_Index, "That Guild name already exists!", BrightRed
>         Exit Sub
>     End If
>    
>     'Write to text file to save guild name.
>     Call SaveGuild(Guildname)
> ```This sub is still broken. FindGuild(True) is not working because it needs to be FindGuild(Whatever variable is defined as the guild name) and SaveGuild(Guildname)  should be SaveGuild(Whatever variable is defined as the guild name). I dont know what variable stores the guild name so youll have to find that yourself.

Wouldent this be the guild name variable? GuildData(GuildSlot).Guild_Name = name. Still looking as that one did not work.
Link to comment
Share on other sites

@Joost:

> Sounds about right.

```
    'Check to see if guild name exists. If not Write to file
    If FindGuild(GuildData.Guild_Name) Then
        PlayerMsg Founder_Index, "That Guild name already exists!", BrightRed
        Exit Sub
    End If

    'Write to text file to save guild name.
    Call SaveGuildName(GuildData.Guild_Name)
```
Compile error:
Invalid qualifer
Link to comment
Share on other sites

@Joost:

> Guildname is a string, not a number

I think I edited before you posted. It is now correctly getting the guild name, but it is still giving me an error 13 type mis match. name is a string

Ok, I now have it working almost completely. I changed long into string so now they are both strings.

However, If I have two guild names lets say

Testme1
Testme2

That is how the text file should look. However it looks like
Testme1testme2

I need it to place a return. Working on it now.
Link to comment
Share on other sites

@Joost:

> You changed it into
> ```
> Sub SaveGuild(ByVal Guildname As String)
>
> ```?

Actually because I am a derp Guildname already exists. I fixed this a few posts back. here is the complete code. Pretty sure 100% working.

```
Sub SaveGuildName(ByVal name As String)
    Dim F As Long
    Dim n As Long
        F = FreeFile
        Open App.Path & "\data\guilds\Guildlist.txt" For Append As #F
        Print #F, name; ""

        Close #F
End Sub
```
```
Function FindGuild(ByVal name As String) As Boolean
    Dim F As Long
    Dim s As String
    F = FreeFile
    Open App.Path & "\data\guilds\Guildlist.txt" For Input As #F

    Do While Not EOF(F)
        Input #F, s

        If Trim$(LCase$(s)) = Trim$(LCase$(name)) Then
            FindGuild = True
            Close #F
            Exit Function
        End If

    Loop

    Close #F
End Function
```
```
    'Check to see if guild name exists.
    If FindGuild(name) Then
        PlayerMsg Founder_Index, "That Guild name already exists!", BrightRed
        Exit Sub
    End If
```
```
    'Write to text file to save guild name.
    Call SaveGuildName(name)
```
Makes guild list if guild list is not there. This is in initserver
```
        ' Check if the master Guildlist file exists for checking duplicate names, and if it doesnt make it
    If Not FileExist("data\guilds\Guildlist.txt") Then
        F = FreeFile
        Open App.Path & "\data\guilds\Guildlist.txt" For Output As #F
        Close #F
    End If
```Before I forget I would like to thank you. It must of been frustrating trying to help me, but I feel as though I learned quite a bit.

Now I am working on it deleting out of the text file when the guild disbands.  I have a feeling the deleting will be very hard…

Stuck on the deleting part. No errors thrown, however nothing is deleted.
```
Sub DeleteGuild(ByVal name As String)
    Dim f1 As Long
    Dim f2 As Long
    Dim s As String
    Call FileCopy(App.Path & "\data\guilds\Guildlist.txt", App.Path & "\data\guilds\Guildtemp.txt")
    ' Destroy name from Guild List
    f1 = FreeFile
    Open App.Path & "\data\guilds\Guildtemp.txt" For Input As #f1
    f2 = FreeFile
    Open App.Path & "\data\guilds\Guildlist.txt" For Output As #f2

    Do While Not EOF(f1)
        Input #f1, s

        If Trim$(LCase$(s)) <> Trim$(LCase$(name)) Then
            Print #f2, s
        End If

    Loop

    Close #f1
    Close #f2
    Call Kill(App.Path & "\data\guilds\Guildtemp.txt")
End Sub
```
Got it to work :] Thanks for the help.

Anyone feel free to use the code or add it to the tutorial.
Link to comment
Share on other sites

* Changed all player name checks over to CheckPlayerName Function [ ]
* Added Bug fix to main downloads [X]
* Finished adding Color guild names [ ]
* Fixed lowercase guildnames [ ]
* Added a /Lookup command to look up both players/guilds [ ]
* Added Guild Rank to guildchat messages [ ]
* Guilds cannot have the same name anymore [ ]
* Admin tool for removing/changing Guilds/Guild Names [ ]
Link to comment
Share on other sites

@Snoozey:

> Actually because I am a derp Guildname already exists. I fixed this a few posts back. here is the complete code. Pretty sure 100% working.
>
> ```
> Sub SaveGuildName(ByVal name As String)
>     Dim F As Long
>     Dim n As Long
>         F = FreeFile
>         Open App.Path & "\data\guilds\Guildlist.txt" For Append As #F
>         Print #F, name; ""
>        
>         Close #F
> End Sub
> ```
> ```
> Function FindGuild(ByVal name As String) As Boolean
>     Dim F As Long
>     Dim s As String
>     F = FreeFile
>     Open App.Path & "\data\guilds\Guildlist.txt" For Input As #F
>
>     Do While Not EOF(F)
>         Input #F, s
>
>         If Trim$(LCase$(s)) = Trim$(LCase$(name)) Then
>             FindGuild = True
>             Close #F
>             Exit Function
>         End If
>
>     Loop
>
>     Close #F
> End Function
> ```
> ```
>     'Check to see if guild name exists.
>     If FindGuild(name) Then
>         PlayerMsg Founder_Index, "That Guild name already exists!", BrightRed
>         Exit Sub
>     End If
> ```
> ```
>     'Write to text file to save guild name.
>     Call SaveGuildName(name)
> ```
> Makes guild list if guild list is not there. This is in initserver
> ```
>         ' Check if the master Guildlist file exists for checking duplicate names, and if it doesnt make it
>     If Not FileExist("data\guilds\Guildlist.txt") Then
>         F = FreeFile
>         Open App.Path & "\data\guilds\Guildlist.txt" For Output As #F
>         Close #F
>     End If
> ```Before I forget I would like to thank you. It must of been frustrating trying to help me, but I feel as though I learned quite a bit.
>
> Now I am working on it deleting out of the text file when the guild disbands.  I have a feeling the deleting will be very hard…
>
> Stuck on the deleting part. No errors thrown, however nothing is deleted.
> ```
> Sub DeleteGuild(ByVal name As String)
>     Dim f1 As Long
>     Dim f2 As Long
>     Dim s As String
>     Call FileCopy(App.Path & "\data\guilds\Guildlist.txt", App.Path & "\data\guilds\Guildtemp.txt")
>     ' Destroy name from Guild List
>     f1 = FreeFile
>     Open App.Path & "\data\guilds\Guildtemp.txt" For Input As #f1
>     f2 = FreeFile
>     Open App.Path & "\data\guilds\Guildlist.txt" For Output As #f2
>
>     Do While Not EOF(f1)
>         Input #f1, s
>
>         If Trim$(LCase$(s)) <> Trim$(LCase$(name)) Then
>             Print #f2, s
>         End If
>
>     Loop
>
>     Close #f1
>     Close #f2
>     Call Kill(App.Path & "\data\guilds\Guildtemp.txt")
> End Sub
> ```
> Got it to work :] Thanks for the help.
>
> Anyone feel free to use the code or add it to the tutorial.

Where do i put these codes
Link to comment
Share on other sites

The founder(as I called it in this) is not able to leave the guild unless they,

1)Transfer the founder status to another member with the **/guild founder (name)** command
or
2)Disband the guild which deletes the guild completely.
Link to comment
Share on other sites

A very nicely written base indeed. I've been porting all the features over from a seperate admin screen and some commands to a fully UI driven system and so far it's been fairly easy to track everything you've written and what needs to be changed.. And the missing color change seems like an easy enough task to implement!
Link to comment
Share on other sites

@quintensky:

> hmm guess i'll just w8 to implement this until i know more about VB6 so i can make it graphical

Well, the whole admin panel is already 'graphical' so you only need to make some kind of Guild Admin Panel where you can invite users, open the guild panel etc.
Link to comment
Share on other sites

@Scott:

> * Changed all player name checks over to CheckPlayerName Function [ ]
> * Added Bug fix to main downloads [X]
> * Finished adding Color guild names [ ]
> * Fixed lowercase guildnames [ ]
> * Added a /Lookup command to look up both players/guilds [ ]
> * Added Guild Rank to guildchat messages [ ]
> * Guilds cannot have the same name anymore [ ]
> * Admin tool for removing/changing Guilds/Guild Names [ ]

does the X mean: check! (as in done)
or: still to be done (kinda confusing ;)
Link to comment
Share on other sites

@quintensky:

> implemented, works good, now i just gotta make every command graphical, as in:
> commands = gone
> buttons = replacement

Thanks to another eclipse user there is now a tutorial for this!

http://www.touchofdeathforums.com/smf2/index.php/topic,80414.msg860819.html#msg860819
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...