Bennu Game Development

English Forums => Suggestions => Topic started by: Grew on July 24, 2015, 08:41:16 PM

Title: get image by name (from fpg)
Post by: Grew on July 24, 2015, 08:41:16 PM

Hi.I suggest a function that returns the graph number from the name of it (the name you can see in the FPg editor).
For exemple :


graph = "my_graph_name";


Bennu automatically search the identifier of the graph in the GIF assigned to the process.


Wouldn't that be wonderful? :)
Title: Re:get image by name (from fpg)
Post by: panreyes on July 24, 2015, 11:49:38 PM
It could be, but it could also be terrifyingly slow and unoptimized.

If you're interested in something like that, I recommend you to create a function to sort it out.

It would be something like this:

function graph_me(int file,string name);
begin
father.file=file;
from x=1 to 999;
  if(map_exists(file,x))
   if(MAP_GET_NAME(file,x)==name)
    return x;
   end
  end
end
return 0;
end

Process something();
Begin
graph_me(fpg_character,"stand1");
End


But.... there's no function to retrieve the name of the graphic from the FPG, so that way won't directly work (I think)
Title: Re:get image by name (from fpg)
Post by: SplinterGU on July 28, 2015, 01:25:14 PM
maybe a function like "map_get_by_name" or "map_get" or "map_find", that use "name" as parameter...