• Welcome to Valhalla Legends Archive.
 

Getstuff Code wrong?

Started by Dayclone, July 12, 2003, 11:38 AM

Previous topic - Next topic

Dayclone

hey when we try to make the .exe of our bot it says Compile Error: Can't find project or Library this is how were sending it.

Function GetStuff(appname As String, key As String) As String
Dim sFile As String
Dim sDefault As String
Dim lSize As Integer
Dim L As Long
Dim sUser As String
sUser = Space$(128)  ( Space$ it's highlighted grey )
lSize = Len(sUser)
sFile = App.Path & "\Config.ini"
sDefault = ""
L = GetPrivateProfileString(appname, key, sDefault, sUser, lSize, sFile)
sUser = Mid(sUser, 1, InStr(sUser, Chr(0)) - 1)
GetStuff = sUser
End Function



and this is how we sending the profile.

Function WriteStuff(appname As String, key As String, sString As String) As Boolean
Dim sFile As String
Dim L As Long
WriteStuff = False
On Error GoTo WriteStuff_Error
sFile = App.Path & "\Config.ini"
L = WritePrivateProfileString(appname, key, sString, sFile)
WriteStuff = True

WriteStuff_Error:
If Err.Number <> 0 Then
MsgBox Err.Description
End If
End Function


are we missing anything cause it works for other bots but this one dosen't seem to work.what's wrong please help

Thanks

UserLoser

Are you declaring GetPrivateProfileString & WritePrivateProfileString?

Dayclone

#2

Option Explicit
Declare Function GetPrivateProfileSection Lib "kernel32" Alias "GetPrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As Any, ByVal lpFileName As String) As Long
Declare Function WritePrivateProfileSection Lib "kernel32" Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpString As String, ByVal lpFileName As String) As Long


that's how were declaring it

Camel

Quote from: UserLoser on July 12, 2003, 03:01 PM
Are you declaring GetPrivateProfileString & WritePrivateProfileString?

How would that affect the existance of Space$()?
Dayclone, perhaps if you try to debug your bot without compiling an exe first you could have more context. You might try using Space() (the variant version) just to see if it works.

Dayclone

This is a tuffy we tried Space() Space$() Space(128) Space$(128)
and that's about all and still the same Error comes up.

Compile Error:
Can't find project or library

I think we need soem pros onto this like skywing/yoni/cuphead you know maybe if they know but in the mean time i'ma keep fooling around with this arragant code. Keep posting your suggestion ppl.

Grok

Quote from: Dayclone on July 14, 2003, 01:02 PM
This is a tuffy we tried Space() Space$() Space(128) Space$(128)
and that's about all and still the same Error comes up.

Compile Error:
Can't find project or library

I think we need soem pros onto this like skywing/yoni/cuphead you know maybe if they know but in the mean time i'ma keep fooling around with this arragant code. Keep posting your suggestion ppl.

Ah finally asking for a pro.  What's this about skywing/yoni/cuphead though?  I'll ignore it and pretend to be insulted.

You've screwed up your project references by deleting one of the VB required libraries, most likely VBA.  To test this, instead of just calling Space(128), try VBA.Space(128) and see if that works.

IF that works, you need to make sure to add "Visual Basic for Applications" back into your Project References.

</pro>

Camel

Oh bah, I thought I said that already so I didn't post it. I must have been confused with a different thread.

Grok

Quote from: Camel on July 14, 2003, 07:05 PM
Oh bah, I thought I said that already so I didn't post it. I must have been confused with a different thread.

Well yeh, duh, I had to delete yours first or I'd look like I was copying you.

:P

The Grok

CrAz3D

Quote from: Dayclone on July 12, 2003, 11:38 AM
hey when we try to make the .exe of our bot it says Compile Error: Can't find project or Library this is how were sending it.

and this is how we sending the profile.

What is it that you are sending?
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Dayclone

#9
errr WE CAN'T FORGET ABOUT GORK sorry Gork if i could i'll give you like +1 for forgetting you Sorry. I'll your suggestions but i gotta go to sleep it's like 1AM here lol


tackle this now when i go to my config this error pos up anyone know what it means?

Run-Time Error "35602"
Key is not unique in collection.

Soul Taker

'Gork' is quite helpful =P

Grok

Quote from: Dayclone on July 14, 2003, 11:57 PMtackle this now when i go to my config this error pos up anyone know what it means?

Run-Time Error "35602"
Key is not unique in collection.

I'm going to take a wild ass guess and say this means "Key is not unique in collection."  What do I win?

Something in your code is attempting to populate a collection with a new Item.  The new Item's "Key" value conflicts with an existing item's "Key" value.  The whole point of the Key is having unique values.

Solution:  Change the value of the new Item's "Key" to a unique value for the collection in which it is being added.

Camel

Can't you have it auto-assign a value (I'm thinking somewhat similar to how most SQL databases can autoassign id numbers)?

Grok

Quote from: Camel on July 15, 2003, 04:12 PM
Can't you have it auto-assign a value (I'm thinking somewhat similar to how most SQL databases can autoassign id numbers)?

Not like you're asking.  However, you can remember the last key value and just increment it.

Dayclone

#14
One prob I GOT NO CLUE WHAT YOUR TALKING ABOUT :(
Quote
I'm going to take a wild ass guess and say this means "Key is not unique in collection."  What do I win?

Something in your code is attempting to populate a collection with a new Item.  The new Item's "Key" value conflicts with an existing item's "Key" value.  The whole point of the Key is having unique values.

Solution:  Change the value of the new Item's "Key" to a unique value for the collection in which it is being added.

exactly how would i do this .... i'm starting to get sick and tired of doing this bot and i want answer just thrown at me :)