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 - js

#1
Yes you're right. My tests are done on inventory item.

Thank you for your answer !

#2
Hello,

In the callback  on_mouse_click(MouseButton button)

I try to detect which button has been pressed:

Code: ags
switch(button) {
  case eMouseLeft:
    Display("left button");
    break;
  default:
    Display("unknown button: %d", button);
    break;

The problem is when i press left button, it's not seen as a eMouseLeft code.

The enum is described like this in the documentation:

Code: ags
enum MouseButton {
  eMouseLeft,
  eMouseRight,
  eMouseMiddle,
  eMouseLeftInv,
  eMouseMiddleInv,
  eMouseRightInv,
  eMouseWheelNorth,
  eMouseWheelSouth
};

So eMouseLeft must be 0 or 1 i think (depending the start index).

When i press the buttons of my mouse, it triggers the default branch in my switch/case.

I get those values from my display box:
left : 5
right : 6
middle : 7
wheel up : 8
wheel down : 9 (note the value greater than the number of values in the enum)

Well... i don't understand what happens.

Thank you.
#3
Thank you ! After a bit of experimentations, i finally manage this with your help.

The « challenge » for me was to returrn to the start room at the end, without cluttering event loop with tests and variables (like it_is_the_last_room_now_return).

Finally, i just added the start room at the end of the list, before the ending number
I'm doing this at game startup:

Code: ags
  int index_room = 0;
  int initial_room = player.Room;
  for (int i = 0; i < MAX_ROOM; i++) {
    if (Room.Exists(i))
    {
      /* Note: si cette boucle trouve des pièces qui n'existent pas ou plus, vérifier que
               le fichier CRM correspondant ne traine pas dans les fichiers du jeu.
               Ce problème ne concerne à priori que l'exécution directe avec F5 (pas l'exec avec le moteur).
               Ex: trouve un index de room 10, qui n'existe plus dans l'éditeur : effacer le fichier room10.crm
      */
      log(String.Format("room: %d exists", i));
      liste_room[index_room]=i;
      index_room = index_room+1;
    }
  } // i < MAX_ROOM ?
  liste_room[index_room] = initial_room; // retourne sur la première pièce
  index_room++;
  liste_room[index_room] = -1; // indique la dernière pièce
  index_parcours_room=index_room; // se place sur la dernière pièce
  log(String.Format("max rooms : %d", index_room));
 
#4
Hello,

In debug build, i'd like to gather objects in all the room to check some relations between them, in their custom properties.

As objects are linked to rooms, i have made a shortcut key which start the check in the AGS game loop. The check changes room, gather objects and repeat until last room is reached.

At game startup, i fill the array (liste_room[]) with all the rooms index (when there are no more rooms, i put -1 as a value to indicate it's over).

Then, the keyboard shortcut initializes ask_for_objects_testing boolean to true.

And in the function repeatedly_execute() , i've put

Code: ags
  if (ask_for_objects_testing == true) {
    int initial_room = player.Room;
    for (int i=0; liste_room[i]>=0; i++) {
      log(String.Format("parsing room: %d", liste_room[i]));
      player.ChangeRoom(liste_room[i]);
    }
    // go back to initial room
    player.ChangeRoom(initial_room);
  }

But it hangs at the second call of player.ChangeRoom

I get this error:

NewRoom : Cannot run this command since there was a NewRoom command already queued to run in "GlobalScript.asc

So i think it's related a re-entrance issue in the internal loop of AGS, but i don't know how to handle this.

Thank you.
#5
Quote from: Crimson Wizard on Sun 02/10/2022 16:21:29Which pieces do you need? The Editor is fully available in 1 zip archive in the "windows_packaging" task.
Inside it has everything necessary for building a game for Linux too (with precompiled binaries for Debian/Ubuntu system).

Yes i had missed this one !
Thank you so much ! Works perfectly !
#6
Ok i see. I had seen those pages already, but i was thinking it was not the good location (because the messages made me think build process was still running).

Anyway, without dockerfile i think it will be tedious to grab all pieces needed to run AGS4 :)

So i will wait patiently for a public release of the first beta.

Thank you for the help.
#7
Excuse me, i hadn't seen your answer.

Thank you for the change, with scripts disabled on first-level domain (that is, this one) cookie div is hidden.

I've removed my rule for checking, of course.

As i think i will authorize scripts from this site (who knows what could be broken otherwise), i will just use my « cosmetic rule » for hiding cookie banner.
#8
Hello,

(today i'm digging old subjects)

I'm interested to see ags4 in action. Either Windows (with wine in my case) or better linux if possible.

So i've read about building and met with the cirrus-ci build system.

If i understand correctly, with cirrus-ci i could get a dockerfile of AGS4 for linux. I've read the yaml configuration file, and it seems that is the target of build.

But where to download the build ?

Reading this thread, i see it could be downloaded from:
https://cirrus-ci.com/github/adventuregamestudio/ags/ags4

Following this link shows me only « builds in-progress », not the previous finished build.
Are finished builds available to the public ? If they are kept, how to find them ?

I've became half crazy (the other sane half is typing this message) while turning in circles clicking everywhere on cirrus-ci pages.

Thank you.
#9
Quote from: AGA on Thu 29/09/2022 00:07:01It works fine in Firefox on various Windows and Mac versions.  No idea what the issue is on Linux, but unless you can give me an idea of the actual issue there isn't much I can do!  Do you see any errors in the developer console or networks tab?

I have looked at debug console, but didn't found any related errors/warning (just a warning about cookies Cookie "ct_prev_referer" does not have a proper "SameSite" attribute value , seems related to youtube css so doesn't concern my issue).

As it's working properly with chrome, i believe some obscure problem on my side with my addons.
I've just made a rule in uBlock for zapping the DIV element, and it's gone.
I was asking just in case someone else had this issue.
#10
As a Firefox user (v102, Linux) : I cannot close the banner for agreeing use of cookies.
(no × item to close it).

It is always here and doesn't disappear when i click on a subject or a sub-forum.

I've tested with Chromium and it's ok : i have the × mark to close the windows.

I have disabled uBlock and uMatrix extensions (thinking may be the closing-cross was coming from the outer-banned-space), with no changes.

I worst case, a rule in uMatrix will hide the banner, but hey. May be there are cleaner solutions.

Thank you.
#11
Hello,

Not really a question, but a summary of an interesting discussion in Discord chan.
I’m just quoting what was said on discord-chan, with a bit of editing for readability (i’ve left curses and swears).

My question was:
« How to avoid multiples functions to be created in GlobalScript, cluttering it ? Especially for Characters signal handling ».

Laura Hunt had an excellent idea:

You could create a generic function cGenericCharacterInteract().
Then with a single switch, trigger the function corresponding to the character you just clicked on:

Code: ags

function cGenericCharacter_Interact()
{
   Character*char = Character.GetAtScreenXY(mouse.x, mouse.y);
   switch (char) {
     case cPeter: PeterTalk(); break;
     case cPaul: PaulTalk(); break;
     case cMary: MaryTalk(); break;
     // etc etc
   }
}


and of course, PeterTalk() , PaulTalk() , … would be placed in another castle script file.

That’s a great idea ! I adopted it immediately, but …

(play plot_twist.xm)

Enters crimson wizard:

The problem with the above approach is that theoretically this function may be called not when the character was clicked; or not when it is the one in front.
For example, there’s Character.RunInteraction() function. It will trigger this callback too, and it may be run regardless of the mouse cursor and clicks.

As a reminder,  Character.RunInteraction()  do that:
Fires the event script as if the player had clicked the mouse on the character in the specified cursor mode. This is one of the mouse cursor modes, as defined in your Cursors tab in the editor.

That means that your mouse cursor could be anywhere on the screen, and in this case, the code above (finding the character under the mouse cursor) won't work.

So the above method will break in such case.
It also won’t work in case of keyboard / gamepad controls.

Thinking more on this, in such case it may be worked around by saving the character you are interacting with in a global variable, whenever you call RunInteraction.

The ideal solution would be to have a Character pointer in the callbacks.
(like GUI OnClick callbacks, in which GUI pointer is already there).

A pointer would just tell which character is interacted with.

Then Crimson Wizard has opened a ticket for adding Character * passing to the callback.

https://github.com/adventuregamestudio/ags/issues/1765

(to be continued)
#12
Great ! Another useless script written  :-D

Thank you for mentionning script names. As you have already guessed, i didn't knew them.
#13
Hello,

I was annoyed to put ID of item for doing comparisons in script.
The ID is error prone, it could change, etc.

I could compare the item name, but that's even more error prone and i have to get its translation, and it must be awfully slow.

So my idea was to define macro, with item name and ID.

My script parse the xml of Game.agf and input what it has found.
For example:

Code: ags

#define iCup 1
#define iKey 2


Now, i need to include this in each character scripts. Is there an include_file() function or something like that ?

Yes, i could do copy/paste, or modifying the scripts by appending generate define at the beginning (with another script), but that doesn't sound like a good idea.

Thank you.


For those interested, the extraction script (it's lua and you need to install lua-expat module)

Code: ags

#!/usr/bin/env lua

-- Archlinux users: community/lua-expat
-- doc: https://lunarmodules.github.io/luaexpat/manual.html#introduction
local lxp_totable = require("lxp.totable")

local function read_file(path)
    local hFile = assert(io.open(path, "rb"))
    local data = hFile:read "*a"
    hFile:close()
    return data
end

local function parse_table(t)
  for k,v in pairs(t) do
    if type(v) == "table" then
      parse_table(v)
    else
      if v == "InventoryItem" then
        local item = lxp_totable.torecord(t)
          print(string.format("#define %s %d",item.Name,item.ID))
      end
    end
  end
end

local xml_data = read_file("Game.agf")
local data = lxp_totable.parse(xml_data)
parse_table(data)
#14
May be you could use a module (xm, s3m…).
But for this, AGS must be able to play a single pattern, not the whole module.
If AGS can do this , then you define differents patterns with all the pitches you want. The sample will be unique, and the patterns take a few bytes each, so even with quite large number of patterns, that's almost free.

But for this to work, AGS must be able to use specificities of modules. Not just play/stop music.
#15
Nice gfx.

On the right screen, did you managed to make a scrolling map ? Or is it a room ? (may be a big room with scrolling camera :) )
#16
I would be interested by a theme resource too.

I've tried:
visualstudio dark
dracula 0.2

and they have both the same problem: selected text entries of interface are unreadable. If you select the part they belong, they become readable (except for example « import new sprites from file)

See: « Default » is ok (active sub-window), the rest is not.



I'm using AGS with Wine, maybe a related problem ?
#18
Hello,

I'm finding Dispaly() functions family quite complete, but i cannot customize as i want (color, border, fonts…).

Doing a search in the forum, it seems that the GUI for those functions is hardcoded.

So i think i must use GUI text elements, but i miss some display facilities, like automatic resizing of the width of the text box.
Is there a function i have missed, or should i rewrite a helper function for that (computing size of the font * lenght of the longuest sentence in the buffer, etc…) ?

Thank you.
#19
I've tried it, and found it funny to play. It's not bland and generic jokes , but rather ironical dialogs and situations. There is an atmosphere.

The graphics are ok for the moment. I don't have have seen many because i died quickly without saving. I'm too lazy to restart all for now.

So my pro-tip is : save often because it seems you die often (the death was deserved btw, never touch all you see in this kind of old-school game).

Anyway i will restart because it's a good game.
#20
Thank you for the additional informations. I didn't knew those subtilities. I was suspecting them with some interfaces which does not embedded well letters (letters exceed their allowed zone).

As the first language of the game is french, at least the GUI should be ok for western-languages (as the accents have quite the same ascender height for german,french,spanish).

Anyway i will keep in mind to test the GUI with the maximal size range (from descender to ascender) with some well chosen words (Éh Fthagh'n !).
SMF spam blocked by CleanTalk