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

#201
I'm saying that I don't think AGS allows you to do something like:

Code: ags
if (variable = value) { } // note the ASSIGNMENT rather than comparison


I've seen it most commonly in C++, and what it means is store VALUE in the VARIABLE first, then check if VARIABLE is zero or non-zero.

Like I said though, I don't think AGS allows that due to its potentially confusing syntax.
#202
Quote from: Snarky on Sat 30/05/2015 13:17:00Also, be careful about the difference between "=" and "==".

FWIW, I don't think (IIRC) AGS allows assignment inside of a condition. Could be wrong about that though.
#203
The Rumpus Room / Re: Teach me Trigonometry
Tue 26/05/2015 21:19:34
Well it seems my years of honing my algebra skills in programming random things has been ineffably useful. I only have two days left of the class, and then the final exam, but I haven't made a single grade lower than 96 I think on any assignments, with the exception of one PowerPoint presentation that I didn't spend enough time on, which I made a 90 on.

In short, I'll probably only need to make a 30 or 40 (percent) on the final exam to get an A for the course. It makes a hell of a lot of sense to me, which my roommate nearly killed me over (they having dropped the class in the Spring semester).

Cheers!
#204
Not sure when Dave posted this, but I was chatting with him yesterday and the error seemed to be that he had the wrong version of the Steam API DLL (steam_api.dll) from what the plugin was built against. When I have time I will be sure to download the latest Steamworks and do fresh builds.

He also mentioned that once he sorted that out there were some achievement issues, but as CW said, other games have been released on AGS 3.3 with this plugin, so that could also be related to out-of-date builds. Will update ASAP.
#205
Oh, also I'll note that it would be easy for the BackwardsCompatible module (if anyone still has it or wants to recreate it) to be updated with toggle-able features, based on macros. For example, if you wanted to import the old-style Character functions without fully adding the old-style code support, there could be a macro like BC_CHARACTER that, if defined, would import those functions, or otherwise would omit them.

Code: ags
// BackwardsCompatible.ash
#ifdef STRICT
#ifdef BC_CHARACTER
import void AddInventory(int item);
import void LoseInventory(int item);
import void SetActiveInventory(int item);
import void NewRoom(int roomNumber);
import void NewRoomEx(int roomNumber, int x, int y);
import void NewRoomNPC(CHARID, int roomNumber, int x, int y);
import int  GetCharacterProperty(CHARID, const string property);
import void GetCharacterPropertyText(CHARID, const string property, string buffer);
import void RunCharacterInteraction (CHARID, CursorMode);
import void DisplaySpeech (CHARID, const string message, ...);
import int  DisplaySpeechBackground(CHARID, const string message);
import void DisplaySpeechAt (int x, int y, int width, CHARID, const string message);
import void DisplayThought (CHARID, const string message, ...);
import void FollowCharacter(CHARID sheep, CHARID shepherd);
import void FollowCharacterEx(CHARID sheep, CHARID shepherd, int dist, int eagerness);
import void SetPlayerCharacter(CHARID);
import void AddInventoryToCharacter(CHARID, int item);
import void LoseInventoryFromCharacter(CHARID, int item);
import void AnimateCharacter (CHARID, int loop, int delay, int repeat);
import void AnimateCharacterEx (CHARID, int loop, int delay, int repeat, int direction, int blocking);
import void MoveCharacter(CHARID, int x, int y);
import void MoveCharacterDirect(CHARID, int x, int y);
import void MoveCharacterPath(CHARID, int x, int y);
import void MoveCharacterStraight(CHARID, int x,int y);
import void MoveCharacterToHotspot(CHARID, int hotspot);
import void MoveCharacterToObject(CHARID, int object);
import void MoveCharacterBlocking(CHARID, int x, int y, int direct);
import void MoveToWalkableArea(CHARID);
import void FaceCharacter(CHARID, CHARID toFace);
import void FaceLocation(CHARID, int x, int y);
import void SetCharacterView(CHARID, int view);
import void SetCharacterViewEx(CHARID, int view, int loop, int align);
import void SetCharacterViewOffset(CHARID, int view, int x_offset, int y_offset);
import void SetCharacterFrame(CHARID, int view, int loop, int frame);
import void ReleaseCharacterView(CHARID);
import void ChangeCharacterView(CHARID, int view);
import void SetCharacterSpeechView(CHARID, int view);
import void SetCharacterBlinkView(CHARID, int view, int interval);
import void SetCharacterIdle(CHARID, int idleView, int delay);
import void StopMoving(CHARID);
import int  AreCharObjColliding(CHARID, int object);
import int  AreCharactersColliding(CHARID, CHARID);
import void SetCharacterSpeed(CHARID, int speed);
import void SetCharacterSpeedEx(CHARID, int x_speed, int y_speed);
import void SetTalkingColor(CHARID, int colour);
import void SetCharacterTransparency(CHARID, int transparency);
import void SetCharacterClickable(CHARID, int clickable);
import void SetCharacterBaseline(CHARID, int baseline);
import void SetCharacterIgnoreLight (CHARID, int ignoreLight);
import void SetCharacterIgnoreWalkbehinds (CHARID, int ignoreWBs);
import void SetCharacterProperty (CHARID, int property, int newValue);
import int  GetPlayerCharacter();
#endif // BC_CHARACTER
#endif // STRICT


