Recent Forum Posts
From categories:
page 1123...next »

Ok, the official forum works now as usual. Plese post there: http://retrogamecoding.org/board/index.php

Re: Temporarily Forum by CybermonkeyCybermonkey, 21 Aug 2013 11:48

Ok guys, since I got a problem with my provider I set this up as a temporarily forum. Before you can post be sure to read "How to oin this site?".
I also have no access to the administration area of my page, so it's not possible to move the forum, yet. I hope everything will work in a few days again.

Temporarily Forum by CybermonkeyCybermonkey, 20 Aug 2013 16:13
Re: File IO
CybermonkeyCybermonkey 05 Dec 2010 14:07
in discussion EGSL forum / Questions on EGSL » File IO

Okay that's not so easy. Maybe a table (behaves as an array) would do also? Then try this code:

mystring={}
i=0
print ("File Test")
myfile = io.open ("Myfile.txt", "r")
for Str in  myfile:lines() do
    mystring[i]=Str
    i=i+1
end
myfile:close()
for k = 0,1 do
    print (mystring[k])
end

Of course you can check if i=0 then a=Str or if i=1 then b=Str, but this would require more lines and I think if the text file is longer an array is much better to use.

EDIT: I want to implement some file functions in EGSL eventually.

Re: File IO by CybermonkeyCybermonkey, 05 Dec 2010 14:07
File IO
gersengersen 04 Dec 2010 16:49
in discussion EGSL forum / Questions on EGSL » File IO

I'm becoming pretty much comfortable with Lua, except for file handling, still can't get my head around it. OK I know the question is on Lua rather than EGSL.

For example, suppose I have a text file "Myfile.txt"with say just 2 lines, first line is "Fred", second is "Mary".

How do I open the file, read "Fred" into variable a, "Mary" into variable b, then close the file.

Example code would be appreciated.

File IO by gersengersen, 04 Dec 2010 16:49
Source Code
CybermonkeyCybermonkey 20 Nov 2010 21:53
in discussion EGSL forum / Announcements » Source Code

Ok, the source code of EGSL and also IDE is uploaded to the Packages section. EGSL is licensed under the zlib license whereas the EGSL-IDE is licensed under the GPL 2.

Source Code by CybermonkeyCybermonkey, 20 Nov 2010 21:53

The IDE has evolved the last few uploads. First, one has now a pop up menu via the right mouse click: cut, copy, paste and search. Second, after closing the IDE, the current file name is saved into a config file, so at the next start the last active script is loaded into the IDE. It is now also possible to right click on Lua scripts and adjust "open with IDE-EGSL". This works with GNOME, KDE and WINDOWS (and probably XFCE).

News about IDE by CybermonkeyCybermonkey, 17 Nov 2010 20:36

As you can see on the download page there are now debian packages. They are still experimental so please test them.

Re: EGSL with IDE uploaded by CybermonkeyCybermonkey, 01 Nov 2010 21:39

The time of inactivity is over; I just uploaded a new version of EGSL complete with IDE. As usual it's on the Downloads page (http://egsl.wikidot.com/downloads)
Since there is a lot of new code (IDE), please test all and report bugs or issues. The updated source code of EGSL and EGSL-IDE will be uploaded soon.
So you only have to execute the IDE, no need for console anymore. (It is recommended to leave all files in one directory.)

There are two new functions

  • resizewindow() which can resize the window while executing the script
  • arguments() which returns a string containing the arguments given at the start of the script

What's next? I want to complete (or continue) the documentation, an extra documentation in German and do a small game which then acts as a tutorial. So, stay tuned, there is more to come …

EGSL with IDE uploaded by CybermonkeyCybermonkey, 31 Oct 2010 21:24
A bit quite
CybermonkeyCybermonkey 10 Oct 2010 20:12
in discussion EGSL forum / Announcements » A bit quite

It's a bit quite here since I have not much time to program now. I hope I can soon release the EGSL-IDE for Windows and Linux. Please have a bit patience.

A bit quite by CybermonkeyCybermonkey, 10 Oct 2010 20:12

Resizewindow is now implemented, not uploaded, though. Please have some patience until weekend.
This works now:

openwindow (320,240,32,"Resize Window")
nocolourkey()
imagepath="/home/markus/EasyGameLua/b.bmp"
image=loadimage(imagepath)
x=imagewidth(image)
y=imageheight(image)
resizewindow (x,y)
putimage(0,0,image)
redraw()
inkey()
closewindow()
Re: Command line arguments by CybermonkeyCybermonkey, 08 Sep 2010 09:00

The first one isn't required, one can send the output of identify to a file. Where I had problems was trying to figure out from the docs how to read it back. Anyway, going to leave this just now, something else to try.

This worked to send the output of identify to a file.

