Ariel Posted June 15, 2012 Author Share Posted June 15, 2012 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 Suberrorhandler: HandleError "DrawBuffIcon", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd 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 clsBufferDim 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 Suberrorhandler: HandleError "HandleBuffInfo", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub```![](http://i.imgur.com/Rsq9K.gif)How should i do it Right?Thanks. Link to comment Share on other sites More sharing options...
Stein Posted June 15, 2012 Share Posted June 15, 2012 You'll likely need to call it every loop if you want it drawn to the picscreen because it gets cleared every time the rendering sub restarts. Link to comment Share on other sites More sharing options...
Ariel Posted June 15, 2012 Author Share Posted June 15, 2012 Wait what?what do you mean? which loop? Link to comment Share on other sites More sharing options...
Stein Posted June 15, 2012 Share Posted June 15, 2012 In modDirectDraw8 or something similar there should be a render_graphics sub that gets called every cycle(loop) te game makes to ensure everything rendered onto picscreen gets updated and shown properly. Link to comment Share on other sites More sharing options...
Ariel Posted June 15, 2012 Author Share Posted June 15, 2012 Oh but its not a GUI i have some variables i need it to have :\so i cant call him there i have to call him from the handler (as far as i know\ understand) i guess its out of my league Link to comment Share on other sites More sharing options...
Stein Posted June 15, 2012 Share Posted June 15, 2012 Store the data in a UDT and use that data in your rendering sub. Link to comment Share on other sites More sharing options...
Ariel Posted June 15, 2012 Author Share Posted June 15, 2012 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 Suberrorhandler: HandleError "DrawBuffIcon", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub```and calling it on the Render thing Link to comment Share on other sites More sharing options...
The New World Posted June 15, 2012 Share Posted June 15, 2012 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 More sharing options...
Ariel Posted June 15, 2012 Author Share Posted June 15, 2012 does my code correct?after the drawGUI is fine right?Anyways many thanks i will try it now! Link to comment Share on other sites More sharing options...
Ariel Posted June 15, 2012 Author Share Posted June 15, 2012 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 Suberrorhandler: HandleError "DrawBuffIcon", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub``` Link to comment Share on other sites More sharing options...
JohnPony Posted June 15, 2012 Share Posted June 15, 2012 Look at the way this works:Do while IsConnected ' Call stuff hereLoopYou 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 itDo 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 Suberrorhandler: HandleError "DrawBuffIcon", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub``` Link to comment Share on other sites More sharing options...
Ariel Posted June 15, 2012 Author Share Posted June 15, 2012 Alright so Isbuffed should check whether the buff have a buff type larger then 0 ? Link to comment Share on other sites More sharing options...
JohnPony Posted June 15, 2012 Share Posted June 15, 2012 ```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 Functionerrorhandler: HandleError "IsConnected", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit FunctionEnd 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 More sharing options...
Ariel Posted June 15, 2012 Author Share Posted June 15, 2012 I meant in side the function it should check if a buff.type is more then 0 so true?else how do i check if a player have a buff ?:Z Link to comment Share on other sites More sharing options...
JohnPony Posted June 15, 2012 Share Posted June 15, 2012 @Ariel:> I meant in side the function it should check if a buff.type is more then 0 so true?Just have it send another packet that makes the buff enabled true, then call it. Link to comment Share on other sites More sharing options...
Ariel Posted June 15, 2012 Author Share Posted June 15, 2012 I think im giving up on this :Za 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 More sharing options...
tslusny Posted June 16, 2012 Share Posted June 16, 2012 If u dont make this, i will :cheesy: Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now