Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

(CS:DE) Draw Spell icon on screen.


Ariel
 Share

Recommended Posts

I mange to Send and "AddText" the info of the buff inclouding the spell icon Buff Duration ETC…

I was able to Render things before i made some costum GUI but this one i just cant get the Icon to show up :/

this is the Draw sub:
```
Public Sub DrawBuffIcon(ByVal BuffNum As Long)
    Dim BuffDur As Long, BuffType As Long, BuffEffect As Long, SpellNum As Long, i As Long
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler
        ' check if we should be seeing it

            BuffDur = BuffInfo(BuffNum).Dur
            BuffType = BuffInfo(BuffNum).Type
            BuffEffect = BuffInfo(BuffNum).Effect
            SpellNum = BuffInfo(BuffNum).SpellNum

            RenderTexture Tex_Spellicon(Spell(BuffNum).Icon), 150, 150, 0, 0, 32, 32, 32, 32

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "DrawBuffIcon", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
and i call it on the Handle:
```
Private Sub HandleBuffInfo(ByVal index As Long, ByRef data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim BuffDur As Long, BuffType As Long, BuffEffect As Long, SpellNum As Long, Caster As Long, BuffNum As Long

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    Set Buffer = New clsBuffer

    Buffer.WriteBytes data()

    BuffDur = Buffer.ReadLong
    BuffType = Buffer.ReadLong
    BuffEffect = Buffer.ReadLong
    SpellNum = Buffer.ReadLong
    Caster = Buffer.ReadLong
    BuffNum = Buffer.ReadLong

    BuffInfo(BuffNum).Dur = BuffDur
    BuffInfo(BuffNum).Type = BuffType
    BuffInfo(BuffNum).Effect = BuffEffect
    BuffInfo(BuffNum).SpellNum = SpellNum

    [color]Call DrawBuffIcon(BuffNum)[/color]

    Set Buffer = Nothing

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "HandleBuffInfo", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
![](http://i.imgur.com/Rsq9K.gif)

How should i do it Right?
Thanks.
Link to comment
Share on other sites

Ok, ill go read about it :)

edit:
Im Storing it in a Rec already. (or i didnt get the UDT right isnt it the Types?)

Read the handler for a sec, do you think i need to do a loop to draw all 10?

that what i made:
```
Public Sub DrawBuffIcon()
    Dim BuffDur As Long, BuffType As Long, BuffEffect As Long, SpellNum As Long, i As Long
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler
        ' check if we should be seeing it

      For i = 1 To 10
            BuffDur = BuffInfo(i).Dur
            BuffType = BuffInfo(i).Type
            BuffEffect = BuffInfo(i).Effect
            SpellNum = BuffInfo(i).SpellNum

            RenderTexture Tex_Spellicon(Spell(i).Icon), 150 + i + 40, 150, 0, 0, 32, 32, 32, 32
        Next
    ' Error handler
    Exit Sub
errorhandler:
    HandleError "DrawBuffIcon", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

```
and calling it on the Render thing
Link to comment
Share on other sites

You're correct. Though to explain the render_graphics ..

The game is drawn at an FPS (frames per second) rate. This is how many times the game is redrawn in a mere second, so if your drawing routine is only called outside of this constant loop, then you won't ever catch a glimpse of it.

If you scroll through render_graphics you'll see things are rendered from the bottom up. Just find a nice place where you want this to be rendered and stick the drawing routine call in there. Voilà!
Link to comment
Share on other sites

Didnt get that to work :\

well i think that its not a handler Problem its on the draw sub.. i just cant point what it is :\
he get the right data its just not rendering it><

```
Public Sub DrawBuffIcon()
    Dim BuffDur As Long, BuffType As Long, BuffEffect As Long, spellnum As Long, i As Long
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler
        ' check if we should be seeing it

      For i = 1 To 10
      If not BuffInfo(i).Type = 0 Then
            BuffDur = BuffInfo(i).Dur
            BuffType = BuffInfo(i).Type
            BuffEffect = BuffInfo(i).Effect
            spellnum = BuffInfo(i).spellnum
            RenderTexture Tex_Spellicon(BuffInfo(i).spellnum), 100, 120, 0, 0, 32, 32, 32, 32
        End If
        Next
    ' Error handler
    Exit Sub
errorhandler:
    HandleError "DrawBuffIcon", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

```
Link to comment
Share on other sites

Look at the way this works:

Do while IsConnected
    ' Call stuff here

Loop

You could make a function to check if the player is buffed such as:

```
  Public Sub DrawBuffIcon()
    Dim BuffDur As Long, BuffType As Long, BuffEffect As Long, spellnum As Long, i As Long
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler
        ' check if we should be seeing it

Do while IsBuffed 
      For i = 1 To 10
      If not BuffInfo(i).Type = 0 Then
            BuffDur = BuffInfo(i).Dur
            BuffType = BuffInfo(i).Type
            BuffEffect = BuffInfo(i).Effect
            spellnum = BuffInfo(i).spellnum
            RenderTexture Tex_Spellicon(BuffInfo(i).spellnum), 100, 120, 0, 0, 32, 32, 32, 32
        End If
        Next

Loop
    ' Error handler
    Exit Sub
errorhandler:
    HandleError "DrawBuffIcon", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
Link to comment
Share on other sites

```
Function IsConnected() As Boolean
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If frmMain.Socket.state = sckConnected Then
        IsConnected = True
    End If

    ' Error handler
    Exit Function
errorhandler:
    HandleError "IsConnected", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Function
End Function
```
Look at how that works, it checks if the socket is connected, and if so returns as true. So make the same thing for the buff, if there is a buff active, return true.
Link to comment
Share on other sites

I think im giving up on this :Z

a player can have 10 buff active, how do i tell the client that he have and how do i tell him which that i dont know….. I can send the data i cant make it showup when he have a active buff Damit..
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...