imagepath="/root/winter.jpg"
os.execute("identify "..imagepath.." > /tmp/imdata")
-- read from file here and extract the size info
openwindow(500,375,32,imagepath)
image=loadimage(imagepath)
putimage(0,0,image)
redraw()
wait(4000)
closewindow()
Re: Command line arguments by gersengersen, 04 Sep 2010 11:11

So far as I can see you'll need two new functions: system() for executing external prgograms and retrieving the result and resizewindow(). The first one won't be that easy to implement whereas a resizewindow() function can be expected with the next upload …

Re: Command line arguments by CybermonkeyCybermonkey, 04 Sep 2010 09:50

Yes it works, not really very satisfactory though, takes twice as long and you do get the flickering dummy window.I've been looking to use a launcher like a yabasic or lua script which will read the output of "identify" sort it and pass the arguments to EGSL. I find file handling in Lua very hard to understand. Here's an example in Yabasic which can read the output of "identify" without going via a file.

pathname$=peek$("argument")
a$=system$("identify "+pathname$)

rem a$ will look something like "/root/winter.jpg JPEG 500x375 500x375+0+0 8-bit DirectClass 89.4kb" 

dim w$(10)
num=token(a$,w$())
sizestring$=w$(3)

dim n$(2)
num=token(sizestring$,n$(),"x")
x=val(n$(1))
y=val(n$(2))

rem system("egsl imageview.egsl "+pathname$+" "+n$(1)+" "+n$(2))
rem exit

open window x,y
putimage pathname$,0,0,0,0

clear screen
repeat
  a$=inkey$
until(a$="q" or a$="Q" or mouseb(a$)=3)

close window
exit

Where the code would be un-commented to suit. The alternative would be do do this in Lua but lua file handling leaves me cold, or in EGSL before opening the window using Lua commands only.

Re: Command line arguments by gersengersen, 03 Sep 2010 19:22

Just tested, seems to work …

EDIT: Just a hint: if you are loading a GIF file, EGSL might crash, so you should include (before loading) a "nocolourkey()" …

Re: Command line arguments by CybermonkeyCybermonkey, 03 Sep 2010 12:43

Correctly, loadimage and all other SDL commands work only if SDL is initialised which does the openwindow() function. Well you can open a small window, load the images and do closewindow() and open the window again … like

openwindow (320,240,32,"Dummy Window")
imagepath="/root/winter.jpg"
image=loadimage(imagepath)
x=imagewidth(image)
y=imageheight(image)
closewindow()
openwindow(x,y,32,imagepath)
image=loadimage(imagepath) -- must be loaded again since closewindow() releases the memory but x and y will stay
putimage(0,0,image)
redraw()
wait(4000)
closewindow()
Re: Command line arguments by CybermonkeyCybermonkey, 03 Sep 2010 12:26

This particular Shiraz was £5 / bottle.

Looks like I have another problem, running this test:

imagepath="/root/winter.jpg"
image=loadimage(imagepath)
x=imagewidth(image)
y=imageheight(image)
openwindow(x,y,32,imagepath)
putimage(0,0,image)
redraw()
wait(4000)
closewindow()

Gives "Error: No graphics window initialized"
Seems I have to open a window before I can load an image to read its size, kind of defeats the object of opening the window to suit the image. Can always fall back on a shell command to get the image dimensions via "identify", but it's becoming messy.
Re: Command line arguments by gersengersen, 03 Sep 2010 10:28

Hey, that's a nice idea. Using EGSL as an image viewer is something I haven't thought of. Well, you can expect to have a working arguments function on Sat. or Sunday.
(Aussie Shiraz seems rather expensive I learned …)

Re: Command line arguments by CybermonkeyCybermonkey, 03 Sep 2010 07:51

Half a bottle of Aussie Shiraz with dinner certainly makes one garrulous ;-)

Here's a synopsis of the script once you give me the ability to read the command line:

Read the image pathname from the command line.
Load the image
Get the width and height
If it's too big for 1600x1200, zoom to suit.
Display the image in the correct size window
Wait for inkey "Q" to quit.

Re: Command line arguments by gersengersen, 02 Sep 2010 20:34

White spaces will do nicely.

My interest is just for fun, I use Qiv as a quick image viewer. My desktop is either Icewm or Fluxbox, both using Rox as a file manager. Now with Rox, I simply tell it to use "qiv -t" to display all images and Rox calls "qiv -t fullpathname", any time I click on an image. So I thought it would be fun to use EGSL, so Rox will call "egsl myimageviewer.egsl" for all images and hey presto EGSL will get the filename and do the work. ;-)

I can't get over excited with 2d games, but do like to use my own programs to do regular work.

Re: Command line arguments by gersengersen, 02 Sep 2010 20:15

Was a bit tricky but in CLScript it already works. (The problem caused the binded scripts). I will implement that later in EGSL.

color (15,1)
cls()
args=arguments()
print (args)

What do you think would be the best delimeter? At the moment I just used white spaces.
Re: Command line arguments by CybermonkeyCybermonkey, 02 Sep 2010 13:33
page 1123...next »