Please help me,CHDK‘s grd - General Help and Assistance on using CHDK stable releases - CHDK Forum

Please help me,CHDK‘s grd

  • 12 Replies
  • 2747 Views
Please help me,CHDK‘s grd
« on: 26 / June / 2012, 07:58:18 »
Advertisements
hello,everybody。first,i'm chinese。english very bad。

I can't open the :http://dataghost.com/chdk/text2grid.php  and  http://dataghost.com/chdk/text2grid.phps  (maybe my Country restrictions)

did you have other edit .grd tools??? please ,send me ,thanks.

Re: Please help me,CHDK‘s grd
« Reply #1 on: 26 / June / 2012, 08:49:35 »
Those links appear to be dead - no response from here so its not your Country restrictions.

The links were to php code that had to be hosted on a web server.  I do not know if the source for that code is available - I could not find it with google.



Ported :   A1200    SD940   G10    Powershot N    G16

Re: Please help me,CHDK‘s grd
« Reply #2 on: 26 / June / 2012, 09:19:14 »
Possibly the whole dataghost disappeared... Maybe somebody (especially the creator) still owns the code.

AFAIK beside above sites there is no WYSiWYG grid editor... I was thinking about writing my own on-camera grid editor, which wouldn't be very hard with use of Lua (at least much more simple than text editor;), but have still not enough time... Currently you have to stay with grids already published on wikia or making them just by typing the code... Of course you could write your own editor, everybody would appreciate:D
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: Please help me,CHDK‘s grd
« Reply #3 on: 26 / June / 2012, 21:02:43 »
 :D
first,thanks for The upstairs。
yes,I'm want to find a Visual grid editor。 hope that developers can provide。(HaHa,my English is Too bad,I wish to be able to understand)


Re: Please help me,CHDK‘s grd
« Reply #4 on: 26 / June / 2012, 23:05:12 »
first,thanks for The upstairs。
yes,I'm want to find a Visual grid editor。 hope that developers can provide。(HaHa,my English is Too bad,I wish to be able to understand)
Your English is good enough and your request is understood.  However,  there is currently nobody working on that project.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline hwntw

  • ***
  • 158
Re: Please help me,CHDK‘s grd
« Reply #5 on: 27 / June / 2012, 06:06:56 »
Hello,
The attached LUA file allows testing/viewing of the text based GRD files.
Not my work, see LUA files for details of originator.

Best,

Colin
Ixus 300HS S100


Windows 10

Re: Please help me,CHDK‘s grd
« Reply #6 on: 27 / June / 2012, 09:26:30 »
This is interesting stuff, and I supose usefull on PC, but the 6th line of the script contains a comment:

Code: [Select]
script intended for use on a PC with standard Lua distribution

This script can not be used on-camera - it needs PC. Even if a program is written in Lua it doesn't mean it will run on camera. This script requires specific libraries, which are not accessible on cameras. And probably never will.

For on-camera viewer (and further editor) one need to use Lua drawings commands.

However nice finding ;)
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: Please help me,CHDK‘s grd
« Reply #7 on: 27 / June / 2012, 09:54:41 »
This script can not be used on-camera - it needs PC. Even if a program is written in Lua it doesn't mean it will run on camera. This script requires specific libraries, which are not accessible on cameras. And probably never will.
Wasn't able to find them in the repository for my Linux PC either - have not tried Windows yet.

Quote
For on-camera viewer (and further editor) one need to use Lua drawings commands.
Actually,  there is a much easier way to get an "on-camera" viewer ....

Ported :   A1200    SD940   G10    Powershot N    G16


Re: Please help me,CHDK‘s grd
« Reply #8 on: 27 / June / 2012, 14:32:23 »
Code: [Select]
Actually,  there is a much easier way to get an "on-camera" viewer ....

Sure :D But I was thinking about development of on-camera editor, so the viewer would be first task.
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: Please help me,CHDK‘s grd
« Reply #9 on: 27 / June / 2012, 19:09:05 »
Ok, I've started development of the on-camera editor. At the moment it works only as a grid viewer. Any feedback welcome.

Limitations:

- no string support (yet, not a big deal)
- fails with sports.grd from standard CHDK - this grid has a bug - 'X' instead of 'x'.

Don't need to copy the code, lua file in attachment ;)

