developer_center:developer_editor:script:world_event
Table of Contents
Worlds Class
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 |
|---|---|---|
| World:isDaytime | code: number | Check if it is daytime |
| World:isCustomGame | code: number | Check if it is a custom game |
| World:isCreativeMode | code: number | Check if it is creative mode |
| World:isGodMode | code: number, boolean | Check if it is god mode |
| World:isExtremityMode | code: number, boolean | Check if it is extremity mode |
| World:isFreeMode | code: number, boolean | Check if it is free mode |
| World:isSurviveMode | code: number, boolean | Check if it is single-player survival mode |
| World:isCreateRunMode | code: number, boolean | Check if it is creative to survival mode |
| World:isGameMakerMode | code: number, boolean | Check if it is game maker mode |
| World:getHours | code: number, hours: number | Get the current time of the game (hours) |
| World:setHours | code: number | Set the current time of the game (hours) |
| World:getCameraEditState | code: number, state: number | Get the camera editing state |
| World:setCameraEditState | code: number | Set the camera editing state |
| World:getCustomCameraConfig | code: number, config: CameraEditState | Get custom camera configuration |
| World:getRangeXZ | code: number, startX: number, startZ: number, endX: number, endZ: number | Get the range of the block (chunk) |
| World:getRayBlock | code: number, blockid: number | Get the type of block hit by the ray |
| World:getActorsByBox | code: number, num: number, objids: table | Get the actors in the specified range |
| World:getPlayerTotal | code: number, num: number | Get the total number of players |
| World:getAllPlayers | code: number, num: number, array: table | Get all players |
| World:randomOnePlayer | code: number, playerid: number | Randomly select a player |
| World:despawnActor | code: number | Remove an actor |
| World:spawnCreature | code: number, objids: table | Generate creatures at the specified location |
| World:despawnCreature | code: number | Remove a creature |
| World:spawnItem | code: number, objid: number | Generate items at the specified location |
| World:despawnItemByBox | code: number | Remove items within the specified area |
| World:despawnItemByObjid | code: number | Remove an item by its ID |
| World:spawnProjectile | code: number, objid: number | Generate a projectile |
| World:spawnProjectileByDir | code: number, objid: number | Generate a projectile by direction |
| World:calcDistance | code: number, distance: number | Calculate the distance between two locations |
| World:playParticleEffect | code: number | Play a particle effect at the specified position |
| World:stopEffectOnPosition | code: number | Stop a particle effect at the specified position |
| World:setEffectScaleOnPosition | code: number | Set the scale of a particle effect at the specified position |
| World:randomParticleEffectID | code: number, result: number | Randomly get a particle effect ID |
| World:playSoundEffectOnPos | code: number | Play a sound effect at the specified position |
| World:stopSoundEffectOnPos | code: number | Stop a sound effect at the specified position |
| World:getLightByPos | code: number, lightlv: number | Get the light intensity at the specified position |
| World:setBlockLightEx | code: number | Set the light intensity at the specified position |
| World:randomSoundID | code: number, soundid: number | Randomly get a sound ID |
| World:randomWeatherID | code: number, wtype: number | Randomly get a weather type ID |
| World:getLocalDate | code: number, year: number | Get the local date |
| World:getLocalDateString | code: number, date: string | Get the complete local date |
| World:getServerDate | code: number, year: number | Get the server date |
| World:getServerDateString | code: number, date: string | Get the complete server date |
| World:getDateFromTime | code: number, year: number | Convert a timestamp to a specific time unit |
| World:getDateStringFromTime | code: number, date: string | Convert a timestamp to a complete date |
| World:SetTimeVanishingSpeed | code: number | Set the time lapse speed of the skybox |
| World:SetSkyBoxTemplate | code: number | Set the skybox template |
| World:SetSkyBoxMaps | code: number | Set the skybox texture |
| World:SetSkyBoxColor | code: number | Set the skybox color parameters |
| World:SetSkyBoxAttr | code: number | Set the skybox attribute parameters |
| World:SetSkyBoxFilter | code: number | Set the skybox filter parameters |
| World:namedescribe | code: number, str: string | Get the default string |
| World:setScriptVar | code: number | Set script parameters for custom use |
| World:getScriptVar | code: number, val: any | Get script parameters for custom use |
| World:sendScriptVars2Client | code: number | Upload the set script parameters |
| World:addRenderGlobalEffect | code: number | Add a global effect |
| World:removeRenderGlobalEffect | code: number | Remove a global effect |
| World:setRenderGlobalEffectPos | code: number | Set the position of a global effect |
| World:setRenderGlobalEffectScale | code: number | Set the scaling of a global effect |
| World:msgBox | code: number | Show a message box |
| World:splitStr | code: number, strs: table | Split a string |
developer_center/developer_editor/script/world_event.txt · Last modified: 2024/06/13 08:01 by don