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

#2341
I gave a try, not sure how well it works.

CoolAnimate.ash
Spoiler
Code: ags

import void CoolAnimate(this Character*, int view, int loop, int frame,  int delay, BlockingStyle blockStyle);
[close]


CoolAnimate.asc
Spoiler
Code: ags

// new module script
managed struct CoolAnimateData{
  bool animating;
  int delay;
  int count;
};

CoolAnimateData* coolData[];

void game_start(){
  coolData = new CoolAnimateData[Game.CharacterCount];
  for(int i=0; i<Game.CharacterCount; i++){
    coolData[i] = new CoolAnimateData;
  }
}

void repeatedly_execute_always(){
  for(int i=0; i<Game.CharacterCount; i++){
    if(coolData[i].animating){   
      if(coolData[i].count>coolData[i].delay){
        coolData[i].count = 0;
              
        int frame = character[i].Frame+1;
      
        if(frame < Game.GetFrameCountForLoop(character[i].View, character[i].Loop)){                
          character[i].LockViewFrame(character[i].View, character[i].Loop, frame);
        } else {
          coolData[i].animating = false;
          character[i].UnlockView(eKeepMoving);
        }
      
      } else {
        coolData[i].count++;
      }      
    }
  }
}

void CoolAnimate(this Character*, int view, int loop, int frame,  int delay, BlockingStyle blockStyle){
  this.LockViewFrame(view, loop, frame);
  coolData[this.ID].delay = delay;
  coolData[this.ID].count = 0;
  coolData[this.ID].animating = true;

  if(blockStyle == eBlock){
    int frame_count = Game.GetFrameCountForLoop(view, loop); 
    for (int i=0; i<frame_count; i++){
      Wait(delay);
    }
  }
}
[close]


You use this module by just calling it in your character like

Code: ags

function hGlowingOrb_AnyClick() {
  cEgo.CoolAnimate(VIEW1 /* view */, 2 /* loop */, 3 /* frame */, 5 /* delay */, eBlock);
}


I assumed you needed this for a character, if it's for something else, you have to figure out something else :P
#2342
Thank you  ;-D
#2343
I am so sorry this thread is really old but I am really curious.

Gurok, does the source for this plug-in exists somewhere? I would be really interested in looking into it to learn how it works.  :-D
#2344
There's a key which I don't remember now to show Walkable areas in the game itself, I think using it when it happens in the game could be helpful.
#2345
adventuregamestudio.github.io/ags-manual/Globalfunctions_Room.html

This is sort of done in the new upcoming manual, maybe need to add a preword at the start of this section to say that more room related functions are available under the Room object. CW had this idea to separate the Global Functions in different categories to be able to find things easier, so by reading your suggestion I think it's aligned. So new AGS Editor on the next beta should come with the manual with these sections.

Feedback on the manual is always valuable, so whatever problem with it, it's important so it can be improved. :)
#2346
That was a fun description to read, I am curious  :-D
#2347
If the character is the player, there's is player stands on hotspot event. If not, you can use character position (c.x, c.y) to check if he is at the hotspot, using room repeatedly execute event. Check the example here https://github.com/adventuregamestudio/ags-manual/wiki/Hotspot#getatroomxy .
#2348
I will add a failed attempt at event listener here just because I like this topic...

So, I know we can't have function pointers right now in AGS, but I do know struct pointers exist... And we can extend structs. You may already guessed now what was my mistake, since I too thought it wouldn't work, still, I had to try it.

EventModule.ash , the header.
Code: ags
// event module header

/// an empty custom listener to be extended and have act() overloaded
managed struct CustomListener {};

/// subscribe a new listener to an event
import void AddEventListener(String eventName, CustomListener* listener);

/// emit an event
import bool emit(String eventName);


EventModule.asc , the script, this is ugly, so I will hide with spoiler.
Spoiler
Code: ags
// new module script
#define MAX_EVENT_COUNT 32
#define MAX_EVENT_TYPES 64
#define MAX_LISTENER_COUNT 16
readonly int _max_events = MAX_EVENT_COUNT;
readonly int _max_listeners = MAX_LISTENER_COUNT;

String _event_pipe[MAX_EVENT_COUNT];

struct Event_Listener{
  int ListenerCount;
  CustomListener* Listeners[MAX_LISTENER_COUNT];
};
Dictionary* _event_map;
int _event_ids;

Event_Listener _event_listeners[MAX_EVENT_TYPES];
int _event_count;

//to be overloaded later on an extended struct
function act(this CustomListener*) {
  Display("undefined CustomListener acted"); 
}

bool emit(String eventName){
  if(_event_count>=_max_events){
    return false;
  }
  
  _event_pipe[_event_count] = eventName;
  _event_count++;
  return true;
}

void AddEventListener(String eventName, CustomListener* listener){
  if(_event_map==null) _event_map = Dictionary.Create();
  
  if(!_event_map.Contains(eventName)){  
    _event_map.Set(eventName, String.Format("%d",_event_ids));
    _event_ids++;
  }
  
  String event_id_asString = _event_map.Get(eventName);
  
  int listenerCount = _event_listeners[event_id_asString.AsInt].ListenerCount;
  _event_listeners[event_id_asString.AsInt].Listeners[listenerCount] = listener;
  _event_listeners[event_id_asString.AsInt].ListenerCount++;
}