This could serve as a more powerful option than the catch-all "enforce object-based scripting".
#206
user.ico is a known issue of this alpha since the new build target interfaces were added. I've been over the code and AFAICT, nothing pertinent has actually even changed. The generated EXE is identical, so there should be nothing preventing the icon being updated.

In fact, in my test, the native methods responsible for updating the icon are reporting success.

I may look into refactoring the icon updating to a C# method instead and see if that fixes the problem. The native interop is still somewhat perplexing to me, so I could be overlooking something simple.
#207
Quote from: Crimson Wizard on Tue 28/04/2015 19:48:55UPD2: Since my attention was brought to this, I think this is an incorrect behavior of AGS. It links functions that are not declared; this would cause problems if someone scripts function, using name of deprecated function, even if he did not know it is.
I think engine should not register old functions if they are not used in game.

Just as a point of reference, this is what CJ said about it:

Quote from: Pumaman on Mon 26/02/2007 19:50:46The AGS engine still exports all the old-style functions, the only thing that happens when "Enforce object-based scripting" is ticked is that they are removed from the script header so that your script won't compile.

So in fact, all your BackwardsCompatible module needs to do is provide a script header with the appropriate import declarations in it ;)

He didn't seem to think it was problematic for the built-ins to still exist (be registered) even if not using them. I do agree that it could be useful to omit them...but I will also then have to admit that I have used some of the functions (old-style String functions, in particular) in modules which are designed to still use the old functions even if they are "disabled". Honestly, I don't recall if I did that in any production code, but there are cases where using StrCopy is faster than String.Append or String.Format, and I've toyed around with that a fair amount.
#208
Modules, Plugins & Tools / Re: Old modules
Tue 28/04/2015 18:40:53
Usually modules are updated when the author is adding new features, or someone requests it.

Are there specific modules you would like to see upgraded?
#209
Quote from: Monsieur OUXX on Mon 27/04/2015 12:04:48What I usually do to perform a quick upgrade is to actually recreate custom functions with the exact same syntax as the missing ones:

FALLLLLLSSSSEEE!

As SSH learned with the BackwardsCompatibility module (which was designed for this purpose), your function won't be called. All you need is the imports, e.g.:

Code: ags
import int StrLen(const string);


Actually, you had a different signature, so I'm not sure on that, but you should just import the built-ins rather than trying to emulate them, especially with String functions.[/code]
#210
libsteam_api.so is included in the Steam download for both 32-bit and 64-bit.

If you download the game from Steam, then you do not need to compile or add anything additionally.


Actually, I was double-checking myself because I didn't actually do the Steam release on this one, I just added some extra features to the plugin. My apologies, it seems that this game was never actually released on Steam for Linux.

In that case, you can use the Windows executable, but you will need to compile the agsteamstub. I didn't provide binaries of the stub because of numerous people decrying "some random dude from the internet" handing out compiled code - despite the fact that I am the original plugin author, and the code I write is distributed (and in some cases, embedded) in the games.

Sorry about the confusion, I was sure that we (Screen 7, whom I do most of the Steam integrations for) had released this on Linux as well.
#211
Hmm... Actually, I just recalled that I hosted the full plugin on the "Downloads" page of the stub, because my other host deleted my account. That's probably confusing... I was just looking for somewhere to host the full plugin.

In any case, have you tried building the stub from source? Or, you know, since you have Steam installed, just downloading/launching the game from the Steam client?
#212
The agsteamstub source can be compiled with gcc. I don't have a makefile because I just used Code::Blocks. It should be built as "libagsteam.so". I recall using "-fPIC" and of course "-m32" for the 32-bit variant. I set the rpath of the full plugin, but I don't think I did that for the stub. I will confirm any other settings later, when I have it in front of me.

