Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --The easiest way to locate an item is with its GUID.
- --But we don't always know those in advance. So we need ot search for the item.
- --There are many ways to go about it.
- --The easist is to hunt for them in scripting zones using tags or names.
- --If a scripting zone isn't practical, then you can look for them without it.
- --There are more that I haven't even listed, these are just my go-to ones
- --Runs when the map is first loaded
- function onload(saved_data)
- --Creates the 4 buttons
- self.createButton({
- label="Calculate\nPoints", click_function="orangedinocount",
- function_owner=self, position={-2.15,0.3,-1.5},
- height=100, width=140, font_size=30, color={0.95,0.4,0.0},
- })
- self.createButton({
- label="H", click_function="orangemeeplemove",
- function_owner=self, position={0.16,0.2,-1.3},
- height=90, width=90, font_size=60, color={0.95,0.4,0.0},
- })
- end
- function orangemeeplemove()
- --local orangeboard = getObjectFromGUID("5b16a8")
- local orangepawn1 = getObjectFromGUID("4d9f73")
- local orangepawn2 = getObjectFromGUID("9108ee")
- local orangepawn3 = getObjectFromGUID("82dab3")
- local orangepawn4 = getObjectFromGUID("49af00")
- --print("Orange pawn is located at: " .. orangepawn4.getPosition())
- orangepawn1.setRotation({0,0,0})
- orangepawn1.setPosition({-5.4,2,-12})
- orangepawn2.setRotation({0,0,0})
- orangepawn2.setPosition({-4.6,2,-12})
- orangepawn3.setRotation({0,0,0})
- orangepawn3.setPosition({-3.8,2,-12})
- orangepawn4.setRotation({0,0,0})
- orangepawn4.setPosition({-3,2,-12})
- print("Orange pawns moved")
- --object1.setPositionSmooth(Table, bool, bool)
- end
- --This function finds the name of any object in a scripting zone and prints them
- function orangedinocount()
- local dinopoints = 0
- local dinorep = 0
- local zone = getObjectFromGUID("444c10")
- local objectsInZone = zone.getObjects()
- if #objectsInZone == 0 then
- print("Orange - 0 Dinosaurs")
- else
- for _, object in ipairs(objectsInZone) do
- local name = object.getName()
- --Then check if it had a name or not
- if name == "Triceritops" then
- dinopoints = dinopoints + 2
- dinorep = dinorep + 1
- elseif name == "Brontosaurus" then
- dinopoints = dinopoints + 5
- dinorep = dinorep + 2
- elseif name == "Stegosaurus" then
- dinopoints = dinopoints + 3
- dinorep = dinorep + 2
- elseif name == "Anklyosaurus" then
- dinopoints = dinopoints + 5
- dinorep = dinorep + 2
- elseif name == "Raptor" then
- dinopoints = dinopoints + 4
- dinorep = dinorep + 2
- elseif name == "T - Rex" then
- dinopoints = dinopoints + 7
- dinorep = dinorep + 3
- elseif name == "Pterodactyle" then
- dinopoints = dinopoints + 5
- dinorep = dinorep + 4
- elseif name == "Mutant" then
- dinopoints = dinopoints + 2
- dinorep = dinorep + 0
- end
- end
- end
- --Finally, we print the "closing" line.
- --The purpose of the first and last lines are decorative and for clarity
- print("orange dinopoints = " .. dinopoints)
- print("orange dinorep = " .. dinorep)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement