Seite 62 von 342 ErsteErste ... 12 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 112 162 ... LetzteLetzte
Zeige Ergebnis 1.831 bis 1.860 von 10238

Lua Programming Help Thread

This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Zitat von Grimfate126 me 2! I need this too...

  
  1. #1831
    QJ Gamer Green
    Points: 4.779, Level: 44
    Level completed: 15%, Points required for next Level: 171
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Beiträge
    25
    Points
    4.779
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Grimfate126
    me 2!
    I need this too



  2. #1832
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    Zitat Zitat von <
    how to you code AI in Lua? (for a side scroller)
    Depends, AI is just alot of booling really. If enemy 1 walks at the speed of 1, then enemy 2 walks at speed of 2. If enemy 1Xco-Ordiante >= player1, enemy1Shooting_Function() .

    ^Just a HORRIBLE example lo. But you get the point. Maybe ill post a quick tut for easy AI waling around.

    Its proabbly the funnesyt, and hardest part of coding.

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  3. #1833
    QJ Gamer Blue
    Points: 4.890, Level: 44
    Level completed: 70%, Points required for next Level: 60
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    338
    Points
    4.890
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    Thanks an AI tutorial would be nice

  4. #1834
    Points: 5.745, Level: 48
    Level completed: 98%, Points required for next Level: 5
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    404
    Points
    5.745
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    guys i kinda forgot this but can anyone remember me how to make the hello appear and stay only when i pres X
    Code:
    blue=Color.new(0,200,350) 
    
    
    while true do      
    screen:clear()
    pad = Controls.read()
    if pad:cross() then screen:print(200, 70, "Hello!", blue) end
    
    
    if pad:select() then
    break
    end
    
    screen.waitVblankStart()
    screen.flip()
    end
    this is to make it appear while holding cross, what do i change to appear the hello and make it say after i release cross button?
    Bequiet!!!
    I'm learning cc©cc

  5. #1835
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    ok, ill probably make a basic AI tutorial in LUA, but i dunno if my syntax will be right, so I may do it in C and convert it, but i dunno stilll. What kind of AI are you looking for? Aimlessly walking around AI? If the enemy is looking toward your direction have him fire or what? ya know, just look at a pong exmaple i guess. But AI isnt really tat hard, its just alot of bools/if statements.
    Code:
    AIenemy = Image.load("AIenemy.png") --Line 1
    Player1 = Image.load("Player1.png") -- Line 2
    AIenemyX = 1 --3
    AIenemyY = 240 --4
    Player1x = 440 --5
    Player1y = 240 --6
    AIenemyWalking = 3 --7
    AIenemyCharging = 7 --8
    Seen_distance = 125 --9
    Seen_flag=false --10
    while true do --11
    	 screen:blit(blit Player1 to co-ordinates Player1x & y) -- 12
    	 screen:blit(blit AIenemy to co-ordinates AienemyX & Y) --13
    	 if AIenemyX>Player1x-Seen_distance and AIenemyX<Player1x then Seen_flag=true --14
    	 else if AIenemyX<Player1x-Seen_distance then Seen_flag=false --15
    	 else if AIenemyX==Player1x then Seen_flag=NULL --16
    	 elseif Seen_flag==false then AIenemyX=AIenemyX+AIenemyWalking --17
    	 else if Seen_flag==true then AIenemyX=AIenemyX+AIenemyCharging --18
    	 else if Seen_flag==NULL then --19
    		 AIenemyX=AIenemyX+0 --20
    		 screen: print(10, 10, "The Enemy has Charged and hit you Player1!", Color.new(120, 120, 120)) --21
    	 end --22 
    end --23
    Now, this is a pathetic atempt to give you all a general idea of AI. Since my LUA is rusty, bare with me. This is an exmaple of using bools and if statements to make a simple player1 and enemyAI interaction.

    1. Load our Enemy Image to put AI on
    2. Load our player1 Image to get abused by AI
    3. Define the Enemy's X Co-Ordinate
    4. Define the Enemy's Y Co-ordinate
    5. Define the Player1;s X Co-Ordinate
    6. Define the Player1's Y Co-Ordinate
    7. Define the Enemy's Walking Speed (3)
    8. Define the Enemy's Charging/Running Speed (7)
    9. Define the Enemy's Sight Distance
    10. Create a 'flag' to indicate what our Enemy's AI state is at
    11. While 1 = true, keep looping, and 1 = true, so infinte loop
    12. Blit the Player1 Image to the Co-Ordinates: (Player1x, Player1y)
    13. Blit the Enemy Image to the Co-ordianates: (AIenemyX, AIenemyY)
    14. Specify that if the Enemy's X co-ordinate gets too close to player1's X co-ordinate, by the Seen_distance integer, then change the Seen_flag from false, meaning no it cant see the player, to true, it can see it. please note how i put an extra 'and' statement in there. This is to say that while the Enemy is within the pixel range of 1 - 125 of Player1, he'll charge. the Pixel range shouldnt be 0-125, or else the Seen_flag will both = NULL and true, thus causing an exception handler (in C). Thats becasue Player1x and the range 0-125 have Player1x's value in there. That is the 0 pixel distance from the Enemy.
    15. ^ Complete opposite, if the Enemy's X co-ordinate is farther then its sight of view, Seen_distance, then the Seen_flag is false, since it cannot see it, thus setting up for the effect, now that we have a trigger.
    16. This is saying that if the Enemy's X Co-ord matches Player1's, then the Seen_flag=NULL. this is just used to link towards an effect, now that its a trigger. You can rename NULL, to collision_encountered, or w/e.
    17. Now that we have our triggers linked to the correct 'variable', lets substitue those variables with effects/actions shall we? this line here is saying that if our 'Seen_flag' flag/variable is triggered to = true, then the Enemy can see Player1, and will now start charging by changing the X increase speed to 7 (AIenemyCharging) from 3 (AIenemyWalking).
    18. ^ Opposite of above. if our 'Seen_flag' flag is linked/changed to 'false' then the Enemy cannot see player1, therefore he is not running, maintaining his walking speed (3).
    19. This is the 'collision' effect. It is very crappy for i am too lazy to re-convert my C collision to LUA for a simple tut. This means if our 'Seen_flag' flag is triggered towards/to NULL, then we know the Enemy and Player1 have collided.
    20. Therefore we dont want the Enemy to keep running by, we want him to stop/halt. That is why the running speed of the Enemy = 0, so he stops. P.S. i would have included the AIenemyHalt variable for when collided, but i do not want to re-order this list to accomadate to the small change in 1 line
    21. Now we can add a little more touch to our game demo type thing. When collided, it will print to the screen "The Enemy has Charged and hit you Player1!" Since well, this is true cause the enemy did collide with Player1, so it shall print the truth :mrgreen:
    22. Now Simply Close your only 'if' statement that actually needs you to close it. ('elseif' has an end built in)
    23. now just Close our infinite loop and walaa
    Now i know this is crappy, but its just to show some pople what AI really is. Plus I wrote this in about 10 minutes. There are probably some LUA syntax or mispelled errors in there.

    Hope this helps somebody! Now you cna look at Halo 2 and be like... That hunter saw me from an X co-ordinate of 'insert#here' Thats cause Bungie has somewhat of the same concept of this tut. (P.S. That is not including the Y and Z co-ordinates also when detecting presense of a player via AI)

    ~SG57

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  6. #1836
    Points: 5.745, Level: 48
    Level completed: 98%, Points required for next Level: 5
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    404
    Points
    5.745
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    help me pls.
    Code:
    screen:print(200, 136, "Click Here to Start", red)
    if pad:start() then letterPosx >= 200 and letterPosx <= 220 and letterPosy >= 136 and letterPosy <= 150 = screen:blit(0,0, blank)
    end
    I want to make my program to change to the 2nd background when I select "Click Here to Start" with the arrow and press start. the code bellow gives error =/
    can somebody help?

    and also, how can i make the arrow that i m controlling with nub stop moving at certain point, becuase so it will freeze when it tryies to get out of the screen
    Geändert von natan333 (04-25-2006 um 02:21 PM Uhr)
    Bequiet!!!
    I'm learning cc©cc

  7. #1837
    QJ Gamer Green
    Points: 4.779, Level: 44
    Level completed: 15%, Points required for next Level: 171
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Beiträge
    25
    Points
    4.779
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    all you need to do is change if pad:starts()... to

    if pad:start() and letterposx >=200 and letterPosx <= 220 and letterPosy >= 136 and letterposy <= 150 then
    screen:blit(0, 0, blank)
    end

  8. #1838
    &lt;img src=&quot;images/smilies/psp.gif&quot; border=&quot;0&quot; alt=&quot;&quot; title=&quot;&quot; cl***=&quot;inlineimg&quot; /&gt; &lt;img src=&quot;images/smilies/Punk.gif&quot; border=&quot;0&quot; alt=&quot;&quot; title=&quot;&quot; cl***=&
    Points: 11.105, Level: 69
    Level completed: 64%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    Canada
    Beiträge
    1.944
    Points
    11.105
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    can you rotate/flip images or text in lua?

    oh, and good mini AI tut SG57

  9. #1839
    Points: 5.745, Level: 48
    Level completed: 98%, Points required for next Level: 5
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    404
    Points
    5.745
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von brtn_cruzer
    all you need to do is change if pad:starts()... to

    if pad:start() and letterposx >=200 and letterPosx <= 220 and letterPosy >= 136 and letterposy <= 150 then
    screen:blit(0, 0, blank)
    end
    dint work, it gave me an error when i press start

    anyways, if "if pad:start() then screen:blit(0,0, blank)
    end" make the screen blank with an image while holding start, how can i make it blank pressing start only 1 time ?
    Bequiet!!!
    I'm learning cc©cc

  10. #1840
    QJ Gamer Silver
    Points: 9.678, Level: 66
    Level completed: 7%, Points required for next Level: 372
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    The Migrant Fleet
    Beiträge
    908
    Points
    9.678
    Level
    66
    Downloads
    0
    Uploads
    0

    Standard

    umm what does this error mean?

    Code:
     
    method must be called with a colon!

  11. #1841
    QJ Gamer Green
    Points: 5.046, Level: 45
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Michigan
    Beiträge
    104
    Points
    5.046
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von montrob
    umm what does this error mean?

    Code:
     
    method must be called with a colon!
    It means that the method you called should use a colon instead of a dot. For instance:

    Code:
    screen:print(x, y, string, color)
    as opposed to
    Code:
    screen.print(x, y, string, color)
    [QUOTE=Gutya]I think it's getting a bit stupid people posting 'I don't know' or 'I've never messed with that before', it's a waste of time. It's like buzzing in on a quizshow only to say 'I dunno...'.[/QUOTE]

  12. #1842
    Points: 5.745, Level: 48
    Level completed: 98%, Points required for next Level: 5
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    404
    Points
    5.745
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    guys whats wrong with this ???
    Code:
    tittle = Image.load("title.png")
    while true do
    
    screen:clear()
    pad = Controls.read()
    screen:blit(0,0, tittle)
    
    
    if pad:start() then playergame1() end
    
    
    if pad:select() then
    break
    end
    screen.flip()
    screen.waitVblankStart()
    end
    
    
    
    arrow = Image.load("arrow2.png")
    blank = Image.load("blank.png")
    letterPos = {}
    letterPosx = 200
    letterPosy = 150
    
    function playergame1()
    
    while true do
    screen:clear()
    pad = Controls.read()
    screen:blit(letterPosx,letterPosy, arrow)
    screen:blit(0,0, blank)
    
    
    
    
    if pad:select() then
    break
    end
    screen.flip()
    screen.waitVblankStart()
    end
    end
    is this supposed to work?? I looked at a source
    I think i put the function or the pad start function wrong. can someone correct me pls

    ~EDIT~ aaa never mind, i just changed the 1st background to be last and it worked :icon_bigg
    anyways , can someone tell how to make a moving arrow to not bypass the screen?
    Geändert von natan333 (04-25-2006 um 06:19 PM Uhr)
    Bequiet!!!
    I'm learning cc©cc

  13. #1843
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    ? Moving arrow to not bypass the screen?

    If you mean boundaries, then there simple.

    Code:
    Cursor = Image.load("cursor.png")
    CursorX=240
    CursorY = 136
    CursorMovementSpeed = 5
    CursorsDimensionY = 0 --for this ex
    CursorsDimensionX = 0 --for this ex
    while true do
    	 input = Controls.read()
    	 blit:Cursor(blit the Cursor image to (CursorX, CursorY)with dimensions (CursorsDimensionX, CursorsDimensionY))
    	 if input:up() then CursorY = CursorY - CursorMovementSpeed
    	 else if input:down() then CursorY = CursorY + CursorMovementSpeed
    	 else if input:left() then CursorX = CursorX - CursorMovementSpeed
    	 else if input:right() then CursorX = CursorX + CursorMovementSpeed
    	 else if CursorY<0 then CursorY = 0
    	 else if CursorY>272-CursorsDeimensionY then CursorY = 272-CursorsDeimensionY
    	 else if CursorX<0 then CursorX = 0
    	 else if CursorX>480-CursorsDimensionX then 480-CursorsDimensionX
    	 end
    end
    There are multiple ways to do this. I just gave a quikc wexmaple to help u. (Since well, trying to contribute to the scene as much as i can since once Sony has all the next big things out for the firmware, im upgrading :-( } Now, all you really have to change to use this for your own is replace the CursorsDimensionX wth your cursors X dimension (width), replace the CursorsDimensionY with your cursors Y dimension (height). Along with what your image of the cursor is actually called, where to load it from, etc. You may also manipulate the CursorMovementSpeed integer to your liking since that is how 'sensitive' your cursor will be. 5 is a decent value. You may also in later games or something, instead of a cursor, replace it with a rock or a shot, and have instaed of it stopping aafter offsecreen, but have it return back to the opposite side of what screen it is on to have it keep playing.

    Just a quick newbies help tut there.

    Zitat Zitat von Sousanator
    can you rotate/flip images or text in lua?

    oh, and good mini AI tut SG57
    :humped: I couldnt make it too advanced. Or else it would confuse new people. But seriously, you/I can make 'some serious stuff happen if you know what your doing :Punk:

    P.S. 4 more days of finals left! w00t w00t, then i can start coding again to finish some of my projects up.
    Geändert von SG57 (04-25-2006 um 10:44 PM Uhr)

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  14. #1844
    Points: 5.745, Level: 48
    Level completed: 98%, Points required for next Level: 5
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    404
    Points
    5.745
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    thx.... when i get back from school and i understand it and how it works, my portable paint is almost ready for its 1st verson
    :icon_smil
    Bequiet!!!
    I'm learning cc©cc

  15. #1845
    Points: 5.745, Level: 48
    Level completed: 98%, Points required for next Level: 5
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    404
    Points
    5.745
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    guys what is the code that if i press start, it will reset the function ? so it starts all over again with a new blank background if it have something before
    Geändert von natan333 (04-26-2006 um 01:31 PM Uhr)
    Bequiet!!!
    I'm learning cc©cc

  16. #1846
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    uhh... a paint program probably meaning you 'created' a blank image with its dimensions, so just use a clear image type prototype and insert your image there.

    but if your wondering for resseting a function, I thionkyou mean like running it again, which you just call, if pad:start() then reset_function_goes_here( ) end

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  17. #1847
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    uhh... a paint program probably meaning you 'created' a blank image with its dimensions, so just use a clear image type prototype and insert your image there.

    but if your wondering for resseting a function, I thionkyou mean like running it again, which you just call, if pad:start() then reset_function_goes_here( ) end
    hey SG57, this is oftopic, but are u still workin on that kitten cannon game?
    --------------------------------------------------------------------------------------

  18. #1848
    Points: 5.745, Level: 48
    Level completed: 98%, Points required for next Level: 5
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    404
    Points
    5.745
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    SG57 are you sure thats the right formula ?
    becuase it gives me error though
    Bequiet!!!
    I'm learning cc©cc

  19. #1849
    Points: 5.745, Level: 48
    Level completed: 98%, Points required for next Level: 5
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    404
    Points
    5.745
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    uhh... a paint program probably meaning you 'created' a blank image with its dimensions, so just use a clear image type prototype and insert your image there.

    but if your wondering for resseting a function, I thionkyou mean like running it again, which you just call, if pad:start() then reset_function_goes_here( ) end
    the reset and the function dint work with me but i tryed a thing that worked

    put canvas = Image.load("blank.png")
    screen:clear()
    before while true do and then
    if pad:start() then [Function()] end
    Bequiet!!!
    I'm learning cc©cc

  20. #1850
    Points: 5.745, Level: 48
    Level completed: 98%, Points required for next Level: 5
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    404
    Points
    5.745
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    I looked at some threads about if there is a way to make lua into an eboot but got confused. one sais that lua can be into a eboot and anothe guy said it cant

    Is it possible or no ?
    if it is . can you help me ?
    Bequiet!!!
    I'm learning cc©cc

  21. #1851
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    Yes there is a way, what do you think LUA Player is? Its a luaplayer ELF file, told to load the system.lua file with the luaplayer.elf in the Eboot. Meaning, either get the LUA Player Source and change it from loading system.lua to yours. Then just complie it up and your set, but you need the envirorment set up. Or just take the Lua Windows eboot, and swap the lua script with yours, and edit the % folder eboot to your liking, meaning image, sound, etc.

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  22. #1852
    QJ Gamer Green
    Points: 6.520, Level: 52
    Level completed: 85%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    Sweden
    Beiträge
    460
    Points
    6.520
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    What the heck is wrong with my code?!

    It says that file is a nil value when i trying to write, but it's not!
    It wrote the file before, but i changed a thing that shouldent matter at all.
    Then it don't reads from "text.txt".

    Please help me out!
    Code:
    ----Write FUNCTION
    function Write(filename,variabel)
    file = io.open(filename,"w")
    file:write(variabel)
    file:close()
    end
    
    ----Read FUNCTION
    function Read(filename,variabel)
    file = io.open(filename,"r")
    variabel = file:read()
    file:close()
    end
    
    
    ----Write
    if pad:square() then
    Write("text.txt",Name)
    end
    
    ----Read
    if pad:cross() then
    Read("text.txt",Name)
    end
    [CENTER]Some of my homebrew Applications/Games:
    [URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
    [URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]

    [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]

  23. #1853
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    I think i know your problem. Your trying to write/read strings from/to a file. Well I belive you have to put " " around the string you plan on writing, or the text your writng to the file in lamen terms. Like when using screen: print(), you put the words/text in " ". screen: print("Hello"). This may be the problem because in C, you cant just write to a file the words Hello World as plain as that. You must either have a buffer for the string to be held in, or just write it out without using any variables that are being chagned alot.

    fwrite(FILE*, Hello World); // <------DOESNT WORK

    fwrite(FILE*, "Hello World"); // <-----DOES WORK

    If my structure of the fwrite function is correct, then ya, that will work^.

    Basically, I dont know if LUA does this or not, but I think you have to either have a buffer/array with the text you want/string in it, then write that to a file.

    Oh and your having a problem with reading from afile. Your problem is probably that the 'variabel' thing that you replace, is not a buffer, or an array.

    So to fix that problem, try making the word Name, a character array.

    Name[]="" --Not sure you need these...

    maybe you could do this without a problem?

    Name[255]

    Im not sure if LUA uses allocating memory... But w/e, maybe. Thats what the 255 is for, that means that this Name buffer can hold up to 255 bytes/characters. (I believe characters, Im not 100% sures ince its in the morning)
    Then go and do your read function. This should, in your functions process, when callin variabel = file:read(), your actually going to be calling, if using Name array/buffer, Name = file:read(). That will put whatever is in the file your reading from, into the Name array/buffer, and its ready to be printed to the screen, edited, copied, etc.

    I dont think any of this helps since Im not frequently coding in LUA, but maybe, tell me if so.
    Geändert von SG57 (04-27-2006 um 07:11 AM Uhr)

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  24. #1854
    QJ Gamer Green
    Points: 6.520, Level: 52
    Level completed: 85%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    Sweden
    Beiträge
    460
    Points
    6.520
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    I got the writing fully working now but I
    still can't get it read at all.
    Geändert von HaxxBlaster (04-27-2006 um 11:05 AM Uhr)
    [CENTER]Some of my homebrew Applications/Games:
    [URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
    [URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]

    [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]

  25. #1855
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    What is the Name thing your using, is it a variable? when reading from a file, feeed what you read into an array/buffer. meaning make name, Name[255]

    See what happens, or just tell me what Name is.

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  26. #1856
    Points: 5.745, Level: 48
    Level completed: 98%, Points required for next Level: 5
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    404
    Points
    5.745
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    Yes there is a way, what do you think LUA Player is? Its a luaplayer ELF file, told to load the system.lua file with the luaplayer.elf in the Eboot. Meaning, either get the LUA Player Source and change it from loading system.lua to yours. Then just complie it up and your set, but you need the envirorment set up. Or just take the Lua Windows eboot, and swap the lua script with yours, and edit the % folder eboot to your liking, meaning image, sound, etc.

    dint understand nothing what to do. if you make a tutorial. that will be really nice
    but though, it gives a error when i try to make an eboot with luaplayer source
    Geändert von natan333 (04-27-2006 um 05:36 PM Uhr)
    Bequiet!!!
    I'm learning cc©cc

  27. #1857
    Points: 4.419, Level: 42
    Level completed: 35%, Points required for next Level: 131
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    Upland, California
    Beiträge
    89
    Points
    4.419
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard help

    in my game i am try ing to load numbered images
    heres my code:
    Code:
    for a = 1,1362 do
    local a
    image[a]=Image.load("image"..a".jpeg")
    end
    PSP 1.5
    Psp homebrew projects:
    psp RTS

    MY WEBPAGE

  28. #1858
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    And are you getting an error? Cause i think your missing something in there too. Arrays count0 as a place holder, so set a = 0 if your having trouble blitting thos images or w/e.

    Unless the LUA for do loop cannot have anything other than 1 there, since it increases by that number or something? I dunno, not really frequent i n LUA.

    Zitat Zitat von natan333
    dint understand nothing what to do. if you make a tutorial. that will be really nice
    but though, it gives a error when i try to make an eboot with luaplayer source
    Ok, go and download hte app PSP Windows, its in LUA. Take the EBOOT, and rename your script to matach theres and the structure of where it is and such. Then just use kxploit to make an icon thing, then edit its picture and junk.

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  29. #1859
    QJ Gamer Green
    Points: 6.520, Level: 52
    Level completed: 85%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    Sweden
    Beiträge
    460
    Points
    6.520
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    The variable "Name" is just a simple string like this:
    Code:
    Name = "Text"
    [CENTER]Some of my homebrew Applications/Games:
    [URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
    [URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]

    [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]

  30. #1860
    QJ Gamer Gold
    Points: 18.627, Level: 86
    Level completed: 56%, Points required for next Level: 223
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Ort
    LOLWUT
    Beiträge
    2.625
    Points
    18.627
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    Hello all, can someone help me with this code? For some reason, when I try to run it on the PC, it creates a luaplayer.exe.stackdump file. The code:

    Code:
     
    
    red=Color.new(255,0,0)
    green=Color.new(0,255,0)
    blue=Color.new(0,0,255)
    white=Color.new(255,255,255)
    
    duh=Image.load("duh.png")
    counter=Timer.new()
    counter:start()
    screen:blit(50,50,"duh.png")
    while true do
    pad=Controls.read()
    
    if pad:up() then
    duh.y=duh.y + 2
    end
    
    if pad:down() then
    duh.y=duh.y - 2
    end
    
    if pad:right() then
    duh.x=duh.x + 2
    end
    
    if pad:left() then
    duh.x=duh.x - 2
    end
    
    currentTime=counter:time()
    screen:clear(blue)
    screen:print(10,10,"Counter Time: " .. currentTime, white)
    
    if currentTime > 2500 and currentTime < 5000 then
    screen:clear(red)
    end
    
    if currentTime > 5001 then
    counter:reset(0)
    counter:start()
    end
    
    screen.waitVblankStart()
    screen.flip()
    end
    When the stackdump is opened with notepad, its:

    Code:
    Stack trace:
    Frame     Function  Args
      49774 [sig] luaplayer 2112 handle_threadlist_exception: handle_threadlist_exception called with threadlist_ix -1
      75965 [sig] luaplayer 2112 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
    Exception: STATUS_ACCESS_VIOLATION at eip=61015E82
    eax=7C802542 ebx=610E7ECC ecx=00000000 edx=0000001B esi=00000000 edi=00000001
    ebp=00A2E6E8 esp=00A2E6E4 program=C:\Documents and Settings\FattyMcFat\Desktop\luaplayerwindows\luaplayer.exe, pid 2112, thread sig
    cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
    Stack trace:
    Frame     Function  Args
    00A2E6E8  61015E82  (610E7ECC, 0022E598, 00000001, 00000000)
    00A2E708  61015FAC  (00000001, 00A2E760, 00000000, 00000000)
    00A2EA58  610179AB  (000006F4, 00A2EED0, 000000A4, 00A2EE9C)
    00A2EF98  6108A497  (610E6D18, 00000000, 00000F84, 00000000)
    00A2EFC8  6100327F  (610E6D18, 00A2F000, 61003160, 00000000)
    00A2EFF8  61003E94  (00000000, 00000000, 00000000, 00000000)
    00A2FF98  61003EDA  (00000000, 00000000, 00000000, 00000000)
    End of stack trace
    Can someone help? And thanks in advance!


 

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 07:52 AM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .