Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2005
    Posts
    572

    how can i do a loop from 000 to 666

    i need to do a loop from 000 to 666 (example)
    000 001 002 003 004 005 006 010 011 012 013 014 015 016 020 021 022 023 024 025 026 ..... 666

    and put the number to text file.

    i need help

  2. #2
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Use a for loop, the AMS helpfile gives you lots of info about loops. There's also the repeat and while loop.

    Code:
    for(i=1, 666)do
       TextFile.WriteFromString(_SourceFolder.."\\loop.txt", tostring(i).."\r\n", true);
    end
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  3. #3
    Join Date
    Oct 2005
    Posts
    572

    i dont mean to count from 1 to 666

    i dont wont the numbers 7,8 and 9 i need to write to a txt file all the numbers from 000 to 666 but not the numbers with 7,8 or 9 like the example.

    000 001 002 003 004 005 006 010 011 012 013 014 015 016 020 021 022 023 024 025 026 ..... 666

    and i need it in 3 numbes (example 0 is 000 and 1 is 001)

  4. #4
    Join Date
    May 2006
    Posts
    1,443
    PHP Code:
    for i=0666 do

        if (
    10then
         
         nTemp 
    "00"..i;
         
        elseif (
    100then
        
            nTemp 
    "0"..i;
            
        else
              
    nTemp i;
        
    end
               
        TextFile
    .WriteFromString("C:\\Test.txt"nTemp.."\r\n"true);
    end 

  5. #5
    Join Date
    Oct 2005
    Posts
    572

    the dont work good

    i dont wont numbers like

    108
    109
    599
    619

    i dont wont number who include the numbers 7,8 or 9;

    thank you for the help

  6. #6
    Join Date
    May 2006
    Posts
    1,443
    did you try my sample code ..?
    it does what exactly you wanted in your first post

    but if you changed your mind or want a different thing
    just tell us what is it

    also i understood nothing from these words
    you should elaborate more to get help

    i dont wont numbers like

    108
    109
    599
    619

    i dont wont number who include the numbers 7,8 or 9;

    thank you for the help

  7. #7
    Join Date
    Jul 2002
    Location
    Just South of Reality
    Posts
    778
    Quote Originally Posted by lnd View Post
    i need to do a loop from 000 to 666 (example)
    000 001 002 003 004 005 006 010 011 012 013 014 015 016 020 021 022 023 024 025 026 ..... 666

    and put the number to text file.

    i need help
    googling we find: http://www.purplemath.com/modules/numbbase2.htm

    Using the formula for converting decimal to base 7 numbers you should be able develop a function to write your text numbers...

    hth

  8. #8
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Code:
    for i=0, 666 do
    	local LastNum = tonumber(String.Right(tostring(i), 1));
    	local s = "";
    	if(LastNum~=7)and(LastNum~=8)and(LastNum~=9)then
    		if(i<10)then
    			s = "00"..i;
    		elseif(i<100)then
    			s = "0"..i;
    		else
    			s = tostring(i);
    		end
    		TextFile.WriteFromString(_SourceFolder.."\\numbers.txt", s.."\r\n", true);
    	end
    end
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  9. #9
    Join Date
    Oct 2005
    Posts
    572

    Smile i am so stupid its so easy

    for count1 = 0, 6 do
    for count2 = 0, 6 do
    for count3 = 0, 6 do
    TextFile.WriteFromString("c:\\numbers.txt", count1 .. count2 .. count3 .. "\r\n", true);
    end
    end
    end

    thank you for the help

Posting Permissions

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