Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Dayclone on July 12, 2003, 11:38 AM

Title: Getstuff Code wrong?
Post by: 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.

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
Title: Re:Getstuff Code wrong?
Post by: UserLoser on July 12, 2003, 03:01 PM
Are you declaring GetPrivateProfileString & WritePrivateProfileString?
Title: Re:Getstuff Code wrong?
Post by: Dayclone on July 13, 2003, 01:40 PM

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
Title: Re:Getstuff Code wrong?
Post by: Camel on July 13, 2003, 06:01 PM
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.
Title: Re:Getstuff Code wrong?
Post by: 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.
Title: Re:Getstuff Code wrong?
Post by: Grok on July 14, 2003, 03:51 PM
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>
Title: Re:Getstuff Code wrong?
Post by: 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.
Title: Re:Getstuff Code wrong?
Post by: Grok on July 14, 2003, 07:50 PM
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
Title: Re:Getstuff Code wrong?
Post by: CrAz3D on July 14, 2003, 08:41 PM
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?
Title: Re:Getstuff Code wrong?
Post by: Dayclone on July 14, 2003, 11:57 PM
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.
Title: Re:Getstuff Code wrong?
Post by: Soul Taker on July 15, 2003, 12:44 AM
'Gork' is quite helpful =P
Title: Re:Getstuff Code wrong?
Post by: Grok on July 15, 2003, 12:57 AM
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.
Title: Re:Getstuff Code wrong?
Post by: 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)?
Title: Re:Getstuff Code wrong?
Post by: Grok on July 15, 2003, 04:43 PM
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.
Title: Re:Getstuff Code wrong?
Post by: Dayclone on July 15, 2003, 07:35 PM
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 :)
Title: Re:Getstuff Code wrong?
Post by: Camel on July 15, 2003, 07:44 PM
Quote from: Dayclone on July 15, 2003, 07:35 PMexactly 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 :)

Programming requires patience; if you cannot deal with this relatively simple problem, then perhaps programming is not for you.
Sometimes responses to your problem wont help. That's part of being in a community. If you dont like it, get out.
Title: Re:Getstuff Code wrong?
Post by: Grok on July 15, 2003, 08:37 PM
Quote from: Dayclone on July 15, 2003, 07:35 PM
One prob I GOT NO CLUE WHAT YOUR TALKING ABOUT :(

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 :)

Very well.  As you wish.

The following code is tested and works.

   On Error Resume Next
   Static strUniqueKey As String
   Dim lKeyVal As Long
   Dim strToAdd As String
   lKeyVal = Val(Split(strUniqueKey, "*")(1))
   lKeyVal = lKeyVal + 1
   strUniqueKey = "Key*" & lKeyVal
   strToAdd = strUniqueKey
   myCol.Add strToAdd, strUniqueKey


Hope this helps as much as I think it will.
Title: Re:Getstuff Code wrong?
Post by: Dayclone on July 15, 2003, 09:32 PM
Thnx Grok you been great help i guess the other lazy bums don't really like help ppl lol no offence or anything hrmm i've been wait like 3 weeks for help then i fianlly turn to Valhalla Legend :) and they help alot.

hrmm

On Error Resume Next
   Static strUniqueKey As String
   Dim lKeyVal As Long
   Dim strToAdd As String
   lKeyVal = Val(Split(strUniqueKey, "*")(1))
   lKeyVal = lKeyVal + 1
   strUniqueKey = "Key*" & lKeyVal
   strToAdd = strUniqueKey
   myCol.Add strToAdd, strUniqueKey



ok now next newbie question where do i put this lol
Title: Re:Getstuff Code wrong?
Post by: Camel on July 16, 2003, 01:44 AM
Quote from: Dayclone on July 15, 2003, 09:32 PM
Thnx Gork you been great help i guess the other lazy bums don't really like help ppl lol no offence or anything hrmm i've been wait like 3 weeks for help then i fianlly turn to Valhalla Legend :) and they help alot.

I'm sure this Gork person you speak of is glad to help.
Title: Re:Getstuff Code wrong?
Post by: Dayclone on July 16, 2003, 10:49 AM
hehehe i got everything to work thank-you guys whoops i ment Grok