Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - arj0n

#81
Critics' Lounge / Re: Police Quest II
Sat 08/01/2022 13:29:57
The roofing above the doors sticks out but its shadow on the floor  doesn't.
#82
Yes, that's the one!
Thanx!
#83
Quite some years ago someone did a small part of a monkey island (iirc) demake which was done in just a few colors (like 4 colors or less). It was abandoned and I can't remember if a demo was ever released.

As I can't seem to find it at the forums I hope someone does remember this little project so I can find its production thread again.
#84
It is just the formula: 100% divided by max distant (which is 300) times current player-position.

Create a global int, and name it percent for example and set its default value to 0.

Then in the global script (or in the room script if the distance percentage calculation is only needed in one specific room) use something like in the rep_exec section:

percent = 100/300*player.x;

Now the int percent will give you a value between 0 and 100

Edit:
After posting this answer I noticed you editted your post, so my answer/info here might be obsolete now  (roll)
#85
so you could let that be continuously re-calculated in rep_exec with something like 100/300*player.x, right?
#86
Thanx for all the info again CW!
I've added the following check before reading the file with ReadRawLineBack plus adding the last char if LF is missing.
It seems to be working fine now:

Code: ags

bool noLF = false;
String lChar;

String fileName = String.Format("$SAVEGAMEDIR$/%s", lst_CustomLevels.Items[lst_CustomLevels.SelectedIndex]);
File *output = File.Open(fileName, eFileRead);
if (output == null) Display ("error opening file.");
else if (output != null) 
{
  //first check if EOF has a LF:
  output.Seek(-1, eSeekEnd);
  if (output.ReadRawChar() != 10) //no LF
  {
    noLF = true;
    output.Seek(-1, eSeekEnd);
    lChar = String.Format("%c",output.ReadRawChar()); //grab last char
  }
  // now go back to begin of file, read complete file info using ReadRawLineBack and build up strings
  // if the 'title' string (title is the last line in the file) is not empty and (noLF == true) add lChar to last string
  output.Close();
}
#87
Quote from: Crimson Wizard on Wed 05/01/2022 20:17:27
If the data files are located in read-only location, either technically cannot be written to or player does not have enough permissions on their system to write there.
The data is for that reason written in the savegame folder because (I assumed) that location has no read-only issues.

Quote from: Crimson Wizard on Wed 05/01/2022 20:17:27
Anyway, tbh, overwriting whole file only to let engine read it again properly, sounds like an overkill.
Yes, it looks like an overkill indeed, but:
As the content is unknown before reading a file, the only way to find out if the last line in the file is ok is to check for the last character to be a LF.
After running this check I add a LF in case it is missing.

Quote from: Crimson Wizard on Wed 05/01/2022 20:17:27
What about reading a file first, and then reading last character separately if it was not read?
But how do I know if the last character was read if I don't know the content?
I only know the last char must be a LF.

Quote from: Crimson Wizard on Wed 05/01/2022 20:17:27
You can compare the length of the returned String with the length of the file and if it's shorter - then read the rest yourself.
I see, but how do I check/know the length of the file? By getting File.Position when at the EOF?
#88
The data are plain text level files.
The workaround is only used for level files that the ags game can read but are not created by this ags game. One can even create a level in an ordinairy text editor for example, place it in the savegame folder and let the ags game read the file. These level files not created by the ags game might missing that LF at the end.

The data (level files) are always writeable, this is when loading such file and when exporting such file.

Do you have an example of a case where the 'game fixing its data files' may not work?
#89
Quote from: Crimson Wizard on Thu 30/12/2021 17:00:33
The workaround is to always add an extra linebreak at the end of the file.

This seems to be fixed in 3.6.0.

My workaround is very close to your suggestion: In stead of always adding an extra linebreak I now first read the last char of the selected file, and if this is not a LF then WriteRawChar (10). (otherwise each time a new LF should be added which would be junkdata)
#90
FYC:

Desolate

AGS page | Itch page








Remember Desolate, that top-down perspective spaceship crawler with arcade game
and puzzle elements, served in a hybrid TI83-Game Boy monochrome green palette?


Please consider for:


  • Best Game Created with AGS
  • Best Freeware Game Created with AGS
  • Best Gameplay
  • Best Puzzles
  • Best Non Adventure Game Created with AGS
  • Best Programming
