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

Good Place to put this code?


gdog12356
 Share

Recommended Posts

Hello, i was thinking of using a timer for checking the stamina, but it blinks(i guess because it is not set checking constantly.) This is my code for the stamina bar:```
frmMain.imgStaminaBar.width = ((lblStam.Caption / frmMain.imgStaminaBar.width) / frmMain.imgStaminaBar.width) * frmMain.imgStaminaBar.width
```
where would i put this? Would i have to call some sort of function that i define with a timer? Like, a timer that checks every 5 seconds, and send the function "setplayerstam" Can someone help me? :D. Thnx
Link to comment
Share on other sites

What exactly is the purpose of this? This won't fix your HP regenerating in blinks, as you call it.. This will just add more useless processing, as your HP bar already gets updated as soon as new data for it is received.
Link to comment
Share on other sites

@Yami:

> What exactly is the purpose of this? This won't fix your HP regenerating in blinks, as you call it.. This will just add more useless processing, as your HP bar already gets updated as soon as new data for it is received.

no, i made a new bar for stamina. Like running depletes your stamina.
Link to comment
Share on other sites

So you are setting the width of an image depending on the caption of a label? o_o

Edit it to something like this (this is pseudocode btw):

```
frmMain.imgStaminaBar.width = (Current Stamina / Maximum Stamina) * Maximum Viewed Length of imgStaminaBar
```
You would need to place this code wherever the stamina changes client-side, mainly when the player first logs in and whenever stamina is reduced or increased.

Hope this helps,

Lightning
Link to comment
Share on other sites

Warning - while you were typing a new reply has been posted. You may wish to review your post.

oh, so i should make the stamina a player type? Thnx, this helped im out to play around now, thnx :).

@Hamster:

> I dunno about you, but I'd just stick it in CheckMovement. It's something that updates as you walk :D

when i do that it still blinks, i need something that is constantly checking, or i need to define it as the max width of the img and than change it accordingly with some code >_>… if only i knew how to do that xD.
Link to comment
Share on other sites

Ah, I really did misunderstand.. How did you implent this stamina system then? Server side? Client Side? And where did you add it into, if it's tossed into the server side movement system, just toss that code in the bit where you receive the new stamina values  from the server.
Link to comment
Share on other sites

@Yami:

> Ah, I really did misunderstand.. How did you implent this stamina system then? Server side? Client Side? And where did you add it into, if it's tossed into the server side movement system, just toss that code in the bit where you receive the new stamina values  from the server.

It's purely client side.
Link to comment
Share on other sites

@Yami:

> Ah, I really did misunderstand.. How did you implent this stamina system then? Server side? Client Side? And where did you add it into, if it's tossed into the server side movement system, just toss that code in the bit where you receive the new stamina values  from the server.

also it isnt values it is a timer, that changes movement type when a value is reached,just look at his tutorial.
>! http://www.touchofdeathforums.com/smf/index.php/topic,72169.msg774798.html#msg774798
Link to comment
Share on other sites

… I'm just going to say that is one lazy ass/poor way to add it. Anyways..

```
If frmMain.lblStam.Caption = "0" Then
            Player(MyIndex).Moving = MOVING_WALKING
        Else
            frmMain.lblStam.Caption = Val(frmMain.lblStam) - 1
                End If
```In that code, where it's deducting the stamina.. Add it there, whenever it deducts it'll update.. And do the same where it regenerates. :)
Link to comment
Share on other sites

Have you tried blatantly copying the way your health/mana bars are handled? Those don't blink/flash on my screen. :) Unless you're already doing this, in which case it's likely something on your PC messing it up.. Or something resetting the value in an instant for some odd reason.
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...