Jump to content

Search the Community

Showing results for tags 'Spreadsheet'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Spiderweb’s General Boards
    • General
    • Tech Support
    • Announcements
  • Spiderweb’s Game Boards
    • Queen's Wish Series
    • Geneforge Series - Remasters
    • Avernum Trilogy (2011-2018 Remastered Versions)
    • Avadon Series
    • Second Avernum Trilogy
    • Geneforge Series - Originals
    • Avernum Trilogy (2000-2002 original versions)
    • Nethergate and Nethergate: Resurrection
    • Blades of Avernum
    • Blades of Avernum Editor
    • Blades of Exile
    • The Exile Trilogy

Blogs

  • One day, I'll have a techno band.
  • Crystal Souls
  • Jewels of the Mind
  • Avernum RP — Knights of Old Avernum
  • Masala of Life
  • Zummi's Blog
  • Aʀᴀɴ௵ᴄᴀʏᴛᴀʀ
  • After the Gold Rush
  • feilangxiao's Blog
  • Tales from Lynaeus
  • Dying Light
  • BJearles' Blog
  • The Life and Times of Dr. Alorael
  • Ir the Great's Blog
  • Tgiiif_2004's Blog
  • Tevildo's Blog
  • wenyue's Blog

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


MSN


ICQ


Yahoo


Jabber


Skype


Website URL


Location


Real Name


Favorite Games


Interests

Found 1 result

  1. Under certain circumstances, writing part of a program can be automated to a degree. The piece of code must follow a pattern, have a fair amount of repetition inside itself. Here we see elements that are common from one for clause to another and we also see elements that are not: printf("\n0,,,"); for (i = 0; i < 2; i++) { // Town Number printf("%s,",buffer[i]); } printf("\n2,,,"); for (i = 2; i < 28; i++) { // Town Name printf("%s,",buffer[i]); if (i == 27) printf("\n28,,,"); } for (i = 28; i < 48; i++) { // Town Script Name printf("%s,",buffer[i]); if (i == 47) printf("\n"); } for (i = 48; i < 4144; i++) { // Floor 1 mapping [64][64] if (i % 64 == 48) printf("%d,,,",i); printf("%s,",buffer[i]); if (i % 64 == 47) printf("\n"); } &&&&&&&& The for clause is a common element, but the numbers contained in each clause are not. Ditto, the comment is different for each clause. First, we create a specimen clause of code. If a number is surrounded on both sides by tab stops, when it is pasted into a spreadsheet it will be in a cell by itself. Below, "\t" represents an otherwise invisible tab stop. All paragraph marks are replaced by at symbols, "@". This means the clause now occupies only one line of code. for (i = \t0\t; i < \t2\t; i++) { // \tTown Number\t@if (i % 16 == 8)@printf("%d,,,",i);@printf("%s,",buffer);@if (i % 16 == 7)@printf("\n");@}@ The specimen line of code is now copied into a spreadsheet. Now the the Fill Down function is used: for (i = \t0\t; i < \t2\t; i++) { // \tTown Number\t@if (i % 16 == 8)@printf("%d,,,",i);@printf("%s,",buffer);@if (i % 16 == 7)@printf("\n");@}@ for (i = \t0\t; i < \t2\t; i++) { // \tTown Number\t@if (i % 16 == 8)@printf("%d,,,",i);@printf("%s,",buffer);@if (i % 16 == 7)@printf("\n");@}@ for (i = \t0\t; i < \t2\t; i++) { // \tTown Number\t@if (i % 16 == 8)@printf("%d,,,",i);@printf("%s,",buffer);@if (i % 16 == 7)@printf("\n");@}@ (A whole lot of lines have been omitted for brevity's sake.) for (i = \t0\t; i < \t2\t; i++) { // \tTown Number\t@if (i % 16 == 8)@printf("%d,,,",i);@printf("%s,",buffer);@if (i % 16 == 7)@printf("\n");@}@ for (i = \t0\t; i < \t2\t; i++) { // \tTown Number\t@if (i % 16 == 8)@printf("%d,,,",i);@printf("%s,",buffer);@if (i % 16 == 7)@printf("\n");@}@ for (i = \t0\t; i < \t2\t; i++) { // \tTown Number\t@if (i % 16 == 8)@printf("%d,,,",i);@printf("%s,",buffer);@if (i % 16 == 7)@printf("\n");@}@ Now all the variable parts are in columns by themselves, just copy in the relevant numbers and comments: for (i = \t0\t; i < \t2\t; i++) { // \tTown Number\t@if (i % 16 == 8)@printf("%d,,,",i);@printf("%s,",buffer);@if (i % 16 == 7)@printf("\n");@}@ for (i = \t2\t; i < \t28\t; i++) { // \tTown Name\t@if (i % 16 == 8)@printf("%d,,,",i);@printf("%s,",buffer);@if (i % 16 == 7)@printf("\n");@}@ for (i = \t28\t; i < \t48\t; i++) { // \tTown Script Name\t@if (i % 16 == 8)@printf("%d,,,",i);@printf("%s,",buffer);@if (i % 16 == 7)@printf("\n");@}@ for (i = \t48\t; i < \t4144\t; i++) { // \tFloor 1 mapping [64][64]\t@if (i % 16 == 8)@printf("%d,,,",i);@printf("%s,",buffer);@if (i % 16 == 7)@printf("\n");@}@ (A whole lot of lines have been omitted for brevity's sake.) for (i = 108384; i < 108416; i++) { // Town Entrances: N,W,S,E@if (i % 16 == 8)@printf("%d,,,",i);@printf("%s,",buffer);@if (i % 16 == 7)@printf("\n");@}@ for (i = 108416; i < 108448; i++) { // Exit Town Locations@if (i % 16 == 8)@printf("%d,,,",i);@printf("%s,",buffer);@if (i % 16 == 7)@printf("\n");@}@ for (i = 108448; i < 108488; i++) { // Unclear@if (i % 16 == 8)@printf("%d,,,",i);@printf("%s,",buffer);@if (i % 16 == 7)@printf("\n");@}@ The code is then copied to a file, which is saved. File is then opened in a hex editor. All tab stops are deleted, here they are all equal to 09h. Use Replace All to replace all of them with nothing, this has the effect of deleting all of them. Now at symbols, @, need to be replaced by a paragraph mark and a tab. In hex terms 40h needs to be replaced by 0D0A09h. Finally, not all for functions have the same modulus for placing paragraph marks, some have no modulus at all, you would need to go through the clauses one at a time and alter them. This method is valid for Avernumscript or anything that handles code.
×
×
  • Create New...