====== Worlds Class ====== Class For Worlds Interface [[developer_center:developer_editor:script|Return To Previous Page]] ------ ==== How to Write Event ===== ScriptSupportEvent:registerEvent([[EventName]],callbackFunctionName) ==== Example ==== function ContainerChanges (event) local blockid , itemid = event.blockid , event.itemid local x , y , z = event.x , event.y , event.z end ScriptSupportEvent:registerEvent([[Backpack.ItemChange]],ContainerChanges) ===== Eventlist ===== ^ EventName ^ Parameters ^ Descriptionn ^ | Backpack.ItemChange | blockid, itemid, itemnum, x, y, z | Any Items Changes In Any Container | | Backpack.ItemPutIn | blockid, itemid, itemnum, x, y, z | Any Items Put In Any Container | | Backpack.ItemTakeOut | blockid, itemid, itemnum, x, y, z | Any Items Taken Out From Any Container | ===== Api list ===== ^ Class:apiName ^ Return ^ Descriptionn ^ |[[script:world_event:isDaytime|World:isDaytime]] | code: number | Check if it is daytime | |[[script:world_event:isCustomGame|World:isCustomGame]] | code: number | Check if it is a custom game | |[[script:world_event:isCreativeMode| World:isCreativeMode]]| code: number | Check if it is creative mode | |[[script:world_event:isGodMode| World:isGodMode]]| code: number, boolean | Check if it is god mode | |[[script:world_event:isExtremityMode| World:isExtremityMode]]| code: number, boolean | Check if it is extremity mode | |[[script:world_event:isFreeMode|World:isFreeMode]] | code: number, boolean | Check if it is free mode | |[[script:world_event:isSurviveMode|World:isSurviveMode]] | code: number, boolean | Check if it is single-player survival mode | |[[script:world_event:isCreateRunMode|World:isCreateRunMode]]| code: number, boolean | Check if it is creative to survival mode | |[[script:world_event:isGameMakerMode|World:isGameMakerMode]]| code: number, boolean | Check if it is game maker mode | |[[script:world_event:getHours|World:getHours]] | code: number, hours: number | Get the current time of the game (hours) | |[[script:world_event:setHours|World:setHours]]| code: number | Set the current time of the game (hours) | | [[script:world_event:getCameraEditState|World:getCameraEditState]] | code: number, state: number | Get the camera editing state | | [[script:world_event:setCameraEditState|World:setCameraEditState]]| code: number | Set the camera editing state | | [[script:world_event:getCustomCameraConfig|World:getCustomCameraConfig]]| code: number, config: CameraEditState | Get custom camera configuration | | [[script:world_event:getRangeXZ|World:getRangeXZ]] | code: number, startX: number, startZ: number, endX: number, endZ: number | Get the range of the block (chunk) | | [[script:world_event:getRayBlock|World:getRayBlock]] | code: number, blockid: number | Get the type of block hit by the ray | | [[script:world_event:getActorsByBox|World:getActorsByBox]] | code: number, num: number, objids: table | Get the actors in the specified range | | [[script:world_event:getPlayerTotal|World:getPlayerTotal]] | code: number, num: number | Get the total number of players | |[[script:world_event:getAllPlayers|World:getAllPlayers]] | code: number, num: number, array: table | Get all players | |[[script:world_event:randomOnePlayer|World:randomOnePlayer]]| code: number, playerid: number | Randomly select a player | |[[script:world_event:despawnActor|World:despawnActor]] | code: number | Remove an actor | |[[script:world_event:spawnCreature|World:spawnCreature]] | code: number, objids: table | Generate creatures at the specified location | |[[script:world_event:despawnCreature|World:despawnCreature]]| code: number | Remove a creature | |[[script:world_event:spawnItem|World:spawnItem]] | code: number, objid: number | Generate items at the specified location | |[[script:world_event:despawnItemByBox|World:despawnItemByBox]]| code: number | Remove items within the specified area | |[[script:world_event:despawnItemByObjid|World:despawnItemByObjid]]| code: number | Remove an item by its ID | |[[script:world_event:spawnProjectile|World:spawnProjectile]] | code: number, objid: number | Generate a projectile | |[[script:world_event:spawnProjectileByDir| World:spawnProjectileByDir]] | code: number, objid: number | Generate a projectile by direction | | [[script:world_event:calcDistance| World:calcDistance]] | code: number, distance: number | Calculate the distance between two locations | |[[script:world_event:playParticleEffect| World:playParticleEffect]] | code: number | Play a particle effect at the specified position | |[[script:world_event:stopEffectOnPosition|World:stopEffectOnPosition]]| code: number | Stop a particle effect at the specified position | |[[script:world_event:setEffectScaleOnPosition|World:setEffectScaleOnPosition]] | code: number | Set the scale of a particle effect at the specified position | |[[script:world_event:randomParticleEffectID|World:randomParticleEffectID]] | code: number, result: number | Randomly get a particle effect ID | |[[script:world_event:playSoundEffectOnPos|World:playSoundEffectOnPos]] | code: number | Play a sound effect at the specified position | |[[script:world_event:stopSoundEffectOnPos|World:stopSoundEffectOnPos]] | code: number | Stop a sound effect at the specified position | |[[script:world_event:getLightByPos|World:getLightByPos]] | code: number, lightlv: number | Get the light intensity at the specified position | |[[script:world_event:setBlockLightEx|World:setBlockLightEx]] | code: number | Set the light intensity at the specified position | |[[script:world_event:randomSoundID|World:randomSoundID]] | code: number, soundid: number | Randomly get a sound ID | |[[script:world_event:randomWeatherID|World:randomWeatherID]] | code: number, wtype: number | Randomly get a weather type ID | |[[script:world_event:getLocalDate|World:getLocalDate]] | code: number, year: number | Get the local date | |[[script:world_event:getLocalDateString| World:getLocalDateString]] | code: number, date: string | Get the complete local date | |[[script:world_event:getServerDate|World:getServerDate]]| code: number, year: number | Get the server date | |[[script:world_event:getServerDateString|World:getServerDateString]] | code: number, date: string | Get the complete server date | |[[script:world_event:getDateFromTime|World:getDateFromTime]] | code: number, year: number | Convert a timestamp to a specific time unit | | [[script:world_event:getDateStringFromTime|World:getDateStringFromTime]] | code: number, date: string | Convert a timestamp to a complete date | | [[script:world_event:SetTimeVanishingSpeed|World:SetTimeVanishingSpeed]] | code: number | Set the time lapse speed of the skybox | |[[script:world_event:SetSkyBoxTemplate|World:SetSkyBoxTemplate]] | code: number | Set the skybox template | | [[script:world_event:SetSkyBoxMaps|World:SetSkyBoxMaps]] | code: number | Set the skybox texture | | [[script:world_event:SetSkyBoxColor|World:SetSkyBoxColor]] | code: number | Set the skybox color parameters | |[[script:world_event:SetSkyBoxAttr|World:SetSkyBoxAttr]] | code: number | Set the skybox attribute parameters | |[[script:world_event:SetSkyBoxFilter|World:SetSkyBoxFilter]] | code: number | Set the skybox filter parameters | |[[script:world_event:namedescribe|World:namedescribe]] | code: number, str: string | Get the default string | | [[script:world_event:setScriptVar|World:setScriptVar]] | code: number | Set script parameters for custom use | |[[script:world_event:getScriptVar|World:getScriptVar]] | code: number, val: any | Get script parameters for custom use | |[[script:world_event:sendScriptVars2Client|World:sendScriptVars2Client]] | code: number | Upload the set script parameters | |[[script:world_event:addRenderGlobalEffect| World:addRenderGlobalEffect]]| code: number | Add a global effect | |[[script:world_event:removeRenderGlobalEffect|World:removeRenderGlobalEffect]] | code: number | Remove a global effect | |[[script:world_event:setRenderGlobalEffectPos|World:setRenderGlobalEffectPos]] | code: number | Set the position of a global effect | |[[script:world_event:setRenderGlobalEffectScale|World:setRenderGlobalEffectScale ]] | code: number |Set the scaling of a global effect | |[[script:world_event:msgBox|World:msgBox]] | code: number | Show a message box | |[[script:world_event:splitStr|World:splitStr]] | code: number, strs: table | Split a string |