I Need a lua script!

  • DRAGONF0RCE
    25th Sep 2011 Member 0 Permalink
    EDIT: Could someone move this to the Lua Scripting section?

    I'm not sure how exactly it should work since I don't have any experience with lua, but I have an idea of how it might work.

    When you use the script, you should be able to put in a few variables:
    1. x (integer [any positive or negative number, but no decimals/fractions])
    2. y (integer)
    3. Ta, Tb Tc, etc. (integer)
    4. a, b, c, etc. (element)
    5. n (natural number. [any whole number that's 1 or higher])

    Also, there should be one variable that is automatically changed in the script:
    -Ua, Ub, Uc, etc.

    This is what it should do:

    1. Paste the most recent stamp.
    2. Decrease the value of n by 1.
    3. Set Ua's value to Ta * 2, set Ub to Tb * 2, etc.
    4. If n = 0, stop. If n > 0, go to step 4.
    5. Paste the most recent stamp.
    6. Shift it to the right x pixels.
    7. Shift it up y pixels.
    8. Increase element a's temperature by Ua
    9. Increase Ua by Ta
    10. Repeat 7-9 for all other elements given
    11. Go to step 4

    The function of this is to create multiple copies of a stamp with certain parts heated or cooled. This would be EXTREMELY useful for creating electronics that use WIFI or PRTI/PRTO - I'm not even going to try to set 147 WIFI/PRTI channels by hand, which I have to for something I want to make.

    Thanks SO much to anyone who is willing to take the time to code this!
  • alecnotalex
    25th Sep 2011 Member 0 Permalink
    @DRAGONF0RCE (View Post)
    You should use that guys wifi and dlay setting thingy. It's pretty neat. Let me see if I can find it for you...
    Here it is: (credit to lookitsan00b)
    tpt.set_console(0)
    function change_wifi(mbq, mb, mx, my)
    if (mbq == 1) then do
    type = tpt.get_property("type", mx, my)
    if (type == 124 or type == 109 or type == 110) then do
    local chan = tpt.input("Channel Setup", "Enter a channel -3 to 99.")
    tpt.set_property("temp", chan * 100 + 323.15, mx, my)
    end elseif (type == 79) then do
    local dlay = tpt.input("Delay Setup", "Enter a delay 2 to 256")
    tpt.set_property("temp", dlay + 273.15, mx, my)
    end else do
    tpt.log(mx..", "..my..", "..type)
    return true
    end end
    end else return true end
    end
    tpt.register_mouseclick(change_wifi)
  • DRAGONF0RCE
    25th Sep 2011 Member 0 Permalink
    I've never used the console, how do I use this script? Just type it in line by line?

    Also, it appears to me that it works by increasing WIFI/PRTI/PRTO/DLAY temp when those elements are clicked. Is that how it works?

    Thanks!
  • alecnotalex
    25th Sep 2011 Member 0 Permalink
    @DRAGONF0RCE (View Post)
    Download this http://my.ilstu.edu/~wbseitz/setWifi.lua and save it in your Powder toy folder. Run Powder toy. Press d to change to debug mode. Open the console. Type dofile('setWifi.lua'). It should work. Now, make a dot of wifi. It should prompt you to choose a channel.
  • DRAGONF0RCE
    25th Sep 2011 Member 0 Permalink
    I downloaded it and typed it into the console. I didn't get an error message of any kind, but nothing is different... I'm not sure what the problem is.

    It's probably that it's not in debug mode, but "d" just adds or removes information from the HUD. It doesn't really make TPT act any differently.
  • BlueAmulet
    25th Sep 2011 Member 0 Permalink

    Deleted

    Edited once by BlueAmulet. Last: 12th Apr 2024
  • DRAGONF0RCE
    25th Sep 2011 Member 0 Permalink
    @gamax92 (View Post)
    Learn to read. I clearly said that I couldn't figure out how to put it in debug mode.

    I think I did put it into debug mode anyway, I just didn't know that that was what it was called. I looked at the properties of the file, and since it was a code that came from another computer, my computer had it set to not open in case it was a virus. I unblocked it and it works fine now.

    @alecnotalex
    Thanks SO much! I have to set around 1,500 or so PRTI/PRTO/WIFI particles on at least 150 different channels, so this is a tremendous help. I would never do this with HEAT/COOL.