ID:264385
 
mob/Stat()
statpanel("Blah")
stat("Blah: [usr]")
stat("Blah:","[usr.Blah]")
stat("Blah:","[usr.Blah]")
stat("Blah:","[usr.Blah]")
stat("Blah:","[usr.Blah]")
stat("Blah:","[usr.Blah]")
stat("Location:"," [usr.x],[usr.y],[usr.z]")
stat("Blah:","[usr.Blah]/[src.Blah]")
if(Race=="Blah"||Race=="Blah"||)
stat("Blah: [Blah]")
statpanel("Players")
stat("People Online:",players)
for(var/mob/M in world)
if(M.client)
stat(M):



Stat Panel.dm:14:error: missing expression

Inuyasha Project.dmb - 3 errors, 0 warnings (double-click on an error to jump to it):



I was trying to make it if your a certain race say a Knight you get a stat that no other class can have
Firstly, pay attention to the formatting of your posts. Your code should've been entered into the (in this case, premade for you) <DM> tag (and not <B>) for easier readability.

Shinobi Dream programmed:
    if(Race=="Blah"||Race=="Blah"||)


Here is the problem. As the compiler rightfully detected, you have a missing expression. The || operator takes 2 expressions/values, one on each side. You have an instance of || there with only 1 - hence, the remaining 1 expression is missing. Buzz.

Misc code notes:
  • >   for(var/mob/M in world)
    > if(M.client)
    > stat(M)

    This is quite a problem in Stat(), which can be called as often as every 1-3 ticks. This is especially problematic because you're looping through all mobs, so if you have 100 NPCs, you could be looping through 100+ mobs every 3/10 a second, multiplied by the amount of players on (since the code runs for each one). This is improved by using the overall improved method of looping through clients instead:
    for(var/client/C)
    stat(C.mob)

    If you notice, all I've done is essentially logically switch out client and mob. The reason? As a general rule, there are fewer clients than mobs. So this not only eliminates the if() check but also loops less.
    Still, in Stat(), in order to minimize overhead, the recommended course of action is to display a premade (global) list of players instead of looping to find them each and every time. Either way you're looping, but it's more efficient with a list and single stat() call. Essentially, make your global players var contain a list and not a number. :P You can use its len to find out the number of players.
  • Most preferably, you should stick to using src in Stat(); most of the time it will probably be the correct var, while usr may not in special circumstances (read up on statobj for a clarification). Anyway, regardless, for the sake of robustness, whenever you have 2 vars like src and usr that are sometimes (or mostly) identical, you should stick to using only one, and not mix the usage of them. So either use usr in all of your Stat(), or src (<-- hint: recommended :P).
In response to Kaioken
Thx for you guys help :D