ID:147320
 
I never needed to add time to the world besides sleep..But from wut i could play around with i got this which i figured wouldnt work
world/New()
sleep(400)
usr.money += 50
I need so if the usr is on for so many minuets he gets money
easy, make a proc

proc
GainMoney()
sleep(400)
usr.money += 100
spawn()
GainMoney()

mob/Login()
GainMoney()

I made that right off the bat, so u might want some changes, but that should work.

you could also make it change per time. for example, make a variable, moneytime, and everytime in the proc above, before the spawn() do usr.moneytime += 100 or something, and instead of the sleep(400) do a sleep(usr.moneytime)
Snowfox wrote:
I never needed to add time to the world besides sleep..But from wut i could play around with i got this which i figured wouldnt work
world/New()
sleep(400)
usr.money += 50
I need so if the usr is on for so many minuets he gets money

You dont need to tab after a sleep.This should work, Just call the AddMoney() proc in your Login() code.
mob
proc // makes a proc
AddMoney() // Names the proc AddMoney
while(1) // Keeps the proc repeating until the 1 isnt a 1 which will be never
sleep(400) // waits 400 ticks
money += 50 // Adds 50 to the money var
In response to Metroid
ty u all..I'll have to read up on procs one of these days ^_^
In response to Metroid
How long is a tick..cuz i tried both of your codes and both seem not to add money o.O
In response to Snowfox
A tick is 1/10th of a second. Also, it's probably a better idea to use one world proc than have a billion mob procs running at once.
proc
GimmeMoney()
for(var/client/C in world) C.mob.moola += 50
spawn(600) GimmeMoney()

world
New()
..()
GimmeMoney()
In response to Mobius Evalon
Actually, I've found in my experience, a few client procs running at different intervals than one large proc looping through the entire pbase once every few minutes is more efficient.
In response to Teh Governator
Actually, I've found in my experience, a few client procs running at different intervals than one large proc looping through the entire pbase once every few minutes is more efficient.

It's not more effecient since you have the overhead of more proc calls. The only reason it seems that it's more effecient is that all the calls aren't synced up so there isn't a large processor hit all at once. This can be avoided by making the large proc a background one or even better yet use some sleep() statements to break up sections that don't all need to be run at once.
In response to Snowfox
I really hope you never perform surgery on me.

"I'll have to read up on heart bypasses one of these days...."
In response to Mobius Evalon
HAHAHAAHA*nervous laugh* math isnt my subject *nervous laugh* so 600t ticks is like 6 sconds right o.o *nervouse luagh*And i think i made it so it works with my game but now it doesnt work <.<

proc
GimmeMoney()
for(var/client/C in world) C.mob.money += 50
spawn(600) GimmeMoney()

world
New()
..()
GimmeMoney()


ANd how do u do those lovely boxes xD

In response to Snowfox
#define SECOND  10
#define MINUTE 600
#define HOUR 36000
In response to Teh Governator
Well in mobs coding it says C.mob.money+=100 but....i use usr.money..and when i put usr instead of mob i get an error..Well so then i htought mabe it's cuz my in my stats it says stat("Money:.","[usr.money]") but thats not it...So....mob or som1 that can tell me..wut is the c thing all about..i kno its stand for the a mob or the mob in the game..thats about all..x-x
In response to Snowfox
You're looping through every client in the world. A client is a player. Then you give them the variable C. Then you acces C.mob, which is the mob the client is connected to, and then C.mob.money, which is their mob's money.