Code: (lua) [Select]
--[[
@title Grid editor

@param s Browser in GRIDS? (1=Yes)
@default s 1
@values s 0 1

@param a nothing
@default a 0
--]]

require "drawings"

--defaults and so on
PATH="A"        --where to open file_browser()?


--some other globals
file=nil        --nobody knows why lower-case...
FILENAME=""
FILE_CONTENT={}
FILE_LINESN=0   --this should be removed, it's just stupid - we have table.getn()
TITLE=""


function load_file()
    if s==1 then
        PATH="A/CHDK/GRIDS"
    end
    file=file_browser(PATH)
    if file==nil then
        print("No file selected!")
        --restore()
    else
        --here we process the PATH to get the FILENAME
        --I don't remember how does it work, but it does
        for li=0,string.len(file) do
            char=string.sub(file,string.len(file)-li,string.len(file)-li)
            if char~="/" then
                FILENAME=char..FILENAME
            else break
            end
        end
       
       
        --lets try to load this file--
        file_h=io.open(file,"r")
        print("Loading, wait...")
        FILE_CONTENT={}
        line=1
        repeat
            FILE_CONTENT[line]=file_h:read("*line")
            FILE_LINESN=line-1
            line=line+1
            until FILE_CONTENT[line-1]==nil
        file_h:close()
        if FILE_CONTENT[1]==nil then FILE_CONTENT={""} end
        if FILE_LINESN==0 then FILE_LINESN=1 end
    end
end

function process_file()
    --here we'll change the file info into drawings
    --all comments are lost!!!
    --Step 1 - walk through the file
    line=1
    repeat
        print(FILE_CONTENT[line])
       
        --check whether this line means something
        char=string.sub(FILE_CONTENT[line],1,1)
        --print(char)
        if char=="@" then --woohoo! found a command!
            --now we need to see, what's that...
            --the interpreter is dirty and assumes that everywhere you have one space. To be fixed.

            --@title
            if string.sub(FILE_CONTENT[line],1,6)=="@title" then
                TITLE=string.sub(FILE_CONTENT[line],8,string.len(FILE_CONTENT[line]))
                type="title"

            --@rectf
            elseif string.sub(FILE_CONTENT[line],1,6)=="@rectf" then
                type="rectf"
                --print("->rectF")
                --draw.add("rectf")

            --@elpsf
            elseif string.sub(FILE_CONTENT[line],1,6)=="@elpsf" then
                type="elpsf"
                --print("->elpsF")

            --@line
            elseif string.sub(FILE_CONTENT[line],1,5)=="@line" then
                type="line"
                --print("->line")

            --@rect
            elseif string.sub(FILE_CONTENT[line],1,5)=="@rect" then
                type="rect"
                --print("->rect")

            --@elps
            elseif string.sub(FILE_CONTENT[line],1,5)=="@elps" then
                type="elps"
                --print("->elps")
            end

            --now process the params
            param_no=1  --which param we process now
            params={}
            pos=string.len(type)+2
            if type~="title" then
                repeat
                    --remove spaces - if space then not do anything
                    ch=string.sub(FILE_CONTENT[line],pos,pos)
                    if ch~=" " then
                        if ch=="," then
                            --print(params[param_no])
                            param_no=param_no+1
                        else
                            if params[param_no]==nil then
                                --params[param_no]=string.format('%i',ch)
                                params[param_no]=ch
                            else
                                --this works for colors in dec and hex
                                params[param_no]=params[param_no]..ch
                                --and this not:
                                --params[param_no]=params[param_no]*10+ch
                            end
                        end
                    end
                    pos=pos+1
                until pos > string.len(FILE_CONTENT[line])
                --now add this element
                --note that there are too many params for draw.add function, but useless ones are nil values
                --so adding them nothing changes. Try to do this in C ;p
                draw.add(type, params[1], params[2], params[3], params[4], params[5], params[6], params[7], params[8])
            end
        end
       
       
        line=line+1
        until line>FILE_LINESN
end


function debbug()
    --here can be everything...
    line=1
    repeat
        print(FILE_CONTENT[line])
        line=line+1
        until line>FILE_LINESN
end



--let's start!
load_file()
process_file()

--let's twist!
stop_loop=false
repeat
    draw.overdraw()
    sleep(100)
    until stop_loop==true


print(TITLE)

--debbug()

« Last Edit: 27 / June / 2012, 19:11:43 by outslider »
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

 

Related Topics