RetroBASIC
Retrogamecoding(.org) => EGSL => Topic started by: lelldorin on February 10, 2013, 02:50:44 PM
-
Hello all,
i need some templates for my EGSL IDE. Somthing like this:
Open Window:
openwindow (x,y,b,"Window Name")
closewindow()
Write to file:
a = open("/Path/to/file/filename", "w")
fprint(a, "Writing text to filename")
close(a)
If exists - write to file:
if (fileexists("/Path/to/file/filename") == false) then
a = open("/Path/to/file/filename", "w")
fprint(a, "Writing to filename")
close(a)
end
If Exists:
if (fileexists("test.txt") == false) then
??? How can i make Terminal output ???
end
I need some thing like:
- read file
- read directory
- etc.
All in the same short way like my examples.
Also need my codes a check if they are correct?
Greetings Lelldorin
http://haikuware.com/directory/view-details/development/ides/egsl-ide (http://haikuware.com/directory/view-details/development/ides/egsl-ide)
-
Will be funny to get some templates. if you have fun to make some for me, i will be afraid.
-
have a look at the egsl documentation on the website + there are even downloads with example files ;)
-
I want templates not examples
templates are code parts who are every time used again
-
templates are code parts who are every time used again
These are subroutines, functions or methods. ;)
Templates are good for markup languages (like HTML), where content is clearly separated from structure and presentation (you provide the content, while templates take care of structure and presentation), but I don't see a point in templates for programming languages. All you posted in your first post are examples, because only examples are useful in case of programming languages (in fact, you can use them as a mini-templates). Templates could look like
for [your variable] = [from], [to] do
[your code]
end
but what would be the point of it? How would it be helpful in writing programs? If you know the syntax of a language, you'll write something like that from scratch quicker than it would take you to use a template. If you don't know the syntax, well... you should learn it. This is not HTML, when you can download a nice template, change the content (text, pictures etc.) and have a good looking website.
-
I split viewing this, i have examples, thats are complete programs to show the user that he can do with the programming language and on the other hand there are templates. Little code files to make working with the IDE easier. We have IDE templates and User based templates. The IDE templates should have included some codes like openwindow, read file, save file... and the User templates are stored by the user himself with his own files.
Examples:
(http://www.lelldorin.de/screens/egsl-ide_examples.png)
Templates:
(http://www.lelldorin.de/screens/egsl-ide_templates.png)
But if no one find this is a good idea... Thats ok.
-
I don't think it's a bad idea, don't take it that way please.. :-\
Ok, where do you need help?
I saw you don't know how to print something to the console?
use: io.write("hello")
maybe you can give me a list with things I can help you with? (if I have the time for it) :)
also googling "Lua" can be a great help..
-
This is nice, have added this into the templates.
I think it will be fine to have somthing like:
- readout a textfile
- readout a directory
- draw a button
- draw a image button
- draw a image
- scrolling left to right
- scrolling right to left
- scrolling bottom to top
- scrolling top to bottom
- scrolling all ways
- get key message
- get joystick message
- get mouse message
I am not a EGSL developer, i use yab to make this IDE, i does not know that templates are good and that not. I will take a look into EGSL if i have a good idea for a game... at the moment i create more programs not games.
-
ok, I let you know if I have something :)
-
hey :) just started:
-- readout a textfile
function read_file(path)
local file = io.open(path)
local string = file:read("*all")
file.close()
print(string)
end
read_file("my_file.txt")
readout a directory ???
for these you just have to take a look at the documentation:
draw a button
draw a image button
draw a image
can you explain these a bit more? don't get what you want "scrolling"
scrolling left to right
scrolling right to left
scrolling bottom to top
scrolling top to bottom
scrolling all ways??
get key message is an internal egsl function = getkey()
get joystick message is internal to:
joystickplugged()
getjoyx()
getjoyy()
getjoybutton(button)
numberjoybuttons()
get mouse message? same here:
mousex()
mousey()
mouseb()
-
hey :) just started:
-- readout a textfile
function read_file(path)
local file = io.open(path)
local string = file:read("*all")
file.close()
print(string)
end
read_file("my_file.txt")
It would be better if the function returns the content of the file:
-- readout a textfile
function read_file(path)
local file = io.open(path)
local string = file:read("*all")
file.close()
return (string)
end
content = read_file("my_file.txt")
readout a directory ???
Not possible without luafilesystem (http://keplerproject.github.io/luafilesystem/). I don't know if it was ported to Haiku. I also don't know if you could use luarocks (http://luarocks.org/) to install it.
-
yes, you can do that to, i'd just wanted to keep it simple ;)
-
Nice, thank you :-)
-
So, EGSL is available for the Haiku operating system again, i would ask again for templates i can add to my IDE.
If you have some things who can be added as template let me know.
Greetings Lelldorin