Results 1 to 9 of 9

Thread: Multi-line comments..

  
  1. #1
    LordCthulu is offline Senior Member -Hacks Enthusiast
    Join Date
    Mar 2005
    Posts
    578
    Rep Power
    15

    Default

    Ok, I thought I read it in the manual, so I just looked and oculdn't find it.
    I know I read it somewhere, but I don't remember where ><;
    I know this is stupid, but modsyns usage of it:
    --[[
    commentz
    yup thats right
    comments W00T
    fyi this wont work
    ]]
    does not work (at least not in the LuaIDE im using)
    So if someone can please tell me how to comment multiple lines without using the -- on every line, i'd greatly appreciate it!

    Oldest psp-hacks member ever.

  2. #2
    modsyn is offline -Hacks Guru
    Join Date
    Aug 2005
    Location
    Shinigami Kurosaki Ichigo!
    Posts
    2,475
    Rep Power
    17

    Default

    hmm. that's strange. so the luaide lets you test your scripts on the pc?

    i've just been editing the script, saving, and hitting start on the psp to
    reload the script for my testing. i know that the --[[ blah ]] style multiline
    comments work on the psp for luaplayer .10. maybe shine and nevyn just
    added that for the psp to make everyone's life easier. idk
    jMEnc Guide, jMEnc2 page - by the way, you smell nice

  3. #3
    LordCthulu is offline Senior Member -Hacks Enthusiast
    Join Date
    Mar 2005
    Posts
    578
    Rep Power
    15

    Default

    Yeah, once you make a project just compile/build it, then hit go, and it runs in a system shell.
    Oldest psp-hacks member ever.

  4. #4
    modsyn is offline -Hacks Guru
    Join Date
    Aug 2005
    Location
    Shinigami Kurosaki Ichigo!
    Posts
    2,475
    Rep Power
    17

    Default

    neat. i prefer to test on the psp, though. that way you can see how it will
    really perform.

    i see you made mod. congratulations :mrgreen:
    jMEnc Guide, jMEnc2 page - by the way, you smell nice

  5. #5
    LordCthulu is offline Senior Member -Hacks Enthusiast
    Join Date
    Mar 2005
    Posts
    578
    Rep Power
    15

    Default

    Yeah, I have to test on psp, lol.
    Last I checked my computer doesn't have cross(), square(), triangle(), circle() hehe.
    But you can write stuff for PC too.

    hehe thanks :D
    I gotcha hooked up in the Lua section ;)

    Hey do you have ANY instant messenger? I have a question on a script I want to talk about, but its a PITA talking over forums lol
    Oldest psp-hacks member ever.

  6. #6
    modsyn is offline -Hacks Guru
    Join Date
    Aug 2005
    Location
    Shinigami Kurosaki Ichigo!
    Posts
    2,475
    Rep Power
    17

    Default

    no, i don't. most of the time i'm either at work or school and both don't
    allow any messenger programs. sorry.
    jMEnc Guide, jMEnc2 page - by the way, you smell nice

  7. #7
    LordCthulu is offline Senior Member -Hacks Enthusiast
    Join Date
    Mar 2005
    Posts
    578
    Rep Power
    15

    Default

    Ok i'll post the code (or you can download the script in the download section)

    The problem is, I have it set (in this version) to switch the canvas color when you hit the L and R buttons. It works, but it doesnt go in order like it should.
    You'll hopefully understand when you see the script, but for some reason it doesn't go from 0>1>2>3>4 and then start out at 0 again. That and it has a tendency to switch multiple canvases at once if you dont hit it really fast, or if you hold it goes through them at lightspeed :O
    Anyway, the older version, new version uses square button.

    Code:
    System.usbDiskModeActivate&#40;&#41;
    red = Color.new&#40;255, 0, 0&#41;;
    white = Color.new&#40;255, 255, 255&#41;;
    blue = Color.new&#40;0, 0, 255&#41;;
    black = Color.new&#40;0, 0, 0&#41;;
    green = Color.new&#40;0, 255, 0&#41;;
    grey = Color.new&#40;123, 123, 123&#41;
    
    canvas = Image.createEmpty&#40;480, 272&#41;
    canvas&#58;clear&#40;white&#41;
    
    brush = &#123;&#125;
    eraser = &#123;&#125;
    
    x0 = 0
    y0 = 0
    x1 = 0
    y1 = 0
    
    drawColor = 0;
    canvasColor = 0;
    
    -- Function to clear canvas,
    -- depending on its current color
    -- 0=white | 1=blue | 2=red | 3=green | 4=black
    function clearCanvas&#40;&#41;
       if canvasColor == 0 then
          canvas&#58;clear&#40;white&#41;
       elseif canvasColor == 1 then
          canvas&#58;clear&#40;blue&#41;
       elseif canvasColor == 2 then
          canvas&#58;clear&#40;red&#41;
       elseif canvasColor == 3 then
          canvas&#58;clear&#40;green&#41;
       elseif canvasColor == 4 then
          canvas&#58;clear&#40;black&#41;
       end
    end
    
    while true do
    
       pad = Controls.read&#40;&#41;
       dx = pad&#58;analogX&#40;&#41;
       dy = pad&#58;analogY&#40;&#41;
    	if math.abs&#40;dx&#41; > 32 then
    		x0 = x0 + dx / 64
    	end
    	dy = pad&#58;analogY&#40;&#41;
    	if math.abs&#40;dy&#41; > 32 then
    		y0 = y0 + dy / 64
    	end
    
    	if pad&#58;cross&#40;&#41; then
          if drawColor == 0 then
             canvas&#58;drawLine&#40;x0, y0, x1, y1, black&#41;
          elseif drawColor == 1 then
             canvas&#58;drawLine&#40;x0, y0, x1, y1, red&#41;
          elseif drawColor == 2 then
             canvas&#58;drawLine&#40;x0, y0, x1, y1, blue&#41;
          elseif drawColor == 3 then
             canvas&#58;drawLine&#40;x0, y0, x1, y1, green&#41;
          end
       end
    
    -- L/R Canvas delimiter
       if pad&#58;l&#40;&#41; then
          if canvasColor <= 0 then
             canvasColor = 4
             clearCanvas&#40;&#41;
          else
             canvasColor = canvasColor - 1
             clearCanvas&#40;&#41;
          end
       end
       if pad&#58;r&#40;&#41; then
          if canvasColor >= 4 then
             canvasColor = 0
             clearCanvas&#40;&#41;
          else
             canvasColor = canvasColor + 1
             clearCanvas&#40;&#41;
          end
       end
    
       if pad&#58;up&#40;&#41; then
          drawColor = 0
       elseif pad&#58;down&#40;&#41; then
          drawColor = 1
       elseif pad&#58;left&#40;&#41; then
          drawColor = 2
       elseif pad&#58;right&#40;&#41; then
          drawColor = 3
       end
    
       if pad&#58;triangle&#40;&#41; then
          clearCanvas&#40;&#41;
       end
    	x1 = x0
    	y1 = y0
    	screen&#58;blit&#40;0, 0, canvas, 0, 0, canvas&#58;width&#40;&#41;, canvas&#58;height&#40;&#41;, false&#41;
    	screen&#58;drawLine&#40;x1 - 5, y1, x1 + 5, y1, red&#41;
    	screen&#58;drawLine&#40;x1, y1 - 5, x1, y1 + 5, red&#41;
       screen&#58;print&#40;11, 11, "X&#58; " .. tostring&#40;dx&#41;, red&#41;
       screen&#58;print&#40;11, 21, "Y&#58; " .. tostring&#40;dy&#41;, red&#41;
       screen&#58;print&#40;11, 31, "CanvasColor = " .. tostring&#40;canvasColor&#41;, grey&#41;
    
       screen.waitVblankStart&#40;&#41;
       screen.flip&#40;&#41;
       if pad&#58;start&#40;&#41; then break end
       if pad&#58;select&#40;&#41; then screen&#58;save&#40;"screenshot.tga"&#41; end
    end
    Oldest psp-hacks member ever.

  8. #8
    modsyn is offline -Hacks Guru
    Join Date
    Aug 2005
    Location
    Shinigami Kurosaki Ichigo!
    Posts
    2,475
    Rep Power
    17

    Default

    here's some of my code that is similar to what you're trying to
    accomplish

    Code:
    oldPad = Controls.read&#40;&#41;
    while true do
      pad = Controls.read&#40;&#41;
      if pad&#58;r&#40;&#41; then
        if pad ~= oldPad then
          mode = mode + 1
          if math.mod&#40;mode, 2&#41; == 0 then
            mode = 0
          end
        end
      end
    pad = Controls.read&#40;&#41;
    end
    the part "pad ~= oldPad" takes care of the lightspeed button pushing,
    and the mode part can be modified to fit your code. instead of modding
    with 2 you'd mod with 4. then you could do the same for pad:l()
    jMEnc Guide, jMEnc2 page - by the way, you smell nice

  9. #9
    LordCthulu is offline Senior Member -Hacks Enthusiast
    Join Date
    Mar 2005
    Posts
    578
    Rep Power
    15

    Default

    Hm..lemme try and change it real fast..if i get a chance...
    /bitchslap_work
    Oldest psp-hacks member ever.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •