Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Genusis's questions/help page.
#1
Ok well since I really do not want to create a whole bunch of different topics I decided to make one topic in this area for all my problems and for all the help I give to.Well my first problem is about binary stuff. Since I have not been coding in a while I forgot somethings. So ok here it is.

Code:
Sub SaveShop(ByVal ShopNum As Long)
Dim FileName As String
Dim f As Long

    FileName = App.Path & "\data\shops.bin"
        
    f = FreeFile
    Open FileName For Binary As #f
        Put #f, , Shop(ShopNum)
    Close #f
End Sub

Is this the rigth way or is the one below.

Code:
Sub SaveShop()
Dim FileName As String
Dim f As Long

    FileName = App.Path & "\data\shops.bin"
        
    f = FreeFile
    Open FileName For Binary As #f
        Put #f, , Shop(index)
    Close #f
End Sub

I think anyone who helps me with my problems. So I Thank You All For Your Help.

*Your friend*
Genusis
Reply
#2
The bottom one has a variable Index which isnt declared as anything. That will give you a error. The above one will work just fine from what I can see. There is a tutorial for this in the Optimization Tutorial board.
Reply
#3
Thanks for your help on that I could not decide what was what and which one was the right way of doing it since the tut did not specify what to do with that exactly. well my other problem is how would I do it with something that uses x, and y perimeters.

Code:
Sub LoadShops()
On Error Resume Next

Dim FileName As String
Dim x As Long, y As Long

    Call CheckShops
    
    FileName = App.Path & "\data\shops.ini"
    
    For y = 1 To MAX_SHOPS
        Shop(y).name = GetVar(FileName, "SHOP" & y, "Name")
        Shop(y).JoinSay = GetVar(FileName, "SHOP" & y, "JoinSay")
        Shop(y).LeaveSay = GetVar(FileName, "SHOP" & y, "LeaveSay")
        Shop(y).FixesItems = GetVar(FileName, "SHOP" & y, "FixesItems")
        
        For x = 1 To MAX_TRADES
            Shop(y).TradeItem(x).GiveItem = GetVar(FileName, "SHOP" & y, "GiveItem" & x)
            Shop(y).TradeItem(x).GiveValue = GetVar(FileName, "SHOP" & y, "GiveValue" & x)
            Shop(y).TradeItem(x).GetItem = GetVar(FileName, "SHOP" & y, "GetItem" & x)
            Shop(y).TradeItem(x).GetValue = GetVar(FileName, "SHOP" & y, "GetValue" & x)
        Next x
    
        DoEvents
    Next y
End Sub

Like the one above. Thanks for your help William. since I know you will probably be the one helping with this one to.
Reply
#4
Something like this I think:
Code:
Sub LoadShops()
Dim FileName As String
Dim i As Long, f As Long

    Call CheckShops
    
    For i = 1 To MAX_SHOPS
        FileName = App.Path & "\shops\shop" & i & ".dat"
        f = FreeFile
        Open FileName For Binary As #f
            Get #f, , Shop(i)
        Close #f
        
        DoEvents
    Next i
End Sub
Reply
#5
Code:
Open FileName For Binary As #f
Is making it throw a runtime error 76 path not found. what am i missing or did you do something wrong.
Reply
#6
Do you have the shops folder with your shops in it?

FileName = App.Path & "\shops\shop" & i & ".dat"

Cause that's what filename equals.
Reply
#7
oops sorry guys I forgot to tell you I got it lol. Thanks though.
Reply
#8
Hi guys its me with another question. How or where is the tutorial to convert Elysium stuff to mirage source stuff. I know there use to be one. if you don't know where can you at least help me out thanks.

Your neighborhood spider man Genusis lol.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)