void ProccessEvents(){
  while(_event_count>0){
    _event_count--;
    String event_id_asString = _event_map.Get(_event_pipe[_event_count]);
        
    int i=0;
    while( i < _event_listeners[event_id_asString.AsInt].ListenerCount){
      _event_listeners[event_id_asString.AsInt].Listeners[i].act();
      i++;
    }    
  }  
}

void repeatedly_execute(){
  ProccessEvents();
}
[close]

The usage, on a room1.asc script.
Code: ags
// room script file
managed struct BurnListener extends CustomListener{};
void act(this BurnListener*) {
  Display("Burn with fire");
}

function room_Load() {
  AddEventListener("fire",new BurnListener);
}

function hGlowingOrb_AnyClick() {
  emit("fire");
}


So, because the pointer to the unextended (parent?) struct is passed, it points to the original extender function. So once fire is emitted, the original CustomListener.act() method is executed instead of the new BurnListener.act() being executed. Just exploring workarounds to create a neat JS like events API using AGS script. Not there yet, but it was fun to explore.
#2349
Hey Babar!

I actually never ever used the default dialog options thing from AGS, so I would say no. I would need to investigate if it's possible. Basically the problem is figuring out if it's on or not, and once this is figured out, what's the minimal list of points where the cursor needs to be.
#2350
I used Pandoc for doing the conversion, and manually fixed the links. I think maintaining it in it's repo too is good, even if you do it in this Markdown format. Please check if I accidentally removed anything.

The wiki should be editable by you when you click the edit button while logged on GitHub.  :)
#2351
Sorry, I mixed up rtf and rst, I can take a look on this tonight.

Edit: @abstauber, I added in the ags-manual/wiki/Tumbleweed.md, I just need to fix some small details before linking it in the new template entry on the manual. I added a brief mention of your name and the template license at the top, please tell me what you think about it. Notice you can also edit it on GitHub.
#2352
It was never in the manual, the templates on the manual are the ones that have been there for historical reasons. Do you have a link to a README or other type of manual you can point to be added there? This 9verb text needs to be replaced for the tumbleweed template and a text describing it. Maybe it's interesting to add screenshots for each too.

The templates in AGS comes from here. :)

Edit: I think I found tumbleweed docs, but I need help to get this in a single markdown page to be placed in the manual.
#2353
Ah, you aren't theming your Wine prefix. If you have a Gnome theme and apply it on wine, the find replace gets confused when it changes opacity and moves on screen. This doesn't happen if you don't override Wine theme.
#2354
I have no idea, I am on Ubuntu 18.04, using Play On Linux and installed dotnet40 from the graphic PoL interface. For the redistributable I actually got it from the MS website and ran the installer with "run an .exe on this prefix" from PoL interface.

Oh, on Wine there's also a tag somewhere to mark so that the DE doesn't change how Wine decorate stuff, you need to mark that (at least on Gnome) otherwise you can't use find replace on AGS Script from ags itself - the find/replace window will "run away from you". You can also do find/replace  using Atom with AGS Scriptlanguage pack, just watch Atom, because it sometimes gets confused with line ends and replaces line ends of everything it touches - not a problem for ags but if you have your game on Source Control like git, you will get spurious file changes of Atom randomly replacing line endings for whole files. Atom hasn't given this bug anymore for me, so maybe they fixed it, but I had it on the past.
#2355
I could only get .NET to install using 32bit Wine. When I tried to install using 64bit Wine, my .NET installation got stuck. I haven't looked further. I think AGS Editor is actually Win32 - but again, my install got stuck before this, on the .NET part.

AGS Linux Engine itself I use the 64bit one because my Linux install is 64bit, but the script on top level should auto-select this.
#2356
Build has finished! I just tested and it worked! On the task you can see both Archive and Installer, I downloaded the archive and extracted here and it was good. If you haven't once, a reminder that you may need to set execution bit.

Code: bash

# on your game folder
cd Compiled/Linux
chmod +x mygamename
chmod +x data/ags32
chmod +x data/ags64
#2357
Uhm, sorry, yes the directory appears to be the same as mine, but I was in previous beta yet. If you need right now you can place the Linux Engine on Compiled/Data folder and just call it from there while testing. But the proper way is getting the fixed Editor once it finishes building.
#2358
I mean like,

cd ~/AgsWineprefix/../C/Program Files/Adventure Game Studio 3.5.0

and on this directory,

tree

. If you don't have tree,

ls * && ls */*

should be fine too. You can encapsulate the output here on the forums using spoiler and code bbcode tags (the forum markup language)
#2359
This is weird, can you run `tree` or some other command that prints the files and their hierarchy on your Adventure Game Studio folder in Program Files on your Wine prefix?

The thing about AGS Engine (not Editor) on Wine is it breaks blue light filters (at least for me on Gnome), so eye burning on late nights.  8-) Linux AGS Engine on Linux works fine though.  :)
#2360
You can't run the game pressing f5 on Wine right now. I have no idea why, but bear in mind that if it was possible it would run with the windows version of the engine right now.

Instead use f7 to fully build the game and keep a terminal tab open pointing to the game folder and run with "./Compiled/Linux/myganename" .Any errors will be shown in the terminal.
SMF spam blocked by CleanTalk