Some timer.Create() problems/help

-Thanks to raBBish, my problems are fixed.-

Should be self.semencount :v:
Also, math.random(10, 16) instead of what you’re using.

Fuck my spelling
Testing out now…

[editline]24th March 2011[/editline]

Nope still doesn’t work. I’ve gathered the error



Timer Error: [addons\SuperSecret\lua\entities\ent_fuckajizz\shared.lua:28] attempt to perform arithmetic on global 'semencount' (a nil value)


You’re still using it without self somewhere.

There were 5 more lua errors, each regarding different places in the entity, if that’s what you mean.
But I got the self.semencount in the initialize part of the script, does it have to be outside or something like
[lua]
self.semencount = 1
function ENT:Initialize()
self.semencount = math.Round(math.Rand(10,16))
timer.Create( “semen”, 1, 0, function()
semencount = semencount-2
end)
//Uber-secret code left out here
end
[/lua]

?

Or does it have to be:

[lua]
self.semencount = 1
function ENT:Initialize()
self.semencount = math.Round(math.Rand(10,16))
timer.Create( “semen”, 1, 0, function()
self.semencount = self.semencount-2
end)
//Uber-secret code left out here
end
[/lua]

?

[lua]function ENT:Initialize()
self.semencount = math.random(10, 16)
timer.Create( “semen”, 1, 0, function()
if not self:IsValid() then return end
self.semencount = self.semencount - 2
end )
end[/lua]

It works, thanks!

But all the rest of my lines have a problem of the same type, and I’m using the same technique. Here’s one of the lines

[lua]
ENT:Initialize()
//secret codes
The above code that raBBish posted
//more secret shitty codes
util.SpriteTrail(self, 0, Color(255,255,255,self.semencount*15.9375), false, 8, 8, 0.3, 1/(10+1)*0.5, “trails/smoke.vmt”)
//more codes
//more errors
//more codes
end
[/lua]

I’m guessing it has something to do with that Color(255,255,255,self.semencount15.9375) section. Does it have to just be Color(255,255,255,semencount15.9375)?