Daimonin
Members login
Sign Up!      problems?
N F
* Daimonin Forum
Home Help Search Calendar

Welcome Guest, you have to register to post here.
Search

News

Stats
74116 Posts in 6716 Topics by 8115 Members
Latest Member: salvafrench
Daimonin Forum  |  Development  |  Daimonin project  |  Topic: Why i can't use some skills in my server? « previous next »
Pages: [1] 2 Go Down Print
Topic: Why i can't use some skills in my server?  (Read 695 times)
macos0
Hobgoblin


Karma: +1/-0
Posts: 39


View Profile
« on: September 06, 2008, 03:02:16 pm »

Why i can't use some skills in my server?
Inscription ( needed )
jewelery ( not needed but wouldn't be bad )
smithery ( needed )
stealing ( not needed )
lockpicking ( needed )
« Last Edit: September 06, 2008, 10:14:53 pm by Alderan » Logged
longir
Administrator
*
*
*
*
*


Karma: +24/-4
Posts: 2974



View Profile
« Reply #1 on: September 06, 2008, 04:36:32 pm »

jewelry, smithery, stealing, lockpicking and other such skills are not currently available, thus unusable (the code needs to be rewritten).
inscription (if available at all) is currently only available to npc's using lua script due to how it is handled
Logged

DM
Dev Team Member
Site Admin

Mostly retired from playing
smacky
Administrator
*
*
*
*
*


Karma: +114/-98
Posts: 5254



View Profile
« Reply #2 on: September 06, 2008, 05:21:02 pm »

Yeah the inscription skill is not coded/working. Naomeire then Grommit wrote scripted solutions to allow players to write Vday cards, but a proper inscription skill needs a nice client-side GUI basically a mix between the book GUI, the NPC GUI, and a text editor) to make it any fun to use.

Hm, actually maybe again I am thinking of something different. I'm thinking of writing in books. Something like inscribing Elbereth on your sword wouldn't need a GUI I guess.
Logged

macos0
Hobgoblin


Karma: +1/-0
Posts: 39


View Profile
« Reply #3 on: September 07, 2008, 09:58:51 am »

well imma not the best in coding so how i could make it easy to make Readable things inscriptable?
Logged
smacky
Administrator
*
*
*
*
*


Karma: +114/-98
Posts: 5254



View Profile
« Reply #4 on: September 07, 2008, 11:22:43 am »

Wait for me to do it. Smiley

EDIT: hehe BTW I just remembered Sarah the Seamstress in Stoneglow 'inscribes' (embroiders) words onto cloth items. Seeing as I wrote the script, you'd think I'd remember it. Anyway, easily extensible to other materials/types.

