Valhalla Legends Forums Archive | Battle.net Bot Development | Getstuff Code wrong?

AuthorMessageTime
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.
[code]
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 [/code]


and this is how we sending the profile.
[code]
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[/code]

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

Thanks
July 12, 2003, 4:38 PM
UserLoser
Are you declaring GetPrivateProfileString & WritePrivateProfileString?
July 12, 2003, 8:01 PM
Dayclone
[code]
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
[/code]

that's how were declaring it
July 13, 2003, 6:40 PM
Camel
[quote author=UserLoser link=board=17;threadid=1883;start=0#msg14596 date=1058040088]
Are you declaring GetPrivateProfileString & WritePrivateProfileString?
[/quote]

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.
July 13, 2003, 11:01 PM
Dayclone
This is a tuffy we tried [code]Space() Space$() Space(128) Space$(128)[/code]
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.
July 14, 2003, 6:02 PM
Grok
[quote author=Dayclone link=board=17;threadid=1883;start=0#msg14801 date=1058205763]
This is a tuffy we tried [code]Space() Space$() Space(128) Space$(128)[/code]
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.
[/quote]

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>
July 14, 2003, 8:51 PM
Camel
Oh bah, I thought I said that already so I didn't post it. I must have been confused with a different thread.
July 15, 2003, 12:05 AM
Grok
[quote author=Camel link=board=17;threadid=1883;start=0#msg14834 date=1058227537]
Oh bah, I thought I said that already so I didn't post it. I must have been confused with a different thread.
[/quote]

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

:P

The Grok
July 15, 2003, 12:50 AM
CrAz3D
[quote author=Dayclone link=board=17;threadid=1883;start=0#msg14588 date=1058027893]
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.

[/quote]
What is it that you are sending?
July 15, 2003, 1:41 AM
Dayclone
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.
July 15, 2003, 4:57 AM
Soul Taker
'Gork' is quite helpful =P
July 15, 2003, 5:44 AM
Grok
[quote author=Dayclone link=board=17;threadid=1883;start=0#msg14860 date=1058245028]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.
[/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.
July 15, 2003, 5:57 AM
Camel
Can't you have it auto-assign a value (I'm thinking somewhat similar to how most SQL databases can autoassign id numbers)?
July 15, 2003, 9:12 PM
Grok
[quote author=Camel link=board=17;threadid=1883;start=0#msg14909 date=1058303530]
Can't you have it auto-assign a value (I'm thinking somewhat similar to how most SQL databases can autoassign id numbers)?
[/quote]

Not like you're asking. However, you can remember the last key value and just increment it.
July 15, 2003, 9:43 PM
Dayclone
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. [/quote]

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 :)
July 16, 2003, 12:35 AM
Camel
[quote author=Dayclone link=board=17;threadid=1883;start=0#msg14931 date=1058315745]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 :)[/quote]

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.
July 16, 2003, 12:44 AM
Grok
[quote author=Dayclone link=board=17;threadid=1883;start=0#msg14931 date=1058315745]
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 :)
[/quote]

Very well. As you wish.

The following code is tested and works.
[code]
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
[/code]

Hope this helps as much as I think it will.
July 16, 2003, 1:37 AM
Dayclone
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
[code]
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
[/code]


ok now next newbie question where do i put this lol
July 16, 2003, 2:32 AM
Camel
[quote author=Dayclone link=board=17;threadid=1883;start=15#msg14946 date=1058322729]
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.[/quote]

I'm sure this Gork person you speak of is glad to help.
July 16, 2003, 6:44 AM
Dayclone
hehehe i got everything to work thank-you guys whoops i ment Grok
July 16, 2003, 3:49 PM

Search