Jump to content

Search the Community

Showing results for tags 'Coding Sniplet'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News & Announcements
    • News
  • Project Zomboid
    • PZ Updates
    • General Discussions
    • Bug Reports
    • PZ Support
    • PZ Multiplayer
    • PZ Community & Creativity
    • PZ Suggestions
  • PZ Modding
    • Tutorials & Resources
    • Mods
    • Items
    • Mapping
    • Mod Ideas and Requests
  • General Games Development
    • Indie Scene
  • Other Discussions
    • General Discussion
    • Forum Games & Activities

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Twitter


Interests

Found 1 result

  1. Hey everyone! So, I'm going to give some coding sniplets of things I think might be usefull for everyone here. With the main focus on keeping compatibility issues between mods as minimal as possible, and retaining the same functionality. Sounds good right? So here is the first one, for adding things to the build menu! --Creation of the sub menu in the original script:--Creation of the sub menu in the original script:--local buildOption = context:addOption(getText("ContextMenu_Build"), worldobjects, nil);--local subMenu = ISContextMenu:getNew(context);--What you use to add to the existing build submenu in your own script:local subMenu = nil;local buildOption = nil;for i,v in ipairs(context.options) do if v.name == getText("ContextMenu_Build") then buildOption = v; subMenu = context:getSubMenu(buildOption.subOption); endendif subMenu then --Now you can add your stuff to the build menu. --subMenu:addOption("Build <your object name>", variable1, ISYourClass.onYourFunction, variable2, etc);end What it does is check the already created context menu (the dropdown thing you get when you right click) looks for the submenu called "ContextMenu_Build", and once found it uses that. This way multiple mods can add to it, and there will be no need to overwrite the original lua file. Hope it helps <3
×
×
  • Create New...