Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Parameter.text question

edited January 25 in Questions Posts: 18

Hello. I have a Urstrom about the parameter.text.
How can i make, that when i text in the parameter „a“ that i prints: „&1“?

-- Minecraft Bot

-- Use this function to perform your initial setup
function setup()
    parameter.text("TitleText", "a, b, c, d, e", function(x) print("/tell @a", x) end )
    a = "&1"
    b = "&2"
    c = "&3"
    d = "&4"
    e = "&5"
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(40, 40, 50)

    -- This sets the line thickness
    strokeWidth(5)

    -- Do your drawing here
end

function touched(touch)
    print("/tell @a", x)
end

Sorry for my English...

Comments

  • dave1707dave1707 Mod
    Posts: 6,787

    @Biberjumper Not sure if this is what you’re after. When you key a,b,c, in the text area, you print &1, &2, &3 .

    -- Minecraft Bot
    
    function setup()
        tab={a="&1",b="&2",c="&3",d="&4",e="&5"}
        parameter.text("TitleText",prt)
    end
    
    function prt()
        if tab[TitleText]~=nil then
            print(tab[TitleText])
        end
    end 
    
    function draw()
        background(40, 40, 50)
    end
    
  • Thank you! Can i make it also like this: when i write „a, b, c“ in the parameter, it will send back: „&1 &2 &3“?

  • dave1707dave1707 Mod
    Posts: 6,787

    @Biberjumper Yes you can, but you’ll have to read the TitleText and separate each entry. I don’t have time right now cause I’m leaving, but I’ll give an example later if no one does it by then.

  • dave1707dave1707 Mod
    Posts: 6,787

    @Biberjumper Here’s one way to do it. Depending on how you want the results, this can be modified more. You can key either abcde or a,b,c,d,e . I don’t know if you want the “,” after each letter or not. If you don’t want the “,” after each letter, then remove the ..”,” from the str=str..tab[v]..”,” statement.

    -- Minecraft Bot
    
    function setup()
        tab={a="&1",b="&2",c="&3",d="&4",e="&5"}
        parameter.text("TitleText",prt)
    
    end
    
    function prt()
        output.clear()
        str=""
        for z=1,#TitleText do
            v=string.sub(TitleText,z,z)
            if tab[v]~=nil then
                str=str..tab[v]..","
            end
        end
        print(str)
    end 
    
    function draw()
        background(40, 40, 50)
    end
    
  • Ok thank‘s al lot!

  • How can i Coppy the „Ausgabe“?

    Dose it give a Command for this?

  • dave1707dave1707 Mod
    Posts: 6,787

    @Biberjumper I don’t know what the Ausgabe is. I tried doing a translation and the closest word I got was output. If it is output, I’m not sure what you want to do because what prints as output is in the variable str. So you can copy str.

  • Does is need a command for this ore something else?

  • dave1707dave1707 Mod
    Posts: 6,787

    @Biberjumper Can you tell me all the things you want to do and I can give you a better example of how to do it.

Sign In or Register to comment.