ID:267018
 
Hi, i wana know how to make it so that on the statpanel, where your health number is, it shows a picture. Its ike a coloured bar. Full health is green, low health is red, middle is orange. As your health goes down it decreases. Please dont give me a website or a demo to try out. Ive looked at all of them and some of them have arrors. Id just like to know the code, Thanks
The Conjuror wrote:
Hi, i wana know how to make it so that on the statpanel, where your health number is, it shows a picture. Its ike a coloured bar. Full health is green, low health is red, middle is orange. As your health goes down it decreases. Please dont give me a website or a demo to try out. Ive looked at all of them and some of them have arrors. Id just like to know the code, Thanks

Never ask for "the code"; there's no such thing.

The basic idea of what you need to do is this: Create an icon with numbered states from 0 to n, where n might be as high as 30. (Spuzzum's meter snippet uses 30, so my example will use that.) In the Stat() proc, call stat("Heading",meter_object) and it will show the icon.
obj/meter
icon='meter.dmi'
icon_state="0"
max_state=30
proc/Update(value,max_value)
icon_state="[round(min(1,max(0,value/max_value))*max_state,1)]"
suffix="[value]/[max_value]"
Lummox JR
In response to Lummox JR
Lummox JR wrote:
The Conjuror wrote:
Hi, i wana know how to make it so that on the statpanel, where your health number is, it shows a picture. Its ike a coloured bar. Full health is green, low health is red, middle is orange. As your health goes down it decreases. Please dont give me a website or a demo to try out. Ive looked at all of them and some of them have arrors. Id just like to know the code, Thanks

Never ask for "the code"; there's no such thing.

The basic idea of what you need to do is this: Create an icon with numbered states from 0 to n, where n might be as high as 30. (Spuzzum's meter snippet uses 30, so my example will use that.) In the Stat() proc, call stat("Heading",meter_object) and it will show the icon.
obj/meter
> icon='meter.dmi'
> icon_state="0"
> max_state=30
> proc/Update(value,max_value)
> icon_state="[round(min(1,max(0,value/max_value))*max_state,1)]"
> suffix="[value]/[max_value]"
Lummox JR

I tried it and it comes up with 2 errors that are max_state undefined var
In response to The Conjuror
The Conjuror wrote:
I tried it and it comes up with 2 errors that are max_state undefined var

Doh. Make that var/max_state=30.

Lummox JR
In response to Lummox JR
The two errors are gone, but one more poped up, im sorry to bug you again but the error is... meter_object undefined var.
In response to The Conjuror
The Conjuror wrote:
The two errors are gone, but one more poped up, im sorry to bug you again but the error is... meter_object undefined var.

Well duh... the name of the object and creating it and such is nothing I included in my snippet. The var doesn't exist because that one's yours to define. I didn't show you a complete set of code--only what would be needed to update the meter, and a rough idea of how to display it in the statpanel. The rest you can easily get from any of the existing demos.

Lummox JR
In response to Lummox JR
well, first of all, you dont have to rub it in my face, its my first time ever using snippets. I didnt have any coding other than what you gave me for snippets.If your not willing to help, then ok, but if you are please dont rub it in. This is newbie central after all. Anyways, i stil dont understand what to do, and not one of the demos can show you how to make snippets. Some of the demos you cant even see the coding, it just pops you into the game.
Thanks, The Conjuror
In response to The Conjuror
The Conjuror wrote:
well, first of all, you dont have to rub it in my face, its my first time ever using snippets. I didnt have any coding other than what you gave me for snippets.

That's not what you said in your first post. That post said you'd looked over the other demos and they weren't working out. So you obviously had something else to go on.

And you mean meters, not snippets. Snippets are pieces of code.

If your not willing to help, then ok, but if you are please dont rub it in. This is newbie central after all.

If I wasn't willing to help I wouldn't have posted at all. What I'm unwilling to do is spoon-feed you the entire set of code you need, especially now that it's clear all you're doing is pasting in code without bothering to understand it. What I showed you in the earlier post was nothing you couldn't have found in a demo.

Anyways, i stil dont understand what to do, and not one of the demos can show you how to make snippets.

At least one of the demos does show this, because I've seen Spuzzum's meter snippet. The code I showed you is very close to what he uses.

Lummox JR
In response to Lummox JR
I have seen spuzzums snippet as well, it only shows you what it does though, it doesnt give you the coding for it. It just pops you into the game. Sorry for bothering you, nevermind my problems. I am sorry.
In response to The Conjuror
The Conjuror wrote:
I have seen spuzzums snippet as well, it only shows you what it does though, it doesnt give you the coding for it. It just pops you into the game. Sorry for bothering you, nevermind my problems. I am sorry.

It does show you the code; I've seen it myself.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
The Conjuror wrote:
I have seen spuzzums snippet as well, it only shows you what it does though, it doesnt give you the coding for it. It just pops you into the game. Sorry for bothering you, nevermind my problems. I am sorry.

It does show you the code; I've seen it myself.

Lummox JR

Perhaps Conjurer is just running the demo and doesn't know how to look at the code?
In response to Deadron
no, im not stupid. When you run a demo, the coding pops up. Then you click, build, rune. And you can see the programm rune. When i click on spuzzums, it just runs the actual game
In response to The Conjuror
Go into your lib folder and look for it.
In response to The Conjuror
The Conjuror wrote:
no, im not stupid. When you run a demo, the coding pops up. Then you click, build, rune. And you can see the programm rune. When i click on spuzzums, it just runs the actual game

I wasn't trying to say you are stupid -- I was just pointing out a possible problem.

If I get time tonight, I'll download Spuzzum's demo and see what happens.