<commit_before>require("handler.sendmessage")
require("base.common")

-- UPDATE common SET com_script = 'test.vilarion' WHERE com_itemid = 9;

module("test.vilarion", package.seeall)

function UseItem( User, SourceItem, TargetItem, counter, Param, ltstate )
    
    -- setting quest status
    local a, b, quest, status
    a,b,quest,status = string.find(User.lastSpokenText,"reset (%d+) (%d+)")
    if a ~= nil then
        quest = tonumber(quest)
        status = tonumber(status)
        User:setQuestProgress(quest, status)
        User:inform("#w Quest " .. quest .. " has been set to " .. status .. "!")
        return
    end
    a,b,quest = string.find(User.lastSpokenText,"reset (%d+)")
    if a ~= nil then
        quest = tonumber(quest)
        User:setQuestProgress(quest, 0)
        User:inform("#w Quest " .. quest .. " has been reset!")
        return
    end

    if User.id ~= 64 then
        User:inform("e-Vil says: You are not allowed to use this!");
        return;
    end;

    --User.effects:addEffect(LongTimeEffect(777, 30))

    --pos = User.pos
    --pos.x = pos.x + 1
    --world:createDynamicNPC("Lasttier",50,pos,0,"npc.lasttier")
    --User:setQuestProgress(8, 1)

    local callback = function(dialog)
        User:inform("Input: "..dialog:getInput())
        --no_func()
    end
    local c = 42
    local inputDialog = InputDialog("Enter something cool!", true, 0, callback)
    User:requestInputDialog(inputDialog)
end<commit_msg>test dialog system<commit_after>require("handler.sendmessage")
require("base.common")

-- UPDATE common SET com_script = 'test.vilarion' WHERE com_itemid = 9;

module("test.vilarion", package.seeall)

function UseItem( User, SourceItem, TargetItem, counter, Param, ltstate )
    
    -- setting quest status
    local a, b, quest, status
    a,b,quest,status = string.find(User.lastSpokenText,"reset (%d+) (%d+)")
    if a ~= nil then
        quest = tonumber(quest)
        status = tonumber(status)
        User:setQuestProgress(quest, status)
        User:inform("#w Quest " .. quest .. " has been set to " .. status .. "!")
        return
    end
    a,b,quest = string.find(User.lastSpokenText,"reset (%d+)")
    if a ~= nil then
        quest = tonumber(quest)
        User:setQuestProgress(quest, 0)
        User:inform("#w Quest " .. quest .. " has been reset!")
        return
    end

    if User.id ~= 64 then
        User:inform("e-Vil says: You are not allowed to use this!");
        return;
    end;

    --User.effects:addEffect(LongTimeEffect(777, 30))

    --pos = User.pos
    --pos.x = pos.x + 1
    --world:createDynamicNPC("Lasttier",50,pos,0,"npc.lasttier")
    --User:setQuestProgress(8, 1)

    local callback = function(dialog)
        User:inform("Input: "..dialog:getInput())
        --no_func()
    end
    local c = 42
    local inputDialog = InputDialog("Enter something cool!", true, 0)
    User:requestInputDialog(inputDialog)
end
{'fraction_non_alphanumeric': 0.14295462299556466, 'fraction_numerical': 0.012282497441146366, 'mean_word_length': 2.7686375321336762, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4508025', 'n_tokens_mistral': 981, 'n_tokens_neox': 924, 'n_words': 232}