The stub does not in any way reference libsteam_api.so or the Steamworks API, so any errors of that sort mean you definitely still have the full plugin, not the stub.
#213
It might make more sense to just reserve a slot number for autosaving... If you want to do it that way then you could seek out the first free slot like this, but note that it makes continuing from the last autosave a bit more complicated.

Code: ags
// GlobalScript.ash

import int autoSaveSlot;
import bool SaveSlotExists(int slot);
import int GetFirstFreeSaveSlot(int startFrom=SCR_NO_VALUE, int lastSlot=999);
import bool AutoSave();
import bool ContinueGame();

// GlobalScript.asc

int autoSaveSlot = -1;
export autoSaveSlot;

bool SaveSlotExists(int slot)
{
  return (Game.GetSaveSlotDescription(slot) == null);
}

int GetFirstFreeSaveSlot(int startFrom, int lastSlot)
{
  int i = 1;
  if (startFrom != SCR_NO_VALUE)
  {
    i = startFrom;
  }
  if ((lastSlot < i) || (lastSlot > 999))
  {
    lastSlot = 999;
  }
  while (i < lastSlot)
  {
    if (!SaveSlotExists(i))
    {
      return i;
    }
    i++;
  }
  return -1;
}

bool AutoSave()
{
  if (autoSaveSlot == -1)
  {
    autoSaveSlot = GetFirstFreeSaveSlot();
    if (autoSaveSlot == -1)
    {
      return false;
    }
  }
  SaveGameSlot(autoSaveSlot, "[AUTOSAVE]");
  return true;
}

bool ContinueGame()
{
  if (autoSaveSlot != -1)
  {
    RestoreGameSlot(autoSaveSlot);
    return true;
  }
  int i = 0;
  while (i < 999)
  {
    String desc = Game.GetSaveSlotDescription(i);
    if (desc == "[AUTOSAVE]")
    {
      autoSaveSlot = i; // even though this will be overridden, this will allow you to know which slot is about to be loaded (since RestoreGameSlot is delayed)
      RestoreGameSlot(autoSaveSlot);
      return true;
    }
    i++;
  }
  return false;
}
#214
The only static functions that the new-style String class has are: String.Format and String.IsNullOrEmpty.

All other new-style String functions should be called on the object:

Code: ags
String message = "Hello World";
int length = message.Length;
message = message.Append(", from AGS!"); // just to preemptively point out that the Append function (etc.) does not modify the original
int newLength = message.Length;


There is a page in the manual on upgrading to 2.71 that talks about the new style Strings.
#216
If it's failing to load libsteam_api.so that indicates that you probably copied the wrong shared library for Steam (32-bit/64-bit mismatch) or you don't even have Steam installed.

The stub is a viable option if you aren't using Steam, but I wanted to point out that this game does work with Steam for Linux.
#217
Code: ags
ViewFrame *frame = Game.GetViewFrame(cEgo.View, cEgo.Loop, cEgo.Frame);
int width = 0;
int height = 0;
if (frame != null)
{
  int scale = cEgo.Scaling;
  width = (Game.SpriteWidth[frame.Graphic] * scale) / 100;
  height = (Game.SpriteHeight[frame.Graphic] * scale) / 100;
}
int xx = cEgo.x - (width / 2);
int yy = cEgo.y - height;


That would give you the coordinates of the top-left corner of the character sprite, accounting for scaling. You could also make some extender methods for easy reuse.
#218
I really think those should be the default settings by now. Most modern computers really aren't (properly) compatible with the other modes.

Oh, and as for exporting the files, some of the cursor images I know have a black border but the exported image has a black background. These will need to be corrected by hand to be reimported.
#219
General Discussion / Re: Free Steam keys!
Wed 15/04/2015 20:10:24
The gift icon requires an email address. I just wanted to be sure before I "redeemed" the Steam key from Humble Bundle that I was doing it right.

KOTOR II to a good home (please post when taken)

Spoiler
Z6TNN-94PVD-CMZGK
[close]
#220
General Discussion / Re: Free Steam keys!
Wed 15/04/2015 19:30:50
Question... I bought the Humble Bundle Star Wars pack a while back and got an extra copy of KOTOR II. How to give away, please? ;) Do I click the button to redeem it on Steam and just post that code here?
SMF spam blocked by CleanTalk