Here's the relevant function:
Code:
---------------------------------------
-- Embroider: This writes a word (1-20 characters, enclosed in square brackets)
-- on to any cloth or soft leather item.
-- It is most useful to mark bags, ie, [Loot], [Food], etc.
-- Pricing depends on the values of the item:
-- 2% per character to be embroidered, plus 0.4% per letter to be unstitched
-- if the item has been embroidered before.
---------------------------------------
local function topic_serviceembroider(_confirm, _name)
    ib:SetHeader(npc:GetFace(), npc:GetName())
    ---------
    -- Player must mark the object to embroider.
    ---------
    local marked = player:FindMarkedObject()
    if not marked then
        ib:SetMsg("Oh, love-ee! Please ~M~ark the item in your inventory so I know which one to work on.")
        ib:SetButton("Goodbye", "")
        player:Interface(1, ib:Build())
        return
    end
    ib:SetTitle("Embroider " .. marked.name)
    ib:SetMsg("Ah, you want the " .. marked.name .. " embroidered? Hm, let me see...\n")
    ---------
    -- Only identified objects can be embroidered. This is technically safer.
    ---------
    if not marked.f_identified then
        ib:AddMsg("\nOh what a shame! I'm afraid I cannot embroider an unidentified item.\n")
        ib:AddMsg("\nTake it to Lathair around the corner to get it identified first.")
        ib:SetButton("Goodbye", "")
        player:Interface(1, ib:Build())
        return
    end
    ---------
    -- Only cloth (128) or soft leather (8/193) items can be embroidered.
    -- For obvious reasons.
    ---------
    local cost = { -- these are the base costs of embroidering/unstitching. The actual material of the object will modify these costs.
        embroidering = math.max(1, math.ceil(marked.value / 50)), -- 2% of item value, min 1c, per character.
        unstitching = math.max(1, math.ceil(marked.value / 250)), -- 0.4% of item value, min 1c, per character.
        total -- we have no idea until _name is specified and checked to be valid (below).
    }
    if marked.material == 128 then
        cost.embroidering = math.floor(cost.embroidering * 2) -- means 4% of item value, min 2c, per character.
        cost.unstitching = math.floor(cost.unstitching * 1) -- means 0.8% of item value, min 1c, per character.
        ib:AddMsg("\n|** " .. npc.name .. " examines the " .. marked.name .. "'s stitching closely **|\n")
        ib:AddMsg("\nThat's a nice cloth...\n")
    elseif marked.material == 8 and marked.material_real == 193 then
        cost.embroidering = math.floor(cost.embroidering * 2.5) -- means 5% of item value, min 2c, per character.
        cost.unstitching = math.floor(cost.unstitching * 1.5) -- means 1% of item value, min 1c, per character.
        ib:AddMsg("\n|** " .. npc.name .. " examines the " .. marked.name .. "'s stitching closely **|\n")
        ib:AddMsg("\nHm, it's soft leather so I'll need to use the good needles and stronger thread. " ..
                  "So I'll have to charge a little more, I'm afraid...\n")
    else
        ib:AddMsg("\nOh dear oh dear! Look at what the " .. marked.name .. " is made of.\n")
        ib:AddMsg("\nIt's really difficult to do needlework on an item made of that. " ..
                  "Only cloth or soft leather items please.")
        ib:SetButton("Goodbye", "")
        player:Interface(1, ib:Build())
        return
    end
    local embroidered = { string.find(marked.title, "%[(.+)%]") }
    ---------
    -- If player has not yet specified a string to be embroidered,
    -- Sarah examines the item and gives a per character price for the work.
    ---------
    if not _name then
        if marked.f_is_magical then
            ib:AddMsg("\nYes, I thought so. You see this stitching, love-ee? That's magic that is.\n")
            ib:AddMsg("\nMagic items are a bit more difficult to work with, so I'll have to charge a bit more.\n")
        end
        if embroidered[1] then
            ib:AddMsg("\nMm, I see this item has been embroidered before. Well, I'll have to charge a bit extra for the unstitching...\n")
        end
        ib:AddMsg("\n~" .. player:ShowCost(cost.embroidering, 1) .. "~ per character to be embroidered ")
        if embroidered[1] then
            ib:AddMsg("plus ~" .. player:ShowCost(cost.unstitching, 1) .. "~ per character to be unstitched ")
        end
        ib:AddMsg("is the best I can do, my love.\n")
        ib:AddMsg("\nSo what would you like me to embroider on the " .. marked.name .. ", young " .. gender_title .. "?")
        ib:SetTextfield("embroider ")
        ib:SetButton("Goodbye", "")
        player:Interface(1, ib:Build())
        return
    end
    ---------
    -- Make sure the specified string is within the boundaries of
    -- what is physically and cosmicly embroiderable!
    ---------
    if string.find(_name, "[^%/%'%-%+%?%!%s%w]+") or string.len(_name) > 20 then
        ib:SetMsg("|** " .. npc.name .. " chuckles softly **|\n")
        ib:AddMsg("\nOh love-ee! You don't understand embroidery do you?\n")
        ib:AddMsg("\nI lack the tools to embroider the fancier characters. " ..
                  "Stick to ~letters~, ~numbers~, ~/~, ~'~, ~+~, ~-~, ~?~, ~!~, and of course ~spaces~ only please. " ..
                  "And not more than twenty characters, my dear.")
        ib:SetTextfield("embroider ")
        ib:SetButton("Goodbye", "")
        player:Interface(1, ib:Build())
        return
    end
    if embroidered[1] then
        cost.total = (cost.embroidering * string.len(_name)) + (cost.unstitching * string.len(embroidered[3]))
    else
        cost.total = cost.embroidering * string.len(_name)
    end
    ---------
    -- Player is not confirming the request yet, so lets summarise
    -- the required embroidery, unstitching, and costs involved,
    -- and ask for confirmation.
    ---------
    if _confirm ~= "confirm" then
        ib:SetMsg("Now then, you would like me to embroider the word ~" .. string.capitalize(_name) .. "~ at ~" ..
                  player:ShowCost(cost.embroidering, 1) .. "~ per character ")
        if embroidered[1] then
            ib:AddMsg("but first I'll need to unstitch the old embroidered word ~" .. embroidered[3] .. "~ at ~" ..
                      player:ShowCost(cost.unstitching, 1) .. "~ per character ")
        end
        ib:AddMsg("which comes to a total of...\n")
        ib:AddMsg("\n|** " .. npc.name .. " does some calculations on an abacus on the countertop **|\n")
        ib:AddMsg("\nThat comes to a total of ~" .. player:ShowCost(cost.total, 1) .. "~.\n")
        ib:AddMsg("\nIs all that okay, my dear?")
        ib:SetAccept("Accept", "confirm embroider " .. _name)
        ib:SetDecline("Decline", "")
        player:Interface(1, ib:Build())
        return
    end
    ---------
    -- After all that player can't even afford it!
    ---------
    if player:PayAmount(cost.total) == 0 then
        ib:SetMsg("Not got the money, young " .. gender_title .. "?\n")
        ib:AddMsg("\nOh that's a real pity. Well as my dear departed husband -- may the Tabernacle watch over him -- used to " ..
                  "say, coins drop like the rain in Stoneglow for the dedicated adventurer.\n")
        ib:AddMsg("\nPlease come back when you have the funds!")
        ib:SetButton("Goodbye", "")
        player:Interface(1, ib:Build())
        return
    end
    ---------
    -- Woot! Let's embroider!
    ---------
    if embroidered[1] then
        marked.title = string.gsub(marked.title, "%[.+%]", "[" .. string.capitalize(_name) .. "]", 1)
    else
        marked.title = marked.title .. " [" .. string.capitalize(_name) .. "]"
    end
    player:Sound(npc.x, npc.y, game.SOUND_LEARN_SPELL)
    ib:SetMsg("|** You pay " .. npc.name .. " " .. player:ShowCost(cost.total) .. " **|")
    ib:AddIcon(marked:GetName(), marked:GetFace(), "There you go, young " .. gender_title .. ". Please come back soon!")
    ib:SetButton("Goodbye", "")
    player:Interface(1, ib:Build())
