//Lots of this code was created by Pixie
// Gets the integer for random price
produceprice1 = GetRandomInt (1,100)
// remove old stock from the shop
foreach (produce1, GetDirectChildren(foodstock)) {
produce1.parent = foodstorage
}
foreach (produce2, GetDirectChildren(foodstock)) {
produce2.parent = foodstorage
}
//Item 1
for (produce1, 1, 5) {
l = GetDirectChildren(foodstorage)
n = GetRandomInt(0, ListCount(l)-1)
produce1 = ObjectListItem(l, n)
produce1.parent = foodstock
}
if (produceprice1 <= 10) {
produce1.price = produce1.value * 0.5
}
else if (produceprice1 <= 35) {
produce1.price = produce1.value * 0.75
}
else if (produceprice1 <= 65) {
produce1.price = produce1.value
}
else if (produceprice1 <= 90) {
produce1.price = produce1.value * 1.25
}
else {
produce1.price = produce1.value * 1.5
}
// Item 2
for (produce2, 1, 5) {
l2 = GetDirectChildren(foodstorage)
n2 = GetRandomInt(0, ListCount(l2)-1)
produce2 = ObjectListItem(l2, n2)
produce2.parent = foodstock
}
produce1.price = round(produce1.price)
//Item 1
for (P, 1, 5) {
l = GetDirectChildren(foodstorage) //list of storage items that can be put into stock
n = GetRandomInt(0, ListCount(l)-1) //random list index selected
produce1 = ObjectListItem(l, n) //produce1 = current selection
produce1.parent = foodstock //move produce1 to stock
//set price of produce1 here
//if you don't set the price here then you need to reference all possible items and set their price individually elsewhere
}
//at this point produce1 = the last item moved to stock only
for(<iterator variable>,<int from>,<int to>
foreach (placeholder_variable, Object_name.List_Attribute_name) {
placeholder_variable.Attribute_name = GetRandomInt (min, max)
}
foreach (shop_item, shop.itemlist) {
if (shop_item.type_of_object = "claymore_sword") {
shop_item.price = GetRandomInt (100,500)
} else if (shop_item.type_of_object = "full_plate_mail") {
shop_item.price = GetRandomInt (1000,5000)
}
}
game.team = split ("joe;jim;jill;john;jan;jen",";")
foreach (team_member, game.team) {
invoke (team_member, "run_laps")
// the 'team_member' is used to represent each of the items in the list, so conceptually, it is doing this:
// invoke (team_member{joe}, "run_laps")
// invoke (team_member{jim}, "run_laps")
// invoke (team_member{jill}, "run_laps")
// invoke (team_member{jan}, "run_laps")
// invoke (team_member{jen}, "run_laps")
// aka, all the team members, each individually, run laps (a Script Variable, that is invoked)
}
foreach (fhkasdhfkjashfkl, game.team) {
invoke (fhkasdhfkjashfkl, "run_laps")
}
foreach (x, game.team) {
invoke (x, "run_laps")
}
foreach (item, game.team) {
invoke (item, "run_laps")
}
foreach (itm, game.team) {
invoke (itm, "run_laps")
}
foreach (obj, game.team) {
invoke (obj, "run_laps")
}
x = cast(item.value * .5, int)
y = cast(item.value *1.5, int)
item.price = GetRandomInt(x, y)
x = item.value/2
y = item.value*3/2
item.price = GetRandomInt(x, y)
Error running script: Error compiling expression 'stockeditem.stockvalue < stockeditem.value + 25': CompareElement: Operation 'LessThan' is not defined for types 'String' and 'Int32'
foreach (stockeditem, GetDirectChildren(myshop))
foreach (stockeditem, GetDirectChildren(myshop)) {
if (not stockeditem.name = "player") {
stockeditem.parent = your_destination_Object's_name
msg (stockeditem.name + " is transferred to...")
// or, if you give them aliases: msg (stockeditem.alias + " is transferred to...")
} else if (stockeditem.name = "player") {
msg ("You're not an item, so you're not transferred to ....")
}
}
foreach (stockeditem, GetDirectChildren(myshop)) {
if (not stockeditem.name = "player") {
stockeditem.parent = your_destination_Object's_name
msg (stockeditem.name + " is transferred to...")
// or, if you give them aliases: msg (stockeditem.alias + " is transferred to...")
}
}
foreach (stockeditem, GetDirectChildren(myshop)) {
if (not stockeditem.name = "player") {
stockeditem.parent = your_destination_Object's_name
}
}