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 - Crimson Wizard

#12041
Well, should I apply this as it is now, or wait for any improvement? Do you have any plans on this?
#12042
Beginners' Technical Questions / Re: AddPoint
Sat 20/04/2013 19:05:13
Quote from: Cerno on Sat 20/04/2013 18:27:03
Question: Is it possible to add error handling to AGS, like assertions or something?
I have some ideas to make this more robust against errors. I could work around this by using any invalid command, but I was hoping there was a better way.
You may use Display command, or DisplayTopBar (displays text with custom header) to show error message. You may also call AbortGame to instantly quit in case of irrecoverable error (with error message).
#12043
Calin, I looked on the code, and I don't understand, is there any reason why the failed sprites could not be simply skipped to let the reimporting process continue?
#12044
Quote from: Cerno on Sat 20/04/2013 10:31:27
But it does. Open the game.agf in a text editor and see for yourself ;)
Edit: Unless tiles != sprites in which case I take everything back.
Tiles != sprite, tile = part of sprite. Tiled import allows to cut sprite into pieces of identical size.

Quote from: Calin Leafshade on Thu 18/04/2013 23:54:06
AGS doesnt record the source of tile imports nor the rect so they cannot be reimported from source.
Would not it be possible to extend sprite information and keep the rectangle coords along with source file?
#12045
Quote from: Nero_Ace on Fri 19/04/2013 12:25:00
Some of my hotspots take you to a different room while others initiate pick up events or interacting with characters. Is there a way to tell the code what "type" of hotspot it is and get it to differentiate cursors for the different types?
This is usually done using Custom Properties.
http://www.adventuregamestudio.co.uk/wiki/Other_features_(manual)#Custom_Properties

For example, you create a property "ActionType" for hotspots, where 1 means "leave area", 2 means "interact" etc. Then you apply those values to every hotspot in the room editor.

In script:
Code: ags

if (loc_type == eLocationHotspot)
{
  Hotspot *h = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
  int action_type = h->GetProperty("ActionType");
  if (action_type == 1)
     Mouse.Mode = eModeWalk;
  else if (action_type == 2)
     Mouse.Mode = eModeInteract;
}



Quote from: Nero_Ace on Fri 19/04/2013 12:25:00
Also, I have an always on Inventory System. So what I need is for the cursor to automatically change to the interact icon when you hover over the GUI with the inventory system
Hmm, probably this:
Code: ags

GUIControl *ctrl = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
if (ctrl == gInvWindow /* use your actual inventory gui script name here */)
{
   // do something
}
#12046
There is always a way to know what is beyond mouse cursor by using following functions:
GetLocationType
Character.GetAtScreenXY
GUI.GetAtScreenXY
GUIControl.GetAtScreenXY
Hotspot.GetAtScreenXY
InventoryItem.GetAtScreenXY
Object.GetAtScreenXY
Region.GetAtRoomXY


For example, to know which object is under cursor:
Code: ags

Object *obj = Object.GetAtScreenXY(mouse.x, mouse.y);
if (obj != null)
{
   // you have an object there, do what you want
}


Since you want your cursor to react on its location, this code should be put into global repeatedly_execute function:
Code: ags

function repeatedly_execute()
{
   Object *obj = Object.GetAtScreenXY(mouse.x, mouse.y);
   if (obj != null)
   {
      // set new mouse mode until mouse leaves object
      Mouse.SaveCursorUntilItLeaves();
      Mouse.Mode = eModeInteract;
   }
}





If you want more general solution, use GetLocationType:
Code: ags

function repeatedly_execute()
{
   LocationType loc_type = GetLocationType(mouse.x, mouse.y);
   if (loc_type != eLocationNothing)
   {
     Mouse.SaveCursorUntilItLeaves();
     if (loc_type == eLocationHotspot)
     {
       Mouse.Mode = eModeWalk;
     }
     else if (loc_type == eLocationObject)
     {
       Mouse.Mode = eModeInteract;
     }
     // and so forth
   }
}
#12047
The Rumpus Room / Re: Name the Game
Fri 19/04/2013 11:09:44
Hey guys, use "zoomable image" tag please  :(.
It is [ imgzoom ] image link [ /imgzoom ] without spaces (or click on corresponding formatting icon)

Working example:
Spoiler
#12048
Engine Development / Re: Plugin API
Fri 19/04/2013 00:06:42
It' been a year! wow.
Anyway.

Unfortunately, it seems that we won't be able to maintain (engine's) Plugin API in its current form. By saying "not able" I mean it will be
pain in the... head to do so.
What's wrong with current plugin system?

1) It grants free access to internal engine data. Which...
   a) allows plugin to easily corrupt engine's memory;
   b) prevents from changing internal object implementation;
   c) prevents from changing data location in memory (like, dynamic reallocation on new place, which is common when arrays of objects grow or shrink);

2) It is based on classes with virtual inheritance. Which is not so bad on its own, but it appears that different compilers pass class objects slightly different, and that "slightly" is enough to screw things up when there's virtual table pointer in them.


