Problem when make a database for equipment

Post Reply
doubleruri
Posts: 1
Joined: Wed Mar 27, 2024 8:19 am

Problem when make a database for equipment

Post by doubleruri »

After 10 years, I come back to MUD~~ :D

Now I don't have much time for find what equipment to wear for different situation.I want make a database to quickly find what I need.(Old information of EQs is post on BBS)
After serveral days scripting for catch information , I meet problem when adding data to SQLite DB...

The identify example is like below: (In Chinese Traditional, I translate and mark with different color in English at right)
物品名稱: 火靈之吻(kiss of salamander) Item: 火靈之吻(kiss of salamander)
物品狀態: 發光 .Flag: Glowing
裝備位置: 盾牌Wear: shield
影響 智力 2 點. Int 2
The problem is
  1. Can I name Table with non-English but other language encoding in UTF-8?
    I create a database

    Code: Select all

    db:create("eqbank", {shield = "名稱","狀態","智力"})
    work and show correct in DB browser. But when I add data in Mudlet, I cannot did it.

    Code: Select all

    local mydb =  db:get_database("eqbank")
    db:add(mydb.Shield, {名稱 = "火靈之吻" ,狀態 = "發光", 智力 = 2})
    db:close(mydb)
    Mudlet says syntax error near symble = and give me a little ladybug XD
    I tried use [[名稱]] and "名稱" '名稱', all are wrong, but I change table name in English, It work!
    I am not a English player, reading 90+ information in mother langue will be more happy.
    Database.jpg
  • 2. How to script correctly and lightly when adding data to database?
    I made a alias for test

    Code: Select all

    pattern: ^dddd$
    code: local mydb = db:get_database("eqbank")
    db:add(mydb.Shield,{Int=15})
    
    Nothing add, Error report is :
    LUA ERROR: when running script writedata (Alias86),
    reason: ...ppData\Local\Mudlet\app-4.17.2\mudlet-lua\lua\DB.lua:780: attempt to index local 'conn'
    (a nil value)

    And put db:create in that will work

    Code: Select all

    pattern: ^dddd$
    code: 
    db:create("eqbank", {shield = "Name","Flag","Int"})
    local mydb = db:get_database("eqbank")
    db:add(mydb.Shield,{Int=15})
    
    my database will be 10 sheets (hands/boots/etc..) , every sheet has 90 column
    If put every db:create code before I add data, script will be more complex.
    How to resolve it??
  • Question3 is : Can I add data in Mudlet table like Cmud?
    I have a data in table:
    i.e.

    Code: Select all

    ItemData = {Name = "shield", Flag = "glow" , Int = 2}
    In Cmud I can use (#new ItemData) to put every data into db (but Cmud is crash too often :? )
    In Mudlet, Is there simple script instead of put every key in table one by one?
    P.S. My colum is same as variants i.e Name = ItemData .Name AC=ItemData .AC

Post Reply