Print Page | Close Window

Mining Tutorial

Printed From: Mirage Source
Category: Tutorials
Forum Name: Approved Tutorials
Forum Discription: All tutorials shown to actually work with MSE are moved here.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=38
Printed Date: 20 December 2006 at 6:01pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Mining Tutorial
Posted By: Sync
Subject: Mining Tutorial
Date Posted: 07 February 2006 at 5:50pm
Originally posted by Dark Echo

Mining System
Ok, what this is.. Is well basically what it saids it is.. It is a basic mining system.. You will be able to place them down on the map and players walk up to them and press attack.. Right now it uses the Player Level to see if you are good enough to mine something, and it will give you an item. You can make more mines for people to mine, etc. This is a very simple system, which can be used to make a fishing system, or woodcutting system. Enjoy!!

Difficulty: 2/5

Part 1 - Server Side
Okay, first things first, go into modConstants and find:
Public Const MAX_TRADES = 10


Now, add this:
Public Const MAX_MINES = 255


What this is, is just a public constant which tells us how many mines we can have. Not how many we can place, but how many different types of mines we can store..

Right, now find:
Public Const TILE_TYPE_KEYOPEN = 6


And add right below it:
Public Const TILE_TYPE_MINE = 8


Ok, with modConstants done, head over to modDatabase.. Time for saving the mines we make.. Now scroll all the way to the bottom and add this:
Sub SaveMine(ByVal MineNum As Long)
Dim FileName As String
Dim i As Long

    FileName = App.Path & "\data\mines.ini"
   
    Call PutVar(FileName, "MINE" & MineNum, "Name", Trim(Mine(MineNum).Name))
    Call PutVar(FileName, "MINE" & MineNum, "ClassReq", Trim(Mine(MineNum).ClassReq))
    Call PutVar(FileName, "MINE" & MineNum, "LevelReq", Trim(Mine(MineNum).LevelReq))
    Call PutVar(FileName, "MINE" & MineNum, "MaxLevel", Trim(Mine(MineNum).MaxLevel))
    Call PutVar(FileName, "MINE" & MineNum, "Item", Trim(Mine(MineNum).Item))
End Sub

Sub SaveMines()
Dim i As Long

    For i = 1 To MAX_MINES
        Call SaveMine(i)
    Next i
End Sub

Sub LoadMines()
Dim FileName As String
Dim i As Long

    Call CheckMines
   
    FileName = App.Path & "\data\mines.ini"
   
    For i = 1 To MAX_MINES
        Mine(i).Name = GetVar(FileName, "MINE" & i, "Name")
        Mine(i).ClassReq = Val(GetVar(FileName, "MINE" & i, "ClassReq"))
        Mine(i).LevelReq = Val(GetVar(FileName, "MINE" & i, "LevelReq"))
        Mine(i).MaxLevel = Val(GetVar(FileName, "MINE" & i, "MaxLevel"))
        Mine(i).Item = Val(GetVar(FileName, "MINE" & i, "Item"))
       
        DoEvents
    Next i
End Sub

Sub CheckMines()
    If Not FileExist("data\mines.ini") Then
        Call SaveMines
    End If
End Sub


Now, with saving and loading done, head over to modGameLogic and add at the bottom, but before the player functions:
Sub ClearMine(ByVal Index As Long)
    Mine(Index).Name = ""
    Mine(Index).ClassReq = 0
    Mine(Index).LevelReq = 0
    Mine(Index).MaxLevel = 0
    Mine(Index).Item = 0
End Sub

Sub ClearMines()
Dim i As Long

    For i = 1 To MAX_MINES
        Call ClearMine(i)
    Next i
End Sub