end
« Last Edit: September 07, 2008, 11:30:27 am by smacky » Logged

macos0
Hobgoblin


Karma: +1/-0
Posts: 39


View Profile
« Reply #5 on: September 07, 2008, 04:14:49 pm »

well it doesn't work if i talk to the event nothing comes out
could you check out if that script ins't written correct and could you set it for every object?
EDIT: Thanks to all in this topic ^^
Logged
smacky
Administrator
*
*
*
*
*


Karma: +114/-98
Posts: 5254



View Profile
« Reply #6 on: September 07, 2008, 07:22:53 pm »

That script works as it's a direct copy of what is running on the main server.

However it is not a complete script. As said, it is only the relevant function. So if you have any idea how a Daimonin talk script works, you can just drop it in, do something like:
Code:
tl:AddTopics({ "(embroider)", "(embroider)%s+(.+)" }, topic_serviceembroider)
tl:AddTopics("(confirm)%s+embroider%s+(.+)", topic_serviceembroider)
(again a copy from main) and you'll have your very own embroiderer.

If you don't know how a Daimonin talk script works, sorry I'm not going to teach you.

As said also, you can broaden the range of materials and types you want to be embroiderable (inscribable).
« Last Edit: September 07, 2008, 07:26:55 pm by smacky » Logged

macos0
Hobgoblin


Karma: +1/-0
Posts: 39


View Profile
« Reply #7 on: September 08, 2008, 07:00:21 am »

 Undecided lol need a teacher in lua ^^
Logged
smacky
Administrator
*
*
*
*
*


Karma: +114/-98
Posts: 5254



View Profile
« Reply #8 on: September 08, 2008, 09:33:59 am »

Start here: http://www.daimonin.com/Daipedia-tag-Scripting.html
Logged

macos0
Hobgoblin


Karma: +1/-0
Posts: 39


View Profile
« Reply #9 on: September 08, 2008, 03:46:59 pm »

i cant get this script to work X.X


Quote
require("topic_list")
require("interface_builder")

local pl = event.activator
local me = event.me
local msg = string.lower(event.message)
local pinfo_tag = "EMBROIDER"

local ib = InterfaceBuilder()
ib:SetHeader(me, me.name .. " the Embroider")

function topicDefault()
    local marked = player:FindMarkedObject()
    if not marked then
        ib:SetMsg("Oh, love-ee! Please ~M~ark the item in your inventory so I know which one to work on.")
        ib:SetButton("Goodbye", "")
        player:Interface(1, ib:Build())
        return
    end
    ib:SetTitle("Embroider " .. marked.name)
    ib:SetMsg("Ah, you want the " .. marked.name .. " embroidered? Hm, let me see...\n")
    if not marked.f_identified then
        ib:AddMsg("\nOh what a shame! I'm afraid I cannot embroider an unidentified item.\n")
        ib:AddMsg("\nTake it to a smith to get it identified first.")
        ib:SetButton("Goodbye", "")
        player:Interface(1, ib:Build())
        return
    end
    local cost = { -- these are the base costs of embroidering/unstitching. The actual material of the object will modify these costs.
        embroidering = math.max(1, math.ceil(marked.value / 50)), -- 2% of item value, min 1c, per character.
        unstitching = math.max(1, math.ceil(marked.value / 250)), -- 0.4% of item value, min 1c, per character.
        total -- we have no idea until _name is specified and checked to be valid (below).
    }
    if marked.material == 128 then
        cost.embroidering = math.floor(cost.embroidering * 2) -- means 4% of item value, min 2c, per character.
        cost.unstitching = math.floor(cost.unstitching * 1) -- means 0.8% of item value, min 1c, per character.
        ib:AddMsg("\n|** " .. npc.name .. " examines the " .. marked.name .. "'s stitching closely **|\n")
        ib:AddMsg("\nThat's a nice cloth...\n")
    elseif marked.material == 8 and marked.material == 1 and marked.material == 2 and marked.material == 3 and marked.material == 4 and marked.material == 5 and marked.material == 6 and marked.material == 7 and marked.material == 8 and marked.material == 9 and marked.material == 10 and marked.material_real == 193 then
        cost.embroidering = math.floor(cost.embroidering * 2.5) -- means 5% of item value, min 2c, per character.
        cost.unstitching = math.floor(cost.unstitching * 1.5) -- means 1% of item value, min 1c, per character.
        ib:AddMsg("\n|** " .. npc.name .. " examines the " .. marked.name .. "'s stitching closely **|\n")
        ib:AddMsg("\nHm, it's something other than my special but ok. " ..
                  "So I'll have to charge a little more, I'm afraid...\n")
    else
        ib:AddMsg("\nOh dear oh dear! Look at what the " .. marked.name .. " is made of.\n")
        ib:AddMsg("\nIt's really difficult to do needlework on an item made of that. " ..
                  "Only cloth or soft leather and special items please.")
        ib:SetButton("Goodbye", "")
        player:Interface(1, ib:Build())
        return
    end
    local embroidered = { string.find(marked.title, "%[(.+)%]") }
    if not _name then
        if marked.f_is_magical then
            ib:AddMsg("\nYes, I thought so. You see this stitching, love-ee? That's magic that is.\n")
            ib:AddMsg("\nMagic items are a bit more difficult to work with, so I'll have to charge a bit more.\n")
        end
        if embroidered[1] then
            ib:AddMsg("\nMm, I see this item has been embroidered before. Well, I'll have to charge a bit extra for the unstitching...\n")
        end
        ib:AddMsg("\n~" .. player:ShowCost(cost.embroidering, 1) .. "~ per character to be embroidered ")
        if embroidered[1] then
            ib:AddMsg("plus ~" .. player:ShowCost(cost.unstitching, 1) .. "~ per character to be unstitched ")
        end
        ib:AddMsg("is the best I can do, my love.\n")
        ib:AddMsg("\nSo what would you like me to embroider on the " .. marked.name .. ", young " .. gender_title .. "?")
        ib:SetTextfield("embroider ")
        ib:SetButton("Goodbye", "")
        player:Interface(1, ib:Build())
        return
    end
    if string.find(_name, "[^%/%'%-%+%?%!%s%w]+") or string.len(_name) > 20 then
        ib:SetMsg("|** " .. npc.name .. " chuckles softly **|\n")
        ib:AddMsg("\nOh love-ee! You don't understand embroidery do you?\n")
        ib:AddMsg("\nI lack the tools to embroider the fancier characters. " ..
                  "Stick to ~letters~, ~numbers~, ~/~, ~'~, ~+~, ~-~, ~?~, ~!~, and of course ~spaces~ only please. " ..
                  "And not more than twenty characters, my dear.")
        ib:SetTextfield("embroider ")
        ib:SetButton("Goodbye", "")
        player:Interface(1, ib:Build())
        return
    end
    if embroidered[1] then
        cost.total = (cost.embroidering * string.len(_name)) + (cost.unstitching * string.len(embroidered[3]))
    else
        cost.total = cost.embroidering * string.len(_name)
    end
    if _confirm ~= "confirm" then
        ib:SetMsg("Now then, you would like me to embroider the word ~" .. string.capitalize(_name) .. "~ at ~" ..
                  player:ShowCost(cost.embroidering, 1) .. "~ per character ")
        if embroidered[1] then
            ib:AddMsg("but first I'll need to unstitch the old embroidered word ~" .. embroidered[3] .. "~ at ~" ..
                      player:ShowCost(cost.unstitching, 1) .. "~ per character ")
        end
        ib:AddMsg("which comes to a total of...\n")
        ib:AddMsg("\n|** " .. npc.name .. " does some calculations on an abacus on the countertop **|\n")
        ib:AddMsg("\nThat comes to a total of ~" .. player:ShowCost(cost.total, 1) .. "~.\n")
        ib:AddMsg("\nIs all that okay, my dear?")
        ib:SetAccept("Accept", "confirm embroider " .. _name)
        ib:SetDecline("Decline", "")
        player:Interface(1, ib:Build())
        return
    end
    if player:PayAmount(cost.total) == 0 then
        ib:SetMsg("Not got the money, young " .. gender_title .. "?\n")
        ib:AddMsg("\nOh that's a real pity. Well as my dear departed husband -- may the Tabernacle watch over him -- used to " ..
                  "say, coins drop like the rain in Stoneglow for the dedicated adventurer.\n")
        ib:AddMsg("\nPlease come back when you have the funds!")
        ib:SetButton("Goodbye", "")
        player:Interface(1, ib:Build())
        return
    end
    if embroidered[1] then
        marked.title = string.gsub(marked.title, "%[.+%]", "[" .. string.capitalize(_name) .. "]", 1)
    else
        marked.title = marked.title .. " [" .. string.capitalize(_name) .. "]"
    end
    player:Sound(npc.x, npc.y, game.SOUND_LEARN_SPELL)
    ib:SetMsg("|** You pay " .. npc.name .. " " .. player:ShowCost(cost.total) .. " **|")
    ib:AddIcon(marked:GetName(), marked:GetFace(), "There you go, young " .. gender_title .. ". Please come back soon!")
    ib:SetButton("Goodbye", "")
    player:Interface(1, ib:Build())
