How to edit/improve/add functions to FoxGame


Code submission and code discusion

User avatar

Site Admin

Posts: 610

Joined: Thu Jun 01, 2006 7:18 pm

Post Sun Sep 10, 2006 7:51 am

How to edit/improve/add functions to FoxGame

Step by step How-To:

1. Downlad foxgame-147.xpi
2. rename in foxgame-147.zip
3. extract it with winrar
4. open the foxgame.jar
5. extract it with winrar
6. open foxgame.js
7. add function whenever you want (ont inside another function).
8. add a function call inside fg_AdjustPages() (in some functions the order could matter).
9. save foxgame.js
10. zip foxgame.jar contents and rename again to foxgame.jar
11. zip foxgame.xpi contents and rename to foxgame.xpi
12. Drag and drop into firefox and install
13. If you see an error message in the javascript console (about foxgame) or a chrome error (you will notice what is a chrome error when you see it) you have done something wrong and if you post the error here maybe qe can help you.

Posts: 5

Joined: Sat Sep 09, 2006 6:33 pm

Post Sun Sep 10, 2006 8:00 pm

I used to make modifications to foxgame.js without reinstalling plugin.

1. I've just found where it installed :
C:\Documents and Settings\User\Application Data\
Mozilla\Firefox\Profiles\7rylfi9e.default\
extensions\{b66bc4c3-6d25-4a10-8c59-01daa9063051}\chrome

2. Extract .jar
3. update and save .js file : \content\foxgame\foxgame.js
4. zip the 3 folders created while unzipping
=> With NO compression (use STORE method) and to .zip (not .jar) extension (I use WinRar)
5. Rename to .jar
6. Make a backup copy of the old foxgame.jar ;)
6. Replace old file foxgame.jar

Sure it is not the best way, but I just wanted to prevent a problem I had when using compression or saving to .jar : The plugin is not fully loaded and does not work. I don't know if this problem appears with plugin re-install.

Posts: 33

Joined: Sat Sep 02, 2006 8:45 pm

Location: NL

Post Tue Sep 12, 2006 7:37 pm

When you are updating more then once or twice, zipping and renaming becomes a pain. Here my way of changing and testing Foxgame.
It requeries some installing, works great afterwards.


Install step 1
Install WinCvs or you own favorite CVS client.

Using CVS is not really necessary, but will make life easy when a new version of Foxgame will become available. CVS can merge you updates with the changes in a version. Otherwise you would need to redo you changes for every new version.
Using CVS in this way, you get the latest development changes, but also the latest bugs.
I don’t know when changes are submitted to CVS, but if you like to use official releases of Foxgame only, don’t use WinCvs again until one is released.

WinCvs can be found at:
http://prdownloads.sourceforge.net/cvsg ... p?download

Install and start WinCVS.
Set: Admin - Preferences - CVS - HOME: C:\Projects (or where you do your development.)

Use: Remote - Checkout module…
Module name and path on the server: foxgame/src
Local folder to check out to: C:\Projects\MyFoxgame (or somewhere else.)
[Check] CVSROOT: :pserver:guest@mozdev.org:/cvs (address starts with ‘:’)

Now you should have all Foxgame files in C:\Projects\MyFoxGame\foxgame\src


Install step 2
Install the command line version of 7zip.
Download: http://prdownloads.sourceforge.net/seve ... p?download
And put the files form the zip into: C:\Program Files\7z

Install step 3
Create a file named make_dev.bat in the directory C:\Projects\MyFoxGame\foxgame\src
The content of the file should be
  Code:
set x=foxgame
set path7z=C:\Tools\7z

rd build /s/q
md build\chrome
cd chrome
%path7z%\7z a -tzip %x%.jar * -r0 -mx=0 -x!CVS* -x!Nuevo*
move %x%.jar ..\build\chrome
cd ..
copy *-GL.rdf build
copy *-GL.js build
ren build\install-GL.rdf install.rdf
ren build\install-GL.js install.js
xcopy /S defaults build\defaults\
cd build
%path7z%\7z a -tzip %x%.xpi * -r -mx=9 -x!CVS*
move %x%.xpi ..\
cd ..


The main difference between this makefile and the standard makefile is that the build-directory is not delete at the end of the process.


Install step 4
Run the make_dev.bat
This should create a directory called C:\Projects\MyFoxGame\foxgame\src\build containing files equal to the files found in the foxgame.xpi.