Now this is the main mining section.. Ad the very bottom of the module add:
Sub CanPlayerMine(ByVal Index As Long, ByVal MineNum As Long)
Dim c As Integer
   
    If Mine(MineNum).ClassReq = 0 Then
        If GetPlayerLevel(Index) <= Mine(MineNum).MaxLevel Then
        c = Int((Rnd * Mine(MineNum).MaxLevel) + 1) - GetPlayerLevel(Index)
             If c <= Mine(MineNum).LevelReq Then
                 Call GiveItem(Index, Val(Mine(MineNum).Item), 1)
                 Call PlayerMsg(Index, "You found some " & Trim(Mine(MineNum).Name) & "!", BrightBlue)
             Else
                 Call PlayerMsg(Index, "You found nothing!", BrightRed)
             End If
        Else
             Call PlayerMsg(Index, "You are not skilled enough to mine " & Trim(Mine(MineNum).Name) & "!", Red)
        End If
    Else
        If GetPlayerClass(Index) <> Mine(MineNum).ClassReq Then
             If GetPlayerLevel(Index) <= Mine(MineNum).MaxLevel Then
             c = Int((Rnd * Mine(MineNum).MaxLevel) + 1) - GetPlayerLevel(Index)
                 If c <= Mine(MineNum).LevelReq Then
                     Call GiveItem(Index, Val(Mine(MineNum).Item), 1)
                     Call PlayerMsg(Index, "You found some " & Trim(Mine(MineNum).Name) & "!", BrightBlue)
                 Else
                     Call PlayerMsg(Index, "You found nothing!", BrightRed)
                 End If
             Else
                 Call PlayerMsg(Index, "You are not skilled enough to mine " & Trim(Mine(MineNum).Name) & "!", Red)
             End If
        Else
             Call PlayerMsg(Index, "You cannot mine this because you are not the required class!", Red)
        End If
    End If
End Sub


Alrighty, now to load the mines when the server starts up.. Alrighty, so go into modGeneral and find:
Sub InitServer()


Now, find:
    Call SetStatus("Loading spells...")
    Call LoadSpells


And add after it:
    Call SetStatus("Loading mines...")
    Call LoadMines


Ok, thats all for that module.. Now go into the next module down the list, which is modGloabals and find:
Public Spell(1 To MAX_SPELLS) As SpellRec


Now add this under it:
Public Mine(1 To MAX_MINES) As MineRec


Ok, now go into modHandleData and at the bottom of the mod, but before the end sub add this:
    ' ::::::::::::::::::::::::::::::
    ' :: Request edit mine packet ::
    ' ::::::::::::::::::::::::::::::
    If LCase(Parse(0)) = "requesteditmine" Then
        ' Prevent hacking
        If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
             Call HackingAttempt(Index, "Admin Cloning")
             Exit Sub
        End If
       
        Call SendDataTo(Index, "MINEEDITOR" & SEP_CHAR & END_CHAR)
        Exit Sub
    End If
   
    ' ::::::::::::::::::::::
    ' :: Edit mine packet ::
    ' ::::::::::::::::::::::
    If LCase(Parse(0)) = "editmine" Then
        ' Prevent hacking
        If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
             Call HackingAttempt(Index, "Admin Cloning")
             Exit Sub
        End If
       
        ' The mine #
        n = Val(Parse(1))
       
        ' Prevent hacking
        If n < 0 Or n > MAX_MINES Then
             Call HackingAttempt(Index, "Invalid Mine Index")
             Exit Sub
        End If
       
        Call AddLog(GetPlayerName(Index) & " editing mine #" & n & ".", ADMIN_LOG)
        Call SendEditMineTo(Index, n)
    End If
   
    ' ::::::::::::::::::::::
    ' :: Save mine packet ::
    ' ::::::::::::::::::::::
    If (LCase(Parse(0)) = "savemine") Then
        ' Prevent hacking
        If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
             Call HackingAttempt(Index, "Admin Cloning")
             Exit Sub
        End If
       
        ' Mine #
        n = Val(Parse(1))
       
        ' Prevent hacking
        If n < 0 Or n > MAX_MINES Then
             Call HackingAttempt(Index, "Invalid Mine Index")
             Exit Sub
        End If
       
        ' Update the mine
        Mine(n).Name = Trim(Parse(2))
        Mine(n).ClassReq = Trim(Parse(3))
        Mine(n).LevelReq = Trim(Parse(4))
        Mine(n).MaxLevel = Trim(Parse(5))
        Mine(n).Item = Trim(Parse(6))
               
        ' Save it
        Call SendUpdateMineToAll(n)
        Call SaveMine(n)
        Call AddLog(GetPlayerName(Index) & " saving mine #" & n & ".", ADMIN_LOG)
        Exit Sub
    End If

    ' ::::::::::::::::::
    ' :: Request Mine ::
    ' ::::::::::::::::::
    If (LCase(Parse(0)) = "requestmine") Then
       
        ' Mine #
        n = Val(Parse(1))
       
        ' Prevent hacking
        If n < 0 Or n > MAX_MINES Then
             Call HackingAttempt(Index, "Invalid Mine Index")
             Exit Sub
        End If
       
        ' Send mine info
        Call CanPlayerMine(Index, n)
    End If


Now, with that all done.. Go into modServerTCP and all the way at the bottom of that module add this:
Sub SendMine(ByVal Index As Long)
Dim i As Long

    For i = 1 To MAX_MINES
        If Trim(Mine(i).Name) <> "" Then
             Call SendUpdateMineTo(Index, i)
        End If
    Next i
End Sub

Sub SendUpdateMineToAll(ByVal MineNum As Long)
Dim Packet As String

    Packet = "UPDATEMINE" & SEP_CHAR & MineNum & SEP_CHAR & Trim(Mine(MineNum).Name) & SEP_CHAR & END_CHAR
    Call SendDataToAll(Packet)
End Sub

Sub SendUpdateMineTo(ByVal Index As Long, ByVal MineNum As Long)
Dim Packet As String

    Packet = "UPDATEMINE" & SEP_CHAR & MineNum & SEP_CHAR & Trim(Mine(MineNum).Name) & SEP_CHAR & END_CHAR
    Call SendDataTo(Index, Packet)
End Sub

Sub SendEditMineTo(ByVal Index As Long, ByVal MineNum As Long)
Dim Packet As String

    Packet = "EDITMINE" & SEP_CHAR & MineNum & SEP_CHAR & Trim(Mine(MineNum).Name) & SEP_CHAR & Mine(MineNum).ClassReq & SEP_CHAR & Mine(MineNum).LevelReq & SEP_CHAR & Mine(MineNum).MaxLevel & SEP_CHAR & Mine(MineNum).Item & SEP_CHAR & END_CHAR
    Call SendDataTo(Index, Packet)
End Sub

Sub SendmineTo(ByVal Index As Long, ByVal mineNum As Long)
Dim Packet As String

    Packet = "MINE" & SEP_CHAR & MineNum & SEP_CHAR & Trim(Mine(MineNum).Name) & SEP_CHAR & Mine(MineNum).ClassReq & SEP_CHAR & Mine(MineNum).LevelReq & SEP_CHAR & Mine(MineNum).MaxLevel & SEP_CHAR & Mine(MineNum).Item & SEP_CHAR & END_CHAR
    Call SendDataTo(Index, Packet)
End Sub


Alrighty, server side basically done, just one more important thing.. Go into your modTypes and at the very bottom, add this:
Type MineRec
    Name As String * NAME_LENGTH
    ClassReq As Byte
    LevelReq As Byte
    MaxLevel As Byte
    Item As Byte
End Type


Woohoo, thats server side done.. Phew.. Alrighty, now for the happy client side of things.. Hehe..

Part 2 - Client Side
Alrighty, for client side, like the sign tutorial i made.. You will have to make a mine editor, and mine chooser.. Let's go through that now, so we can get it out of the way.. First things first, open up your frmIndex and go into the coding section and add this in the Private Sub cmdOk_Click():
    If InMineEditor = True Then
        Call SendData("EDITMINE" & SEP_CHAR & EditorIndex & SEP_CHAR & END_CHAR)
    End If