Keeping those points in mind, those are requirements for (engine's) Plugin API:
1. It should not provide addresses (pointers, references) to real engine objects or parts of those objects.
Instead, engine may return interface objects that serve medium between plugin and game object, and, in certain cases, temporary PODs used to
read/write game object's state.
2. It should not have interfaces with virtual functions. This means that interfaces may only have normal functions and member variables.
3. Additionally, we may consider to let people write plugins in C, in which case the only option for interfaces are C structs with function pointers in them.

In fact, unless I forget some other opportunitues, it seems that C-style interfaces (structs with function pointers) are the only option, because if we can't use virtual functions, we won't be able to create extending classes in plugin to pass their objects to engine (like for the font renderer) :-/.
#12049
The Rumpus Room / Re: Name the Game
Thu 18/04/2013 23:23:56
"Innocent until caught"
Well, not 100% sure, but looks familiar to something I saw loooong time ago. I mainly recall those interface icons for some reason.
#12050
The "Replace sprite from file" feature you mention exists in the development version of the editor, and will be put into final 3.3.0 release.
I am not sure if it works of tiled import though, maybe not. But even then, you may suggest it here or here.

http://www.adventuregamestudio.co.uk/forums/index.php?topic=47768.0

A custom 3.2.1 version built with this feature:
https://dl.dropbox.com/u/27247158/AGS3.2.1WithSpriteReload.zip
#12051
The Rumpus Room / Re: Name the Game
Thu 18/04/2013 21:10:08
Barn Runner?
Spoiler

Okay, sorry, just kidding.
[close]
BTW, are AGS games allowed to be used here?
#12052
Quote from: CaptainD on Thu 18/04/2013 12:23:25
Quote from: Renodox on Wed 17/04/2013 22:03:42
Okay, this is an additional riddle but one I made up.  Guess the word:

Lee the knight in light brown armor.

Surley?  (Sir Lee)

Certainly :) (Sir Tan Lee)
Tan = light brown.
#12053
Actually, I just made a quick test to see how AGS auto crossfading work. That may be my ears, or the music, but I really don't see (hear) any problems when music is changing. It sometimes act a bit weird when music starts in silence though (it plays in low volume first, then suddenly gets louder).
Unfortunately there's no way to set up precise crossfade duration in AGS (something worth of a feature request maybe).
#12054
I apologize if all this is already known to you, but I would like to note something very important prior to anything else.

The AudioChannel* is a pointer, not persistent object. When you say "I have three channels" this should be read as "I have three references to audio channels".
What do they reference? They may reference absolutely nothing, for instance. Or same channel. Or different channels every other time.
The actual channel objects are inside the AGS, and you do not have direct access to them, you may only control how many of them are there.
You do this by setting "MaxChannels" in the sound type object (Project Tree -> Audio -> Types -> any type, e.g. Music -> MaxChannels).

So, first thing I'd like to ask: what did you set the MaxChannels to?
Also, check "Crossfade tracks" option, maybe you could use that one instead of manually crossfading music?

Then, just something that I noticed:
Code: ags

function MusicChange(AudioClip*thisClip, int vol, int time, bool repeat)
{
  float ftime=IntToFloat(time);
  ftime=ftime/1000.0;
  if (MusicChannelActive.PlayingClip != thisClip) //check to see if the active channel is already playing the requested clip

This will crash the game, if MusicChannelActive was not assigned prior to the function call. I don't know all your program logic, but I'd add "MusicChannelActive != null" check.
#12055
The Rumpus Room / Re: Name the Game
Wed 17/04/2013 21:26:41
Quote from: frenzykitty on Wed 17/04/2013 20:57:03
Creamy: Is it Shadow of the Comet?
Funny I thought the same at first, although then I realized the buildings are rather the ones of a large city ;).
#12056
GlobalScript.asc, function on_mouse_click:
Code: ags

function on_mouse_click(MouseButton button)
{
  // User clicked right mouse button
  if (button == eMouseRight)
  {
     // If user has inventory item selected...
     if (player.ActiveInventory != null)
     {
        // Invoke "using inventory" command
        ProcessClick(mouse.x, mouse.y, eModeUseinv);
     }
  }
}


About ProcessClick: http://www.adventuregamestudio.co.uk/wiki/Game_/_Global_functions#ProcessClick

EDIT: lol I misread what you said.
You probably meant "Interact" action, in which case:
Code: ags

function on_mouse_click(MouseButton button)
{
  // User clicked right mouse button
  if (button == eMouseRight)
  {
     // Invoke "interact" command
     ProcessClick(mouse.x, mouse.y, eModeInteract);
  }
}
#12057
Quote from: Joseph DiPerla on Wed 17/04/2013 00:10:35
Hey tzachs. I compiled the new Git upload. Still giving me that issue. It most likely is an issue on my system then.
Does this happen if you use 3.2.1?
I believe we should eventually find the root of this problem, even if it happens only on some systems.
#12058
BTW, in case anyone interested, I was able to test this plugin without real joystick, using this: http://headsoft.com.au/index.php?category=vjoy

Just saying ;).
#12059
Freedom to choose the role and play it.
Freedom to use the items and spells in the ways defined by physics engine and not hard-coded logic.
Freedom to wander away when I don't want to interact with people, and freedom to kill/ignore those who annoy me, even if they are quest characters.
No scripted sequences when people die no matter what I do.
#12060
AGS Games in Production / Re: Quest for Weed
Mon 15/04/2013 21:39:37
Nice looking game :).
SMF spam blocked by CleanTalk