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
Copyright © 2025 BYOND Software.
All rights reserved.
Shinobi Dream programmed:
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:
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:
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.