ID:142532
 
Code:
world
status = "<b><font color = blue>Zombie Wars:Host [host]</font></b>"


Problem description:Admin.dm:78:error::expected a constant expression

ShooterGame.dmb - 1 error, 0 warnings (double-click on an error to jump to it)



Everytime i try 2 put in other stuff like [players],[host],[cpu] i always get that error im not feeling so great atm so i don't really know how 2 fix it. Never really knew 2 much about that kind of stuff.
Magicbeast20 wrote:
Code:
world
> status = "<b><font color = blue>Zombie Wars:Host [host]</font></b>"
>

Problem description:Admin.dm:78:error::expected a constant expression

It says it requires a constant expression. When the game is compiled, it needs a constant value for all variables that you set at compile-time. Since it has to be constant, you can't include variables, such as [host] in it. If you want to set a variable-string world status, do it at run-time:

    // ..some code
host = someClient
world.status = "Hosted by [host.key]"


Hiead
In response to Hiead
So you mean some thing like so?

world
name = "Zombie Wars:"
status = "<b><font color = blue>Version 4.0</font></b>"
In response to Magicbeast20
He means that would work, but if you want to put a variable in the string you're going to have to do it somewhere else like in a proc (if you put it there too it will just get overwritten). Hiead posted the code. You'll want to put it in the world's New() proc, look it up in the DM Reference.
In response to Kaioken
world
New()
..()
Change()
var
Host = "{None}"
CPU = 0

proc
Change()
for(var/mob/M in world)
if(M.client)
if(M.client.address==world.address||client.adress==null)
Host = "[M.name]([M.key])"
CPU = 100 - world.cpu
spawn()
world.status {"
Game Name</ br>
Host:
[Host]</ br>
Efficiency:
[CPU]</ br>
"}
In response to Sokkiejjj
Looping through every mob in the world to find clients is silly. Just loop through clients:

for(var/client/C)