Make sure you add it straight after the:
    If InSpellEditor = True Then
        Call SendData("EDITSPELL" & SEP_CHAR & EditorIndex & SEP_CHAR & END_CHAR)
    End If


Now go into Private Sub cmdCanel_Click() and add:
    InMineEditor = False


Make sure its after the End Sub. Ok, now go into frmMapEditor and add a new option button in the attributes section and call it optMine. Double click optMine and enter in this code:
    frmMineChooser.Show vbModal


Thats all for the mapeditor.. Lets move on.. Now to make the basic Mine Chooser.. Ok, this is basically exactly the same as the Sign Choose from my previous tutorial.. Ok, make a new form called frmMineChooser and add a horizontal scrollbar called scrlMineNum, a label called lblMineNum, and two command buttoms called cmdOk and cmdCancel.. Now get into the forms coding and add this:
Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOk_Click()
    MineNum = scrlMineNum.Value
    Unload Me
End Sub

Private Sub scrlMineNum_Change()
    lblMineNum.Caption = STR(scrlMineNum.Value)
End Sub


Ok, for the Mine Editor, we need.. one textbox called txtMineName, three i repeat three, combo boxes called: cmbClassReq, and cmbItem.. Now we also need two horizontal scroll bars, called: scrlLevelReq, and scrlMaxLevel. Check the spellings to make sure they match up with code later on..

Now, go into the coding and add this:
Private Sub cmdCancel_Click()
    Call MineEditorCancel
End Sub

Private Sub cmdOk_Click()
    Call MineEditorOk
End Sub


Ok go into modClientTCP and at the bottom of that module, add these subs:
Sub SendRequestEditMine()
Dim Packet As String

    Packet = "REQUESTEDITMINE" & SEP_CHAR & END_CHAR
    Call SendData(Packet)
End Sub

Public Sub SendSaveMine(ByVal MineNum As Long)
Dim Packet As String

    With Mine(MineNum)
        Packet = "SAVEMINE" & SEP_CHAR & MineNum & SEP_CHAR & Trim(.Name) & SEP_CHAR & .ClassReq & SEP_CHAR & .LevelReq & SEP_CHAR & .MaxLevel & SEP_CHAR & .Item & SEP_CHAR & END_CHAR
    End With
   
    Call SendData(Packet)
End Sub


Now, go into the modConstants and find:
Public Const MAX_TRADES = 10


And add below that:
Public Const MAX_MINES = 255


Alrighty, now go into modGameLogic and find:
Public Sub GameLoop()


Now, scroll down and find:
If .Type = TILE_TYPE_KEYOPEN Then Call DrawText(TexthDC, x * PIC_X + 8, y * PIC_Y + 8, "O", QBColor(White))


Right under that add:
If .Type = TILE_TYPE_MINE Then Call DrawText(TexthDC, x * PIC_X + 8, y * PIC_Y + 8, "M", QBColor(White))


Okay, now find:
Sub HandleKeypresses(ByVal KeyAscii As Integer)


Now, scroll down and find:
        ' // Mapper Admin Commands //


Okay, you gotta scroll down a bit more till you find:
             ' Banning a player
             If LCase(Mid(MyText, 1, 4)) = "/ban" Then
                 If Len(MyText) > 5 Then
                     MyText = Mid(MyText, 6, Len(MyText) - 5)
                     Call SendBan(MyText)
                     MyText = ""
                 End If
                 Exit Sub
             End If


And add right below that (Oh, please be sure to nest it properly so it is inside the beginning if statement):
' Editing mine request
If Mid(MyText, 1, 10) = "/editmine" Then
    Call SendRequestEditMine
    MyText = ""
    Exit Sub
End If


Ok, now find:
Public Sub CheckAttack()