end

tl = TopicList()
tl:AddGreeting(nil, topicDefault)
tl:SetDefault(topicDefault)
tl:AddTopics({ "(embroider)", "(embroider)%s+(.+)" }, topicDefault)
tl:AddTopics("(confirm)%s+embroider%s+(.+)", topicDefault)

Can some one correct me?
« Last Edit: September 08, 2008, 03:48:33 pm by macos0 » Logged
grommit
Administrator
*
*
*
*
*


Karma: +27/-2
Posts: 2482



View Profile
« Reply #10 on: September 08, 2008, 04:38:10 pm »

Because you have assigned the activator to the variable 'pl', but you are using the (undefined) variable 'player' in the rest of the script.
Logged
smacky
Administrator
*
*
*
*
*


Karma: +114/-98
Posts: 5254



View Profile
« Reply #11 on: September 08, 2008, 04:39:01 pm »

Oo! I'm impressed that you've adapted it. Smiley

So, one problem is that your script still  works on the values of _confirm and _name, but does not define these variables (which means they are nil).

You need to do:
Code:
function topicDefault(_confirm, _name)

When you put a string in parentheses in the trigger of a tl:AddTopics(), that string is a capture. Captures a passed to the action function (ie, topicDefault as arguments. So they need a variable to be stored in. In this case, _confirm and _name.
Logged

macos0
Hobgoblin


Karma: +1/-0
Posts: 39


View Profile
« Reply #12 on: September 09, 2008, 06:56:22 am »

i still cant get the script working!

Quote
require("topic_list")
require("interface_builder")

local pl = event.activator
local me = event.me
local msg = string.lower(event.message)
local pinfo_tag = "EMBROIDER"

local ib = InterfaceBuilder()
ib:SetHeader(me, me.name .. " the Embroider")

function topicDefault(_confirm, _name)
    local marked = pl:FindMarkedObject()
    if not marked then
        ib:SetMsg("Oh, love-ee! Please ~M~ark the item in your inventory so I know which one to work on.")
        ib:SetButton("Goodbye", "")
        pl:Interface(1, ib:Build())
        return
    end
    ib:SetTitle("Embroider " .. marked.name)
    ib:SetMsg("Ah, you want the " .. marked.name .. " embroidered? Hm, let me see...\n")
    if not marked.f_identified then
        ib:AddMsg("\nOh what a shame! I'm afraid I cannot embroider an unidentified item.\n")
        ib:AddMsg("\nTake it to a smith to get it identified first.")
        ib:SetButton("Goodbye", "")
        pl:Interface(1, ib:Build())
        return
    end
    local cost = { -- these are the base costs of embroidering/unstitching. The actual material of the object will modify these costs.
        embroidering = math.max(1, math.ceil(marked.value / 50)), -- 2% of item value, min 1c, per character.
        unstitching = math.max(1, math.ceil(marked.value / 250)), -- 0.4% of item value, min 1c, per character.
        total -- we have no idea until _name is specified and checked to be valid (below).
    }
    if marked.material == 128 then
        cost.embroidering = math.floor(cost.embroidering * 2) -- means 4% of item value, min 2c, per character.
        cost.unstitching = math.floor(cost.unstitching * 1) -- means 0.8% of item value, min 1c, per character.
        ib:AddMsg("\n|** " .. npc.name .. " examines the " .. marked.name .. "'s stitching closely **|\n")
        ib:AddMsg("\nThat's a nice cloth...\n")
    elseif marked.material == 8 and marked.material == 1 and marked.material == 2 and marked.material == 3 and marked.material == 4 and marked.material == 5 and marked.material == 6 and marked.material == 7 and marked.material == 8 and marked.material == 9 and marked.material == 10 and marked.material_real == 193 then
        cost.embroidering = math.floor(cost.embroidering * 2.5) -- means 5% of item value, min 2c, per character.
        cost.unstitching = math.floor(cost.unstitching * 1.5) -- means 1% of item value, min 1c, per character.
        ib:AddMsg("\n|** " .. npc.name .. " examines the " .. marked.name .. "'s stitching closely **|\n")
        ib:AddMsg("\nHm, it's something other than my special but ok. " ..
                  "So I'll have to charge a little more, I'm afraid...\n")
    else
        ib:AddMsg("\nOh dear oh dear! Look at what the " .. marked.name .. " is made of.\n")
        ib:AddMsg("\nIt's really difficult to do needlework on an item made of that. " ..
                  "Only cloth or soft leather and special items please.")
        ib:SetButton("Goodbye", "")
        pl:Interface(1, ib:Build())
        return
    end
    local embroidered = { string.find(marked.title, "%[(.+)%]") }
    if not _name then
        if marked.f_is_magical then
            ib:AddMsg("\nYes, I thought so. You see this stitching, love-ee? That's magic that is.\n")
            ib:AddMsg("\nMagic items are a bit more difficult to work with, so I'll have to charge a bit more.\n")
        end
        if embroidered[1] then
            ib:AddMsg("\nMm, I see this item has been embroidered before. Well, I'll have to charge a bit extra for the unstitching...\n")
        end
        ib:AddMsg("\n~" .. pl:ShowCost(cost.embroidering, 1) .. "~ per character to be embroidered ")
        if embroidered[1] then
            ib:AddMsg("plus ~" .. pl:ShowCost(cost.unstitching, 1) .. "~ per character to be unstitched ")
        end
        ib:AddMsg("is the best I can do, my love.\n")
        ib:AddMsg("\nSo what would you like me to embroider on the " .. marked.name .. ", young " .. gender_title .. "?")
        ib:SetTextfield("embroider ")
        ib:SetButton("Goodbye", "")
        pl:Interface(1, ib:Build())
        return
    end
    if string.find(_name, "[^%/%'%-%+%?%!%s%w]+") or string.len(_name) > 20 then
        ib:SetMsg("|** " .. npc.name .. " chuckles softly **|\n")
        ib:AddMsg("\nOh love-ee! You don't understand embroidery do you?\n")
        ib:AddMsg("\nI lack the tools to embroider the fancier characters. " ..
                  "Stick to ~letters~, ~numbers~, ~/~, ~'~, ~+~, ~-~, ~?~, ~!~, and of course ~spaces~ only please. " ..
                  "And not more than twenty characters, my dear.")
        ib:SetTextfield("embroider ")
        ib:SetButton("Goodbye", "")
        pl:Interface(1, ib:Build())
        return
    end
    if embroidered[1] then
        cost.total = (cost.embroidering * string.len(_name)) + (cost.unstitching * string.len(embroidered[3]))
    else
        cost.total = cost.embroidering * string.len(_name)
    end
    if _confirm ~= "confirm" then
        ib:SetMsg("Now then, you would like me to embroider the word ~" .. string.capitalize(_name) .. "~ at ~" ..
                  pl:ShowCost(cost.embroidering, 1) .. "~ per character ")
        if embroidered[1] then
            ib:AddMsg("but first I'll need to unstitch the old embroidered word ~" .. embroidered[3] .. "~ at ~" ..
                      pl:ShowCost(cost.unstitching, 1) .. "~ per character ")
        end
        ib:AddMsg("which comes to a total of...\n")
        ib:AddMsg("\n|** " .. npc.name .. " does some calculations on an abacus on the countertop **|\n")
        ib:AddMsg("\nThat comes to a total of ~" .. player:ShowCost(cost.total, 1) .. "~.\n")
        ib:AddMsg("\nIs all that okay, my dear?")
        ib:SetAccept("Accept", "confirm embroider " .. _name)
        ib:SetDecline("Decline", "")
        pl:Interface(1, ib:Build())
        return
    end
    if pl:PayAmount(cost.total) == 0 then
        ib:SetMsg("Not got the money, young " .. gender_title .. "?\n")
        ib:AddMsg("\nOh that's a real pity. Well as my dear departed husband -- may the Tabernacle watch over him -- used to " ..
                  "say, coins drop like the rain in Stoneglow for the dedicated adventurer.\n")
        ib:AddMsg("\nPlease come back when you have the funds!")
        ib:SetButton("Goodbye", "")
        pl:Interface(1, ib:Build())
        return
    end
    if embroidered[1] then
        marked.title = string.gsub(marked.title, "%[.+%]", "[" .. string.capitalize(_name) .. "]", 1)
    else
        marked.title = marked.title .. " [" .. string.capitalize(_name) .. "]"
    end
    player:Sound(npc.x, npc.y, game.SOUND_LEARN_SPELL)
    ib:SetMsg("|** You pay " .. npc.name .. " " .. pl:ShowCost(cost.total) .. " **|")
    ib:AddIcon(marked:GetName(), marked:GetFace(), "There you go, young " .. gender_title .. ". Please come back soon!")
    ib:SetButton("Goodbye", "")
    player:Interface(1, ib:Build())
end

tl = TopicList()
tl:AddGreeting(nil, topicDefault)
tl:SetDefault(topicDefault)
tl:AddTopics({ "(embroider)", "(embroider)%s+(.+)" }, topicDefault)
tl:AddTopics("(confirm)%s+embroider%s+(.+)", topicDefault)

what i did wrong now? when i try to talk to the NPC there comes out no interface
Logged
smacky
Administrator
*
*
*
*
*


Karma: +114/-98
Posts: 5254



View Profile
« Reply #13 on: September 09, 2008, 10:55:31 am »

You need a call to tl:CheckMessage() at the end. That's the 'active' bit of a talk script. Everything else just sets things up to work in a specified way when you /talk a specified string to it. CheckMessage actually reads the /talk string, checks it against the list of specified strings, and starts the specified actions if necessary.
Logged

macos0
Hobgoblin


Karma: +1/-0
Posts: 39


View Profile
« Reply #14 on: September 09, 2008, 11:12:22 am »

it works ^^
but what i must do to enable this script to every item?
« Last Edit: September 09, 2008, 04:27:51 pm by macos0 » Logged
Pages: [1] 2 Go Up Print 
Daimonin Forum  |  Development  |  Daimonin project  |  Topic: Why i can't use some skills in my server? « previous next »
Jump to:  

Page created in 0.27 seconds with 20 queries.
Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks
Copyright 2008 Daimonin MMORPG  •  Terms of Service  •  XHTML  •  Daimonin sourceforge open source project