Install step 5
Locate you Firefox installed add-on directory. Mine is at: C:\Documents and Settings\CoupDeGrace\Application Data\Mozilla\Firefox\Profiles\rtr6pndn.default\extensions

If you can’t find it, search for a directory named: {b66bc4c3-6d25-4a10-8c59-01daa9063051}

When you found it, delete the directory called: {b66bc4c3-6d25-4a10-8c59-01daa9063051}
And replace it with a textfile with the same name. Edit the {b66bc4c3-6d25-4a10-8c59-01daa9063051}-file. This file must contain the name of your build directory.
  Code:
C:\Projects\MyFoxGame\foxgame\src\build


Install step 6
(Re)start Firefox. Foxgame shouldn’t have changed a bit.



Now we are done installing…. let get developing…



Develop step 1
Update the C:\Projects\MyFoxGame\foxgame\src\chrome\content\foxgame\foxgame.js to you liking, or any other file for that matter.

Develop step 2
Stop Firefox

Develop step 3
Run make_dev.bat

Develop step 4
Start Firefox and find some bugs.

Go back to develop step 1


I really hope this will make life a lot easier for everybody.
User avatar

Posts: 121

Joined: Sat Jun 10, 2006 11:12 am

Location: France

Post Sat Sep 23, 2006 2:04 pm

For extension developers, there's ExtensionDev which is really good & useful, especially the "reload chrome" if you don't want to restart firefox entirely.
http://stalkr.net & #StalkR on irc.stalkr.net

Posts: 1

Joined: Thu Nov 02, 2006 11:13 am

Post Thu Nov 02, 2006 11:39 am

Step by step How-To:

