#have some questions about various scripts
1 messages · Page 1 of 1 (latest)
The 1st thing I need help with is…
I want to do stuff with the in game time…what would be a good way of showing the current in game time?
And/or, is there a way to do scripts based off a specific time in Game?
Like:
If
Is time bla
Then
And then is it possible for the game to know if it’s day or night time?
If not, could I possibly make a script that assigns a global or “world” history, to sort of act as way to tell the world what instance it’s in time wise? If that makes sense
Then do system and player histories work atm? Like for either:
-if you kill a mob, i can make it where it adds a player history for points?
And/or is there a way that works for the game to keep track of said points?
Maybe if histories don’t work, maybe I can do like a chest system that adds gold per kill
But then is there a way that the game can display how much of something is in a chest?
And then is there a way to have the game give a history based or revolving around in game time?
This should be very easy to do, use the "If - IsClock [1][True] - Then - History [Time][1] - ElseIf - IsClock [2][True] - Then - History [Time][2]" all the way through 24. Then for your time based events, just use "If - HasHistory [whatever time it is based on the history] - Then - script" If that makes any sence. The clock script will need to be on a loop. I can try to explain this better if this is confusing.
Also, use "0" as the clock value to check for if it is midnight.
Also, variables work as well. “Var [Time] = [Clock:]” - This sets the variable Time to the in game time. It does include decimal points unless you make a second variable Var [adjtime] = [Int:Time] - this making the variable adjtime the nearest integer. 0 is midnight. Time of 6 is when the sun breaks the edge of the map while rising and 18 is when it sets at the other edge of the map. I do believe the IsClock would be your best bet though.
The variable method would be good for checking if it is day or night in a single instance because you can use:
Var [Time] = [Clock:]
If
Isvar [Time] [>=] [6]
Isvar [Time] [<=] [18]
Then
“Insert Day Commands Here”
Else
“Insert Night Commands Here”
Endif
In regard to the other part. Currently, some methods of assigning histories appears to not communicate between the local player and the host.
I am currently not where I can check in game, but I do believe you can convert the value of an item in a chest to a history using variables.
// Replace x,y,z with your chest location.
Var [Coins] = [Inv:[GoldPieces] [x,y,z]]
History [Coins] [Coins] - for system or
History [Coins] [Player] [Coins] - for player history
Either way it involves assigning a history though and it is bugged for some methods of activating the script.
https://discord.com/channels/259780503115137028/1183452893534240768
Var: Declare variables and assign values.
var [name] [name]...[name]
var [name] = [value] op [value]...op [value]
There are two forms of the var command. One declares one or more variable names, the other assigns a value to a single variable, based on an expression.
A script cannot have more than 256 variables.
`[name]` - The name of the variable. Variable names cannot have spaces or contain any of the following characters: :~`!@#$%^&*()-=+|\\/?<>,.
Variable names cannot be one of the following: var, true, false, on, off, player, clan, history, syshistory, clanhistory, health, maxhealth, reach.
Variable names are not case sensitive.
`[value] op [value]...op [value]` - An expression made up of one or more values and operators. Operators do not need to be surrounded by square brackets.
`[value] may be a numeric literal, another variable or a built in value type as listed below.
Built in [value] types:
`[Abs:x]` - The absolute value of x.
`[Sin:x]` - The sine of x.
`[Cos:x]` - The cosine of x.
`[Tan:x]` - The tangent of x.
`[Sqrt:x]` - The square root of x.
`[Single:x]` - x converted to single precision.
`[Int:x]` - x converted to an integer.
`[Neg:x]` - Negate x.
`[-x]` - Same as [Neg:x].
`[pi:]` - The value of PI.
`[Clock:]` - The current clock.
`[Health:]` - The players current health.
`[MaxHealth:]` - The players current max health.
`[Reach:]` - The players current reach.
`[Pos:x|y|z]` - The players current X, Y or Z position.
`[Eye:x|y|z]` - The players current X, Y or Z eye position.
`[Vel:x|y|z]` - The players current X, Y or Z velocity.
`[View:x|y|z]` - The players current X, Y or Z view direction.
`[Rel:x|y|z]` - The scripts relative block X, Y or Z.
`[PRel:x|y|z]` - The players block position X, Y or Z.
`[CRel:x|y|z]` - The players cursor X, Y or Z.
`[Script:x|y|z]` - The scripts X, Y or Z offset.
`[Skill:x]` - The players current skill level.
`[Skillxp:x]` - The players current skill xp.
`[Rand:x]` - A random number between 0 - x inclusive.
`[Hash:text]` - Returns an integral hash of text. [gamertag] substitution supported.
`[History:key]` - The value of the player history [key].
`[SysHistory:key]` - The value of the system history [key].
`[ClanHistory:key]` - The value of the clan history [key].
`[Block:x,y,z]` - The block id at x,y,z.
`[Aux:x,y,z]` - The aux data at x,y,z.
`[Light:x,y,z]` - The light at x,y,z.
`[SunLight:x,y,z]` - The sun light at x,y,z.
`[BlockLight:x,y,z]` - The block light at x,y,z.
`[Inv:[Item][x,y,z]]` - Inventory. If x,y,z is omitted, player inventory is used.
`[Distance:[x,y,z][x,y,z]]` - Get the distance between the two points.
`[GamerCount:all|local|remote]` - Get the number of gamers in the world.
`[GamerCount:[zone][all|local|remote]]` - Get the number of gamers in a zone.
`[GamerCount:[x,y,z][x,y,z][all|local|remote]]` - Get the number of gamers in a cubic area.
`[GamerCount:[x,y,z][radius][all|local|remote]]` - Get the number of gamers in a spherical area.
`[NpcCount:npctype]` - Get the number of NPCs in the world.
`[NpcCount:[zone][npctype]]` - Get the number of NPCs in a zone.
`[NpcCount:[x,y,z][x,y,z][npctype]]` - Get the number of NPCs in a cubic area.
`[NpcCount:[x,y,z][radius][npctype]]` - Get the number of NPCs in a spherical area.