And add at the end of the sub:
    'Mining
    Dim MinePacket As String
    If ControlDown = True And Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Type = TILE_TYPE_MINE Then
        MineNum = Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Data1
        MinePacket = "requestmine" & SEP_CHAR & MineNum & SEP_CHAR & END_CHAR
        Call SendData(MinePacket)
    End If


God, im getting tired.. Arghh, i cant believe im even making this tutorial.. Anyway, i must finish.. I Planned to do this, so im going to do it.. Alrighty, find:
Public Sub EditorMouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)


Scroll down and find:
                     If frmMapEditor.optKeyOpen.Value = True Then
                           .Type = TILE_TYPE_KEYOPEN
                           .Data1 = KeyOpenEditorX
                           .Data2 = KeyOpenEditorY
                           .Data3 = 0
                     End If


And add right below it, making sure its in the End With, and nested nicely this:
                     If frmMapEditor.optMine.Value = True Then
                           .Type = TILE_TYPE_MINE
                           .Data1 = MineNum
                           .Data2 = 0
                           .Data3 = 0
                     End If


Arghh.. Fingers hurting, but i must peddle on.. Okie, dokie.. at the bottom of this module, which should be modGameLogic add:
Public Sub MineEditorInit()
Dim a As Long
Dim b As Long

    frmMineEditor.cmbClassReq.AddItem "All Classes"
    For a = 0 To Max_Classes
        frmMineEditor.cmbClassReq.AddItem Trim(Class(a).Name)
    Next a
   
    frmMineEditor.txtMineName.Text = Trim(Mine(EditorIndex).Name)
    frmMineEditor.cmbClassReq.ListIndex = Mine(EditorIndex).ClassReq

    If Mine(EditorIndex).LevelReq = 0 Then
        frmMineEditor.scrlLevelReq.Value = 1
    Else
        frmMineEditor.scrlLevelReq.Value = Mine(EditorIndex).LevelReq
    End If

    If Mine(EditorIndex).MaxLevel = 0 Then
        frmMineEditor.scrlMaxLevel.Value = 1
    Else
        frmMineEditor.scrlMaxLevel.Value = Mine(EditorIndex).MaxLevel
    End If
   
    For b = 1 To MAX_ITEMS
        frmMineEditor.cmbItem.AddItem b & ": " & Trim(Item(b).Name)
    Next b

    frmMineEditor.Show vbModal
End Sub

Public Sub MineEditorOk()
    Mine(EditorIndex).Name = frmMineEditor.txtMineName.Text
    Mine(EditorIndex).ClassReq = frmMineEditor.cmbClassReq.ListIndex
    Mine(EditorIndex).LevelReq = frmMineEditor.scrlLevelReq.Value
    Mine(EditorIndex).MaxLevel = frmMineEditor.scrlMaxLevel.Value
    Mine(EditorIndex).Item = frmMineEditor.cmbItem.ListIndex + 1
   
    Call SendSaveMine(EditorIndex)
    InMineEditor = False
    Unload frmMineEditor
End Sub

Public Sub MineEditorCancel()
    InMineEditor = False
    Unload frmMineEditor
End Sub


Alrighty, now go into modGlobals and find:
' Used for map key opene ditor
Public KeyOpenEditorX As Long
Public KeyOpenEditorY As Long


Now add right below it:
' Used for map mine editor
Public MineNum As Integer


Right, now find:
Public EditorIndex As Long


And add straight below that:
Public InMineEditor As Boolean


Now find:
Public Spell(1 To MAX_SPELLS) As SpellRec


And add below that:
Public Mine(1 To MAX_MINES) As MineRec


Now, go into modHandleData, yes we're almost done.. Arghh this is my last tutorial, i swear.. Arghh.. Ok, go into modHandleData and at the bottom of that module, but before the end sub add:
    ' ::::::::::::::::::::::::
    ' :: Mine editor packet ::
    ' ::::::::::::::::::::::::
    If (LCase(Parse(0)) = "mineeditor") Then
        InMineEditor = True
       
        frmIndex.Show
        frmIndex.lstIndex.Clear
       
        ' Add the names
        For i = 1 To MAX_MINES
             frmIndex.lstIndex.AddItem i & ": " & Trim(Mine(i).Name)
        Next i
       
        frmIndex.lstIndex.ListIndex = 0
        Exit Sub
    End If
   
    ' ::::::::::::::::::::::::
    ' :: Update mine packet ::
    ' ::::::::::::::::::::::::
    If (LCase(Parse(0)) = "updatemine") Then
        n = Val(Parse(1))
       
        ' Update the mine name
        Mine(n).Name = Trim(Parse(2))
        Exit Sub
    End If
   
    ' ::::::::::::::::::::::
    ' :: Edit mine packet :: <- Used for mine editor admins only
    ' ::::::::::::::::::::::
    If (LCase(Parse(0)) = "editmine") Then
        n = Val(Parse(1))
       
        ' Update the mine
        Mine(n).Name = Trim(Parse(2))
        Mine(n).ClassReq = Val(Parse(3))
        Mine(n).LevelReq = Val(Parse(4))
        Mine(n).Maxlevel = Val(Parse(5))
        Mine(n).Item = Val(Parse(6))
                          
        ' Initialize the mine editor
        Call MineEditorInit
        Exit Sub
    End If


Woohoo, nearly there.. Go into modTypes, and add this:
Type MineRec
    Name As String * NAME_LENGTH
    ClassReq As Byte
    LevelReq As Byte
    MaxLevel As Byte
    Item As Byte
End Type


Lets just hope you know where.. Im too tired to type anymore.. Anyway, if you went through this tutorial properly, you should now have a nice and simple mining system.. I'm planning on making another tutorial, a cooking tutorial.. Where you combine two items to become one.. It will be very similar to this, with a few adjustments.. Im too tired right now, but i'll work on it later.. Enjoy guys!!

Oh yeah, i have yet to add in the class requirement, although that is not too hard to accomplish.. Go into the server side, and look for the CanPlayerMine sub, and just make a basic if statement before the level req check.. ;)



Replies:
Posted By: Sync
Date Posted: 07 February 2006 at 5:50pm
Approved .. fricken'a, thats a nice post.



Posted By: Da Undead
Date Posted: 04 March 2006 at 9:29pm

Im not sure if this helps but i found this when over looking it...

Sub CheckMines()
    If Not FileExist("data\mines.ini") Then
        Call SaveMines
    End If
End Sub

 

Should that be

 

Sub CheckMines()
    If Not FileExist("\data\mines.ini") Then
        Call SaveMines
    End If
End Sub

 

???



Posted By: lil n00b
Date Posted: 04 March 2006 at 9:46pm
yes, thier should be a \


Posted By: Da Undead
Date Posted: 04 March 2006 at 10:48pm

[quote]three i repeat three, combo boxes called: cmbClassReq, and cmbItem.. [/qupte]

Theres only 2 names for it :(



Posted By: Da Undead
Date Posted: 04 March 2006 at 10:53pm

REDUE THIS WHOLE PART!!!

 

Ok, for the Mine Editor, we need.. one textbox called txtMineName, three i repeat three, combo boxes called: cmbClassReq, and cmbItem.. Now we also need two horizontal scroll bars, called: scrlLevelReq, and scrlMaxLevel. Check the spellings to make sure they match up with code later on..

Code:
Now, go into the coding and add this:
Private Sub cmdCancel_Click()
    Call MineEditorCancel
End Sub

Private Sub cmdOk_Click()
    Call MineEditorOk
End Sub

 

Makes no sence at all >_>



Posted By: Johnman
Date Posted: 05 March 2006 at 5:59pm
Okay, obviously, with the "three I repeat three" part, that was a little screwed up, but you should be able to figure out that you only need two.

Also
When you said.

Sub CheckMines()
    If Not FileExist("data\mines.ini") Then
        Call SaveMines
    End If
End Sub

 

Should that be

 

Sub CheckMines()
    If Not FileExist("\data\mines.ini") Then
        Call SaveMines
    End If
End Sub



the \ shouldn't matter, unless that was changed in FileExist (I haven't looked at MSE, not sure why either).