#92
I have a plain text file in the savegame folder that holds several lines of information.
- The second-last line holds the author information
- The last line holds the title information
- All lines above these 2 lines contain level input

The function as shown below reads through all the lines of a selected file using
ReadRawLineBack and gets the author and the title information in order to
show them, combined into one string, on a label.

It works fine but I have one small problem:
The last character of the title line (which is always the last line of the file)
seems not to be included in the string result.


so if the last line of the txtfile contains: Title: Level1
after ReadRawLineBack, the string result is: Title: Level

note:
As a test, if I add an empty line after the last line (after the title line) the
complete title, including the last character, is correctly read. But that would
not be a solution for my problem as these files are (and should be) exported
without adding an extra empty line.

So, how can I read the last line in a way that ALL CHARACTERS are included?

Code: ags

function load_levelinfoCustom()
{
  String Line;
  String LineTitle;
  String LineAuthor;
  String checkTitle;
  String checkAuthor;
  String finalInfo;
  
  String fileName = String.Format("$SAVEGAMEDIR$/%s", lst_CustomLevels.Items[lst_CustomLevels.SelectedIndex]);
  File *input = File.Open(fileName, eFileRead);
  
  if (input == null) Display ("the file seems to be empty...");
  else if (input != null) 
  {
    while (!input.EOF)
    {
      Line = input.ReadRawLineBack();

      checkAuthor = Line.Substring(0, 7);
      checkTitle = Line.Substring(0, 6);
      if (checkAuthor == "Author:") LineAuthor = Line;
      if (checkTitle == "Title:") LineTitle = Line;
    }
    if (LineTitle == null) LineTitle = "title unknown";
    if (LineAuthor == null) LineAuthor = "author unknown";
    
    finalInfo = LineTitle.Append("[");
    finalInfo = finalInfo.Append(LineAuthor);
    lbl_LevelInfo.Text = finalInfo;
    input.Close();
  }
}
#93
Looks more like an error with the audio channel(s) you have created and are using.


Anyway, here's the steps for adding a new audio type and importing an audio clip connected to that type:

  • Add new audio type in Audio>folder Types
  • Give the new type a name and save new audio type
  • Add new folder in Audio with same name as newly added audio type
  • Import an audio file into this new folder (I used an ogg file and named it aTest in the AGS editor)
  • Select the correct Type if needed

Quick test if audio file plays fine through an audio channel:

  • Add the following line in the end of function game_start(): AudioChannel *test = aTest.Play();
  • Run the game
  • Audio should play fine

If something is wrong with the cached audio files, just delete one or all of them:

  • In the AGS editor, lookup the cache name by opening the imported audio file, under 'Cache File Name'
  • Using the Windows explorer, go to folder C:\...\<your project folder>\AudioCache
  • Delete the file (or just all files
  • Back in the AGS editor rebuild your project and all cache files will be re-created
#94
That's a gorgeous BG, stylez75.
#95
Thanx for the heads up, Snarky
I'll look into that module.
#96
Ah, thanx for the info CW.
I'm currently using customs structs and scripts to draw, but was hoping creating gameobjects at runtime was possible. Alas, no problem. Thanx.
#97
Quote from: Cassiebsg on Sun 26/12/2021 12:52:58
I don't think it's possible, but I might be wrong.

Is there a reason you don't want to create an empty/hidden button?

I'm afraid too it isn't possible.

It's for an arcade/puzzle game.
When loading an existing or custom level, I would like to calculated how many buttons (wall pieces and so on) are needed and create and place them on the grid/board (gui).

Currently i have to create the total amount of buttons possible on the grid. Which would be a max total of 19x16...
This works of course but i would prefer a solution where i can create, via script, just only the amount of buttons needed for the level. That would also drastically reduce the amount of buttons to be created.
#98
I have a gui that does not contain any guicontrol.
I would like to create a new guicontrol as button via script (without first creating an empty button in the gui editor), is this possible?
#99
General Discussion / Re: Free Steam keys!
Fri 24/12/2021 14:39:22
Temporarilly gog give away: "I Have No Mouth And I Must Scream"

https://www.gog.com/game/i_have_no_mouth_and_i_must_scream
#100
Gratz
SMF spam blocked by CleanTalk