var/gold=0 |
(Just a quick example)
But the compiler tells me I need a constant expression. Is there a way to have maptext output change based on a variable?
Being a novice programmer, I was trying to come up with a simple way to display a gold counter on screen. I tried to use maptext like so...
(Just a quick example) But the compiler tells me I need a constant expression. Is there a way to have maptext output change based on a variable? | ||
#2 Jul 14 2012, 2:54 am
|
|
Nope, it still gives me this...
HUD.dm:35:error: : expected a constant expression I was hoping for some sort of variable or workaround that would allow for map text to update based on a variable. | |
#3 Jul 14 2012, 3:00 am
|
|
Is that code example on line 35?
And what is locc ? | |
Yes the line with the maptext=gold is on 35. locc(location client) are the coordinates for the image on the client. The imagine being a background for the text to appear over.
| |
When you write maptext = gold or maptext = "[gold]" you're trying to say "maptext must always equal to gold", however DM doesn't support such feature. You'll need to change maptext value manually whenever gold changes.
| |
Would something like text2number, add the amount being picked up, and using number2text work?
| |
#7 Jul 14 2012, 3:58 am
|
|
Not best way, but it should work.
| |
#8 Jul 14 2012, 7:04 am
|
|
You can keep the gold variable a number. Whenever you update your maptext, just set it to "[gold]". Then you won't have to do any text2num().
| |
Albro1 wrote:
You can keep the gold variable a number. Whenever you update your maptext, just set it to "[gold]". Then you won't have to do any text2num(). Isn't that what I said :/ | |
I haven't explored maptext that much but it might be worth trying
On another not that gold variable doesn't belong to a client so it's a global variable.
It will still display a result though.