[share] mini-tut on gossip scripts lua menu

User Tag List

Results 1 to 3 of 3
  1. #1
    b!atch's Avatar Member
    Reputation
    118
    Join Date
    Oct 2007
    Posts
    726
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [share] mini-tut on gossip scripts lua

    Hey guys..I found a thread on Index of / about gossip scripts. and i thought id share it with mmowned

    Credits - some unregistered member of luaplusplus.org



    Well, after getting pissed at this project because it was the only link between me and Lua-powered gossip npcs, I finally decided to look into the whole deal. Took all of a few minutes sadly and I wasted way more time than that getting mad at some of the devs here for almost no reason. Personal stuff aside, here's what I found.

    Apparently, the gossip functions in the svn vary from the ones used in almost any example script I could find. I guess the easy way to convey this is throw together a function reference and give you an example script.

    GossipCreateMenu
    Called from - Unit
    Arg1 Integer - Text ID. Not entirely sure what it's used for but I'm guessing high and random numbers are a safe bet.
    Arg2 Pointer - Player you're creating the menu for.
    Example: Unit:GossipCreateMenu(3543, Player)

    GossipMenuAddItem
    Called from - Unit
    Arg1 Pointer - Player you're creating the menu for.
    Arg2 Integer - Icon display ID for gears,chat bubbles, and whatever else there is
    Arg3 String - Displayed text for this menu item
    Arg4 Integer - Number used with Gossip_Select
    Arg5 Integer - Code menu. Shown(1) or not(0)
    Example: Unit:GossipMenuAddItem(Player, 4, "Text displayed to the player!", 0, 0)

    GossipSendMenu
    Called from - Unit
    Arg1 Pointer - Player to send the menu to.
    Example: Unit:GossipSendMenu(Player)

    Note: I'm not taking credit for this script in full but I simply made modifications to it to get it to work. I don't remember who the original creator is.

    Source code

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35



    Code:
    function NPC_main_menu(unit, player)
        unit:GossipCreateMenu(3543, player)
    --    unit:GossipMenuAddItem(target_player, icon_id, "menu_text", int_id, extra)
    -- icond_id - id of an icon (chat bubble, gear, e.t.c)
    -- int_id - id of your menu for gossip_select function
        unit:GossipMenuAddItem(player,4, "menu_text1", 0, 0)
        unit:GossipMenuAddItem(player,4, "menu_text2", 1, 0)
        unit:GossipMenuAddItem(player,4, "menu_text3", 2, 1) -- extra - 1/0 enable/disable enter code menu.
        unit:GossipSendMenu(player)
    end
    
    function NPC_on_gossip_talk(unit, event, player)
        NPC_main_menu(unit, player)
    end
    
    function NPC_on_gossip_select(unit, event, player, id, intid, code)
        if(intid == 0) then
            unit:SendChatMessage(12, 0, "you are selected menu 0")
            player:GossipComplete()
        end
        if(intid == 1) then
            unit:SendChatMessage(12, 0, "you are selected menu 1")
            player:GossipComplete()
        end
        if(intid == 2) then
            unit:SendChatMessage(12, 0, "you are wrong!")
            if(code == 'abcd') then
                 unit:SendChatMessage(12, 0, "you have entered right code(abcd)")
            end
            player:GossipComplete()
        end
    end
    
    RegisterGossipEvent(200000, 1, "NPC_on_gossip_talk")
    RegisterGossipEvent(200000, 2, "NPC_on_gossip_select")
    Spectrum-X is win! Rep People That Help You and Candybones Wont Eat Your Brain:>

    [share] mini-tut on gossip scripts lua
  2. #2
    pachuco55's Avatar Member
    Reputation
    12
    Join Date
    Mar 2008
    Posts
    75
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Credits go to Oxin [even if he's unregistered you can see the name]

    -- he's a dev for our server and is under the same name on OpenAscent.



  3. #3
    b!atch's Avatar Member
    Reputation
    118
    Join Date
    Oct 2007
    Posts
    726
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okayh credits for oxin!:b
    Spectrum-X is win! Rep People That Help You and Candybones Wont Eat Your Brain:>

Similar Threads

  1. [Lua] Adding a cooldown to your gossip script
    By Dynashock in forum WoW EMU Guides & Tutorials
    Replies: 4
    Last Post: 09-17-2010, 11:15 PM
  2. [Lua Script] Need help with this lua gossip script
    By diviee3 in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 06-21-2010, 07:52 PM
  3. How to script LUA complete tut.
    By Found in forum WoW EMU Guides & Tutorials
    Replies: 16
    Last Post: 04-13-2009, 10:34 PM
  4. [Lua] Gossip Script
    By LJN in forum World of Warcraft Emulator Servers
    Replies: 9
    Last Post: 07-20-2008, 04:38 AM
  5. Gossip scripting guide!
    By Le Froid in forum WoW EMU Guides & Tutorials
    Replies: 3
    Last Post: 12-13-2007, 05:06 PM
All times are GMT -5. The time now is 06:22 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search