8. add a function call inside fg_AdjustPages() (in some functions the order could matter). inside the function or inside foxgame.js?
9. save foxgame.js
10. zip foxgame.jar contents and rename again to foxgame.jar What exactly must i zip? The three folders in which one of them was foxgame.js? If I zip it and rename it to foxgame.jar it remains a zip-archive :(
11. zip foxgame.xpi contents and rename to foxgame.xpi Same problem; name changes but file remains a .zip.
NL uni 5
User avatar

Site Admin

Posts: 610

Joined: Thu Jun 01, 2006 7:18 pm

Post Thu Nov 02, 2006 11:12 pm

8.- You must define the function in the file and add the call inside fg_AdjustPages(), and the order matters inside fg_AdjustPages (it is different to run after or before reducing the galaxy if you are altering the table.

10.- When we talk about rename its full renaming from foxgame.zip to foxgame.jar (if you don't see .zip extension change your folder settings), you have to zip what it was inside foxgame.jar (content, locale, skin folders).

11.- Same solution.
User avatar

Posts: 25

Joined: Tue Feb 13, 2007 1:22 pm

Location: The Netherlands

Post Wed Mar 07, 2007 2:57 pm

Well, I've put this code: Player-ranks in the galaxy-view, and now I want to ZIP the Folders: content, locale & skin folders to ZIP.

When my ZIP-file is ready, it's much smaller than the original...
(Original is 280 kB, mine is 89 kB ?? dont know why)

Re-named the File to .jar and put it in Chrome Folder.

Then ZIP it and re-name to .xpi

Now I want to Install, so drop the .xpi in FF Browser, and than I get this Error code: 207 (No Install file or someting like that)

So what I'm I doing wrong?

I've used FoxGame 1.4.10

Add to Code above the Remove Planets function

And Add this

fg_addPlayerRank,
fg_addAllianceRank,


in function fg_adjustPages. (also above Remove Planet function.)

Can somebody help me, or send me a pre-edit foxgame.jar for 1.4.10

Because I'm busy now for 4days and it's driving me a little crazy
User avatar

Site Admin

Posts: 610

Joined: Thu Jun 01, 2006 7:18 pm

Post Wed Mar 07, 2007 3:46 pm

I recommend using 7zip it depends of the zipper programs and some formats are not fully recognised by firefox.

If you use 7zip you can also use the make.bat (from svn) file to zip and rename all (you have to do some minor changes).

Edit: Just for the records I use "7za a -tzip %x%.jar * -r0 -mx=0 "
Last edited by frisco on Thu Mar 08, 2007 1:12 am, edited 1 time in total.
User avatar

Posts: 25

Joined: Tue Feb 13, 2007 1:22 pm

Location: The Netherlands

Post Wed Mar 07, 2007 7:07 pm

Now with 7zip it's even smaller :shock: 85 kB

Must I zip those Folder 1 by 1 ?? because I do them all in 1 time.

I only add 1 code, and I'm sure I've did it correct.

EDIT

And it's a Zip not a 7z file
Last edited by DeathStarNL on Wed Mar 07, 2007 8:25 pm, edited 1 time in total.

Posts: 135

Joined: Sat Sep 16, 2006 8:16 pm

Post Wed Mar 07, 2007 7:14 pm

I use WinRAR, with no compression - Works fine

Posts: 63

Joined: Sat Jun 03, 2006 11:32 am

Location: Siena, Toscana, Italia

Post Wed Mar 07, 2007 7:46 pm

you have to use the "non compression method" i think.

7zip is the best for Windows!

In Linux you can use Ark instead.
..:: www.lenar.it ::..
User avatar

Posts: 25

Joined: Tue Feb 13, 2007 1:22 pm

Location: The Netherlands

Post Wed Mar 07, 2007 8:31 pm

EDIT: Chop chop

Good news, I don't know how I did it but it works...
I was almost getting angry :oops: and was thinking to myself:
"Just one last time with WinRAR"

I zipped it with an other method and: First time I'm getting an bigger File (294 kB) And its working now.

Guess I was zippin with the wrong method.

Well, I don't forget this anymore, thanks for you're support all

Posts: 71

Joined: Sat Jan 20, 2007 1:37 am

Post Sun Mar 11, 2007 9:09 am

yurage wrote:I used to make modifications to foxgame.js without reinstalling plugin.

1. I've just found where it installed :
C:\Documents and Settings\User\Application Data\
Mozilla\Firefox\Profiles\7rylfi9e.default\
extensions\{b66bc4c3-6d25-4a10-8c59-01daa9063051}\chrome

2. Extract .jar
3. update and save .js file : \content\foxgame\foxgame.js
4. zip the 3 folders created while unzipping
=> With NO compression (use STORE method) and to .zip (not .jar) extension (I use WinRar)
5. Rename to .jar
6. Make a backup copy of the old foxgame.jar ;)
6. Replace old file foxgame.jar

Sure it is not the best way, but I just wanted to prevent a problem I had when using compression or saving to .jar : The plugin is not fully loaded and does not work. I don't know if this problem appears with plugin re-install.



I don't understand why, but i use to do like that for a while, it was perfect, but it now doesn't work at all !

Someone else have this trouble ?
User avatar

Posts: 50

Joined: Mon Mar 05, 2007 4:07 pm

Post Sun Mar 11, 2007 1:03 pm

frisco wrote:8.- You must define the function in the file and add the call inside fg_AdjustPages(), and the order matters inside fg_AdjustPages (it is different to run after or before reducing the galaxy if you are altering the table.


Sorry, but because I am German I don't understand exactly this extract :oops:

I tried to copy the code into the file at different positions, but up to now it doesn't works! :cry:

Can somebody explain it easier where I have to copy the code in the file???
perhaps with a little example or even picture???...

Thanks a lot and I hope you understand me well :wink:

Posts: 29

Joined: Fri Mar 09, 2007 5:13 pm

Post Sun Mar 11, 2007 1:35 pm

Sheridan wrote:
frisco wrote:8.- You must define the function in the file and add the call inside fg_AdjustPages(), and the order matters inside fg_AdjustPages (it is different to run after or before reducing the galaxy if you are altering the table.


Sorry, but because I am German I don't understand exactly this extract :oops:

I tried to copy the code into the file at different positions, but up to now it doesn't works! :cry:

Can somebody explain it easier where I have to copy the code in the file???
perhaps with a little example or even picture???...

Thanks a lot and I hope you understand me well :wink:


if you open the foxgame.js you will find a function called "fg_adjustPages(event)" right on top of the file (it's below the comment "// MAIN function" - after opening the file press "page down" one time then you should see it - or use the search function of your editor ;) ) inside this function there is a list of functions where you have zu add the name of the function you implemented below. for example:

if you want to add a function called "fg_addPlayerRank" you have to copy the whole function code somewhere in the "feature functions" section, let's say below the funtion "fg_addSignature". after copying the function code you look up to the "fg_adjustPages" function. you search the list for "fg_addSignature" and add the name of your function right below it so it looks like this:

fg_addSignature,
fg_addPlayerRank,
fg_pasteCoords,


i hope that's understandable cause i'm from germany as well ;) if it's not understandable, i can explain it to you in the german part of this board
User avatar

Posts: 50

Joined: Mon Mar 05, 2007 4:07 pm

Post Sun Mar 11, 2007 2:15 pm

Randall Flagg wrote:
Sheridan wrote:
frisco wrote:8.- You must define the function in the file and add the call inside fg_AdjustPages(), and the order matters inside fg_AdjustPages (it is different to run after or before reducing the galaxy if you are altering the table.


Sorry, but because I am German I don't understand exactly this extract :oops:

I tried to copy the code into the file at different positions, but up to now it doesn't works! :cry:

Can somebody explain it easier where I have to copy the code in the file???
perhaps with a little example or even picture???...

Thanks a lot and I hope you understand me well :wink:


if you open the foxgame.js you will find a function called "fg_adjustPages(event)" right on top of the file (it's below the comment "// MAIN function" - after opening the file press "page down" one time then you should see it - or use the search function of your editor ;) ) inside this function there is a list of functions where you have zu add the name of the function you implemented below. for example:

if you want to add a function called "fg_addPlayerRank" you have to copy the whole function code somewhere in the "feature functions" section, let's say below the funtion "fg_addSignature". after copying the function code you look up to the "fg_adjustPages" function. you search the list for "fg_addSignature" and add the name of your function right below it so it looks like this:

fg_addSignature,
fg_addPlayerRank,
fg_pasteCoords,


i hope that's understandable cause i'm from germany as well ;) if it's not understandable, i can explain it to you in the german part of this board


ok, jetzt habe ich es doch verstanden und nachdem ich ein fehlendes Komma gesetzt habe, funktioniert es! :D
DANKE!!!

To our english people:
My german friend helped me much to solve my problem and now it works fine! :D

Posts: 4

Joined: Fri Apr 20, 2007 9:00 pm

Location: PORTUGAL

Post Fri Apr 20, 2007 9:12 pm

Re: How to edit/improve/add functions to FoxGame

frisco wrote:Step by step How-To:

1. Downlad foxgame-147.xpi
2. rename in foxgame-147.zip
3. extract it with winrar
4. open the foxgame.jar
5. extract it with winrar
6. open foxgame.js
7. add function whenever you want (ont inside another function).
8. add a function call inside fg_AdjustPages() (in some functions the order could matter).
9. save foxgame.js
10. zip foxgame.jar contents and rename again to foxgame.jar
11. zip foxgame.xpi contents and rename to foxgame.xpi
12. Drag and drop into firefox and install
13. If you see an error message in the javascript console (about foxgame) or a chrome error (you will notice what is a chrome error when you see it) you have done something wrong and if you post the error here maybe qe can help you.


The error i've got is that it was missing instal files. Can u give me a hand here?

thanks

Posts: 4

Joined: Fri Apr 20, 2007 9:00 pm

Location: PORTUGAL

Post Fri Apr 20, 2007 9:22 pm

yurage wrote:I used to make modifications to foxgame.js without reinstalling plugin.

1. I've just found where it installed :
C:\Documents and Settings\User\Application Data\
Mozilla\Firefox\Profiles\7rylfi9e.default\
extensions\{b66bc4c3-6d25-4a10-8c59-01daa9063051}\chrome

2. Extract .jar
3. update and save .js file : \content\foxgame\foxgame.js
4. zip the 3 folders created while unzipping
=> With NO compression (use STORE method) and to .zip (not .jar) extension (I use WinRar)
5. Rename to .jar
6. Make a backup copy of the old foxgame.jar ;)
6. Replace old file foxgame.jar

Sure it is not the best way, but I just wanted to prevent a problem I had when using compression or saving to .jar : The plugin is not fully loaded and does not work. I don't know if this problem appears with plugin re-install.


Well... i've done just like u said (i think) but it didn't work. in fact foxgame stoped working. I had to replace the original directory.

res

Posts: 2

Joined: Wed Sep 12, 2007 7:41 pm

Post Wed Sep 12, 2007 7:44 pm

Does anybody know how I can add or change functions to foxgame using linux?

Thanks you,
res
User avatar

Posts: 325

Joined: Sun Jun 24, 2007 4:33 am

Post Wed Sep 12, 2007 7:49 pm

hmm Isn't it the same for linux?
Or I am from other planet ;)
I think all plugins should work same on any OS, if supported by version of your FF.

I may be also wrong but I know Opera works same on all OS's including mobile devices/smart phones, ... so FF should work also the same on all OS's
Last edited by SA on Wed Apr 16, 2008 12:48 pm, edited 1 time in total.
FoxGame (SA Build) download section can be found here:
Image
Next

Return to Code

Who is online

Users browsing this forum: No registered users and 0 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.