ZEP Guidebook (EN)
  • Hello ZEP Script
  • ZEP Script
    • 💻ZEP Script Guide
      • ZEP Script Development Guide
        • JavaScript Development Tips
        • ZEP Script Deployment Guide
        • TypeScript Development Tips
      • Explore ZEP Script
        • Tutorials
          • Displaying a Message
          • Changing Avatar Image
          • Using HTML
          • Communicating with an External API
          • Creating a 2-Second Stun Effect
        • ZEP Script Example Code
          • Timer
          • Zombie Game
          • Paintman Game
          • Hangul Quiz Game
          • Avoid Poop Game
          • Boxing Game
          • Sidebar App
          • Race
      • ZEP Script FAQ
      • Appendix
        • ZEP Script Use Cases
        • Understanding Spaces and Maps
        • JavaScript Keycode List
        • Understanding Sprite Sheets
        • TileEffectType Detailed Explanation
        • What are Reference Coordinates?
        • Communicating with an External API
        • How to Use URL Query Strings
        • How to Change the Mobile Interaction Button
        • Grammar Available for Widgets
        • Object Interaction with ZEP Script
        • Object npcProperty
    • 📘ZEP Script API
      • API Summary
      • ScriptApp
        • Lifecycle
        • Field
        • Storage
        • Event Listeners
        • Callbacks
        • Methods
      • ScriptMap
        • Field
        • Methods
      • ScriptPlayer
        • Field
        • Methods
      • ScriptWidget
        • Field
        • Event Listeners
        • Methods
  • Others
    • Homepage
    • FAQ
    • Twitter
    • Discord
Powered by GitBook
On this page

Was this helpful?

  1. ZEP Script
  2. ZEP Script Guide
  3. Appendix

Object Interaction with ZEP Script

PreviousGrammar Available for WidgetsNextObject npcProperty

Last updated 2 years ago

Was this helpful?

You can create a script by detecting an event with ZEP Script that occurs when interacting with an object installed in the Map Editor.

In order to do this, you have to install an object that interacts with ZEP Script in the Map Editor as in the following.

  1. Go to the Map Editor → Install an object → Object Settings → Click Interact with ZEP Script

  2. Enter values into the Number and Value (optional) boxes.

  3. Write a script as below and run the app. Then the value you have entered in advance will be shown when interacting with this object.

App.onObjectTouched.Add(function (sender, x, y, tileID, obj) {
    if (obj !== null) {
        if (obj.type == ObjectEffectType.INTERACTION_WITH_ZEPSCRIPTS) {
            App.sayToAll(`Number = ${obj.text}, Value = ${obj.param1}`, 0xFFFFFF);
        }
    } else {
        App.sayToAll(`obj is null`, 0xFFFFFF);
    }
});

Please use [obj.type == ObjectEffectType.INTERACTION_WITH_ZEPSCRIPTS] as a script condition.

💻