| View previous topic :: View next topic |
| Author |
Message |
2Xtremes2004
Joined: 31 Aug 2005 Posts: 53
|
Posted: Mon Sep 12, 2005 10:52 am Post subject: Function help plz |
|
|
Can anyone help me turn this into a function? Im still haveing a few problems trying to learn functions.
| Code: |
if usb==1 then
System.usbDiskModeActivate()
screen:blit(1, 3, usba)
end
if usb==0 then
System.usbDiskModeDeactivate()
end
pad = Controls.read()
if pad:select() then
screen.waitVblankStart(20)
if usb==1 then
usb = 0
else
usb = 1
end
|
_________________ I want my money back!? |
|
| Back to top |
|
 |
chaos
Joined: 10 Apr 2005 Posts: 135
|
Posted: Mon Sep 12, 2005 12:58 pm Post subject: |
|
|
| Code: | -- a function to toggle usb mode
function toggleUSB()
if usb==0 then
System.usbDiskModeActivate()
screen:blit(1, 3, usba)
usb = 1
else
System.usbDiskModeDeactivate()
usb = 0
end
end
-- the rest of this should be in your main loop
pad = Controls.read()
if pad:select() then
toggleUSB()
end
|
_________________ Chaosmachine Studios: High Quality Homebrew. |
|
| Back to top |
|
 |
2Xtremes2004
Joined: 31 Aug 2005 Posts: 53
|
Posted: Mon Sep 12, 2005 1:22 pm Post subject: |
|
|
thank you so much, this will give me a good example to help me learn more! Again, thx _________________ I want my money back!? |
|
| Back to top |
|
 |
chaos
Joined: 10 Apr 2005 Posts: 135
|
Posted: Mon Sep 12, 2005 1:34 pm Post subject: |
|
|
glad i could help. _________________ Chaosmachine Studios: High Quality Homebrew. |
|
| Back to top |
|
 |
|