[Help] Using dim's from Public Functions

Posts 1–5 of 5 · Page 1 of 1
[Help] Using dim's from Public Functions
Hey guys, I never really used this method, but by using this method I think my projects won't be messy anymore.

So ok, I have this public function:
Code:
Public Function GeneralDims()
        Dim dGame As Long
        Dim MobDeadState As Long
        Dim MobId As Long
        Dim cHP As Long
        Dim cMP As Long
        dGame = ReadDLL("Game.dll")
        MobDeadState = "&H" + Hex(dGame + &Hoffset)
        MobId = "&H" + Hex(dGame + &Hoffset)
        cHP = "&H" + Hex(dGame + &Hoffset)
        cMP = "&H" + Hex(dGame + &Hoffset)
        Return dGame & MobDeadState & MobId & cHP
    End Function
I just screwed around with the return, i'm not that good at creating functions:P

So what I want is, not having to dim and set a value to the var. all over again.

I want to use it like this:
Code:
Private Sub TimerTarget_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerTarget.Tick
        GeneralDims()
        If MobDeadState = 1 Then
'do somthing
end if
    End Sub
But now it just errors me that the var is not declared.

Could somebody help me?
Thanks,
Apez.

If want to be credited, say so, you will be credited.
I am an idiot, so I must ask this
What does this do first of all??
ever thought of moving your dims outside the function? o__O

Code:
Dim dGame As Long
Dim MobDeadState As Long
Dim MobId As Long
Dim cHP As Long
Dim cMP As Long
Public Function GeneralDims()
        dGame = ReadDLL("Game.dll")
        MobDeadState = "&H" + Hex(dGame + &Hoffset)
        MobId = "&H" + Hex(dGame + &Hoffset)
        cHP = "&H" + Hex(dGame + &Hoffset)
        cMP = "&H" + Hex(dGame + &Hoffset)
        Return dGame & MobDeadState & MobId & cHP
End Function
Arnt you like a godly coder?
On topic:
dont you need a Dim Var as ..... to get it to work?
When you get an error saying "blank is not declared.", it means its well, not declared.
Quote Originally Posted by Iamazn1 View Post
Arnt you like a godly coder?
On topic:
dont you need a Dim Var as ..... to get it to work?
When you get an error saying "blank is not declared.", it means its well, not declared.
lol, ya I already fixed it by putting them in global.
Ty all.

Close.
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us