mob/Stat()
stat("Health",HP)
statpanel("Inventory",contents)
thats my code for my stat panel. How do i make it so that when you lose HP, it shows up on the stat panel?
ID:151057
![]() May 26 2001, 1:40 pm
|
|
thats my code for my stat panel. How do i make it so that when you lose HP, it shows up on the stat panel? As Deadron said, statpanels update automatically (every 0.8 seconds, to be precise). But, you're not displaying the health in a panel. You're adding it to whatever panel is currently open, which might cause an AddStat bug, I believe. Your code should be: mob/Stat() statpanel("Stats") //change to "Stats" panel stat("Health",HP) //add HP readout to "Stats" panel statpanel("Inventory",contents) //change to "Inventory" panel and display "contents" list inside it The comments describe the behaviour of statpanels. My FAQ entry, not yet available, has been included: Whenever you have code that is hard to read, or if you have code that does something different than what it would look like at a very shallow glance, you need to add a comment. Likewise, if you do not understand the code you are using, put comments in to let yourself and others know that you aren't too sure. Normally, you would not put comments that explain what the code does. Instead, when you put comments into code, you try to explain what that code is going to be used to do. ---------- Examples: mob.HP -= 5 //subtract 5 from mob's HP That example is a bad comment. We can already tell that it subtracts 5 from the mob's HP var. What we would like to know is WHY it subtracts those 5 HP. mob.HP -= 5 //usr is damaged from spell, so subtract 5 HP That is a good comment, because it explains why you are using that code. The person reading the code knows (or should know) that it is subtracting 5 HP from the mob. What they need explained is the reason to subtract 5 HP, and it is given. ---------- Don't add comments needlessly, either. If you think that someone can easily determine what a verb or proc does, no comments are necessary. For example: world << "[usr.name] says, \"[T]\"" This line is fairly self-explanatory. Always, always, always use comments if you don't understand it when you implement it, though! This aids you immensely if that code has an error, and it helps us immensely if you send us the code to debug. |
Should happen automatically. The stat panel is refreshed about once a second and will pick up HP changes.