This was my initial attempt at making fake stocks.
Instead of having to wait t'ill the real stock market is open.
PHP Code:
function onCreated(){
onTimeout();
this.stocks = {
{"Graalordinates", -2, 12},
{"PlayerKillCo", -5, 3},
{"UnixmadBreadFund", -7, 10},
{"BrokeLenders", -6, 13},
{"Gold", -1, 23},
{"Silver", -0.5, 12},
{"Oil", -2.6, 15},
{"Facebook", -4, 18},
{"Google", -3, 14},
{"Yahoo", -2, 11},
};
}
function onTimeout(){
for(i = 0; i < this.stocks.size(); i ++){
temp.stock = this.stocks[i][0];
temp.min = this.stocks[i][1];
temp.max = this.stocks[i][2];
temp.amnt = random(min, max);
if(this.stock_price.(@stock) < amnt){
this.stock_price.(@stock) += random(0.01, 0.02);
}
if(this.stock_price.(@stock) > amnt){
this.stock_price.(@stock) -= random(0.01, 0.02);
}
temp.min = this.stock_price.(@stock) < 0;
this.stock_price.(@stock) = this.stock_price.(@stock[0]).substring(0, (min?5:4));
}
settimer(5);
}