Posted By: Dark Echo
Date Posted: 06 March 2006 at 9:14pm
Yeah sorry guys, its supposed to be two combo boxes.. I was writing another tutorial at the time if writing this, so there might be a few typos.. Sorry about that..

-------------


Posted By: Da Undead
Date Posted: 08 March 2006 at 3:13pm
ok on Mine Editor, do u mean make a new form called frmMineEditor? If so, thats what i did... Don't wanna go on if thats not wat im suppose to do..


Posted By: Misunderstood
Date Posted: 08 March 2006 at 4:26pm
well since frmMineEditor is in the tut a lot, why would you need to make a form called frmMineEditor that just doesnt make sense I mean, its not like it uses frmMineEditor or anything...


Posted By: Da Undead
Date Posted: 08 March 2006 at 5:06pm
ok... So just add the buttons for frmMineEditor into the frmMineChooser?


Posted By: Da Undead
Date Posted: 08 March 2006 at 5:13pm
It says Exspected Array for the word 'Mine'... WHY?!?!?


Posted By: Da Undead
Date Posted: 08 March 2006 at 5:32pm

'Mining
    Dim MinePacket As String
    If ControlDown = True And Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Type = TILE_TYPE_MINE Then
        MineNum = Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Data1
        MinePacket = "requestmine" & SEP_CHAR & MineNum & SEP_CHAR & END_CHAR
        Call SendData(MinePacket)
    End If

 

Highlights the word Map in it... WHY CAN'T I GET THIS TUT TO WORK!?!?!



Posted By: Matt
Date Posted: 08 March 2006 at 5:40pm
Sync... Where's my mining tut. I'd kinda like... need it cause I lost mine...


-------------
"This nightmare wont last long. Are you scared? So sing this song. I'm right there, by your side. Tonight we've got a chance." - Aiden, The Last Sunrise
I love you, Mikaela


Posted By: Da Undead
Date Posted: 08 March 2006 at 5:45pm
dang that sucks.. I rather use urs Matt, Dark Echo's is to freaking buggy


Posted By: Misunderstood
Date Posted: 08 March 2006 at 5:49pm
you say it expects the array 'mine'
yet you say it highlights the word map?

dont post your stupid errors if you cant even report the error correctly.
Im just really tired of this...

And if they were different errors, say you fixed the first one and tell us the message for the current one.


Posted By: Obsidian
Date Posted: 08 March 2006 at 10:53pm
it highlights map because you redimmed your maps. they're not static anymore.

well... based on your post i'm assuming someone did it for you. just change it to

Map(GetPlayerMap(MyIndex))


Posted By: Dark Echo
Date Posted: 09 March 2006 at 4:40am
I believe Matt's tutorial is in the Tempoary Archieves, look in there.. Also, there has to be a mine editor, as that is how you make your mines for your game.. Read above, i clearly explained what code you need for the mine editor..

EDITED: Ok, i couldnt find matt's tute.. Sorry for false info..


-------------


Posted By: Misunderstood
Date Posted: 09 March 2006 at 1:56pm
I believe Matt's tutorial is in the Tempoary Archieves, look in there.. Also, there has to be a mine editor, as that is how you make your mines for your game.. Read above, i clearly explained what code you need for the mine editor..


If you were talking about my post, I was being sarcastic about not needing one, just wanted to make that clear.


Posted By: Da Undead
Date Posted: 09 March 2006 at 2:34pm

so its frmMineEditor ???

I got all the bug fixed now its just the letter won't show up when I try placing the tile *mine* from Attributes. PS: How do I get the classes in the combo box and the other thing thats needed...

Dark, if you have AIM, i can ask question's there...

AIM: Krazyman46



Posted By: Obsidian
Date Posted: 09 March 2006 at 7:27pm
Search through your client Search code for "B", you'll find the map editor code for the other tiles, just adjust it accordingly for mining.

To add classes to the combo box... you need to send the numbers of the classes in a packet then, when the packet is recieved (just before the form loads) you need to do a

frmEditMining.cmbClasses.Clear

For i = 1 to max_classes
   frmEditMining.cmbClasses.AddItem i & ": " & Class(i).Name
next i

Or whatever your mining form is called.



Posted By: Dark Echo
Date Posted: 10 March 2006 at 1:21am
Ahh, i was wondering if you were being sarcastic or not.. Hmm I guess i was wrong.. 

Anyway, Da Undead this is the code you need to display the M letter on the map.. The mining attribute..
If .Type = TILE_TYPE_MINE Then Call DrawText(TexthDC, x * PIC_X + 8, y * PIC_Y + 8, "M", QBColor(White))


And this is the code for showing classes in the combo box..

    frmMineEditor.cmbClassReq.AddItem "All Classes"
    For a = 0 To Max_Classes
        frmMineEditor.cmbClassReq.AddItem Trim(Class(a).Name)
    Next a


both of those are in the tutorial.. If your classes do not show, check to make sure the classes are being sent from the server side.. They should already be sent regardless.. Unless you edited that particular section of your source..


-------------


Posted By: Da Undead
Date Posted: 14 March 2006 at 11:22am

Okay, I tried to do..

/editmine

And then I clicked OK to add a mine and then it had a debug message come up.

I clicked debug and it gave me this..

        frmMainMenu.Visible = True



Posted By: Renegade
Date Posted: 14 March 2006 at 11:25am

Maybe FrmMailMenu isnt there?

What error number?



-------------
Eternia online, Coming soon to a movie i mean computer near you!


Posted By: Da Undead
Date Posted: 15 March 2006 at 9:55am

It just had debug, end on it...

IDK what the error was..

 

I clicked Debug and it highlighted that line o_O.



Posted By: Renegade
Date Posted: 16 March 2006 at 5:30am

FFS You need to tell us let me dumb this down.

Da undead: Hey i need some help
Renegade: what with
Da undead: OMFG HELP ME IM UBER NOOB HA4OR
Ms Community: TELL US THE ERROR!!!
Da Undead: I dunno what the error is but please help!

We thats what weve been tryin to do! work it out for once i just got my source back from funky but i tried for 3 days to fix it myself SIT AND STARE AT THE SOURCE!!! It will help! or sleep on it ffs11111!!1111



-------------
Eternia online, Coming soon to a movie i mean computer near you!


Posted By: Obsidian
Date Posted: 16 March 2006 at 10:37am
maybe you should be opening frmIndex or frmMiningEditor instead of main menu...


Posted By: Da Undead
Date Posted: 16 March 2006 at 5:23pm

lol renegade, ur an ass



Posted By: Obsidian
Date Posted: 16 March 2006 at 5:41pm
He's not being an ass. He's been trying to explain this to you for a while.

You cannot simply copy/paste this into your code and expect it to work. You need to study the code, and i recommend typing it all by hand. This way, you better understand the code you're using, and you're overall understanding of the VB syntax improves.

i'll go ahead and explain this to you right now. just a quick lesson.

frmMainMenu (if you open it, obviously it's the main menu before the game starts), so if that is being called like this

frmMainMenu.Show
frmMainMenu.visible = true

that shouldnt be there, should it? when you mine you have no reason to have that. So you can either comment it out (to comment something out, use an apostrophe before the code... ex.

' frmMainMenu.visible = true) or you can just delete it. Just try to understand the code itself a little better before you ask simple, explanation (or i call them "duh") questions. People tend to yell less if you do more on your own.



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info