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

#1081
I'm a huge fan of Alkis' Other Worlds. I think a lot of people avoid it because of the strange mix of photographic backgrounds and MS-Paint characters, but the plot is great and there's tons of fun and innovative puzzles in there. Especially the use of magic spells which reminded me quite a bit of Loom. Actually I find that the story and gameplay superior to the creator's later and much slicker looking commercial game, Diamonds in the Rough.
#1082
It's because the parenthesis is placed wrongly (yeah, the message is a bit misleading). It should be:

Code: ags

function room_load()
{
  if (cEgo.HasInventory(imirror)) omirror.Visible=false;
  if (cEgo.HasInventory(ivaseflos)) ovaseflos.Visible=false;
}
#1083
Glad to hear it, Xenogia! If someone could take a look at my code and try to find what causes the "cannot draw surface unto itself" error at higher loop counts, I'd be very grateful.

Trent, I hope you'll find the code useful, at least for inspiration. When I have the time I may iron out the bugs and turn it into a module.

Edit: I'm an idiot. It turned out there was nothing wrong with the script but that my background was actually animating (albeit very slowly), so the currentframe changed midway through the function. You should remember to "SetBackgroundFrame(0);" (or whatever you want it to be) in the player_enters_room script whenever you use multiple background frames but don't want them to animate. However, I've now included a failsafe so the script at least won't crash the game in case you forgot.
#1084
Which line gives you the error? Have you made sure that "MaxAmbientLight" is in fact the name of the custom property you created?

Edit: Ah, ok, does it work then?
#1085
If you can settle with using AmbientTint, you could do it like this:

In the editor, create two custom properties (Number type) called MaxAmbientLight and MinAmbientLight, set them to only apply to rooms

Then in the "if (fadetrans != currentfadetrans) {" section of the repeatedly_execute, put these lines:

Code: ags

int minlightlevel = GetRoomProperty("MinAmbientLight");
int maxlightlevel = GetRoomProperty("MaxAmbientLight");
int tint = 40; //as an experiment, I try making the light more bluish as it gets darker
if (fadetoframe == 1) SetAmbientTint(0,0, 255, ((100-fadetrans)*tint)/100, minlightlevel+(fadetrans*(maxlightlevel-minlightlevel))/100);
else SetAmbientTint(0,0, 255, (fadetrans*tint)/100, maxlightlevel-(fadetrans*(maxlightlevel-minlightlevel))/100);


Let me know if it works. Would't surprise me if there are a couple of parenthesis missing.

Edit: I forgot the saturation values in the SetAmbientTint, fixed that. AND, changed the tint value from applying to the blue color to the saturation value itself - still may need some experimenting to make it look good, and probably another color that pure blue.
#1086
Yeah, you could use the fadetrans variable as a modifier, and in the "if (fadetrans != currentfadetrans) {" section of the code set

Code: ags
region[1].LightLevel = maxlightlevel-(fadetrans*(maxlightlevel-minlightlevel))/100);


It's a shame that regions don't support custom properties, otherwise it would be very quick to set all this up in the editor by adding max/min light level properties. It would be somewhat easier if you use SetAmbientTint to adjust light levels for the entire room, but perhaps you need more detailed control for different screen areas.
#1087
Try the code I just posted, it should work. The debug key ('F' to fade) assumes that your day/night backgrounds are frames 0 and 1.

I may turn this into a module, but to be honest the reason I don't release more modules is that I can't be arsed to write the documentation. For the code to be fully functional I also need to add an event for eEventLeaveRoom so that the backup copy of the background doesn't remain in memory plus some function to make fades work across rooms (sun starts setting in one room, you walk to another room while the background is still fading, and in the new room the fade continues). Start and stop timer commands could also be useful.

Edit: Argh, I keep getting a "cannot draw surface unto itself" error with slower fades and I have no idea why. I'll look into it again tomorrow.
#1088
No you can put it in the globalscript, then import the FadeToBackground function in the global header (or put the whole thing in a module if you prefer), then call FadeToBackground from the room.

I'm in the middle of testing the code, so I may make a few corrections during the next couple of minutes.
#1089
Something like this should do the trick (not tested tested, but has problems with high loop counts):

Code: ags
DrawingSurface* backgroundbackup;
int fadeloops;
int fadetimer = -1;
int currentfadetrans;
int fadetoframe;

function FadeToBackground(int frame, int loops) {//loops is the number of frames the fade should take, so higher means slower fade speed
  if (frame == GetBackgroundFrame()) return;
  SetBackgroundFrame(GetBackgroundFrame()); //to make sure the background isn't animating
  DrawingSurface* currentbackground = Room.GetDrawingSurfaceForBackground();
  backgroundbackup = currentbackground.CreateCopy();
  currentbackground.Release();
  fadetoframe = frame;
  fadetimer = loops;
  fadeloops = loops;
  currentfadetrans = 100;
  }

function on_key_press (eKeyCode keycode)  {
  if (keycode == eKeyF) {
    if (fadetimer == -1) FadeToBackground(1-GetBackgroundFrame(), 80);
    }
  }

function repeatedly_execute() {
  if (fadetimer > -1) {
    int fadetrans = 100*fadetimer/fadeloops;
    if (fadetrans != currentfadetrans) {
       DrawingSurface* currentbackground = Room.GetDrawingSurfaceForBackground();
       if (fadetrans <= 0) {
         currentbackground.DrawSurface(backgroundbackup);
         currentbackground.Release();
         backgroundbackup.Release();
         SetBackgroundFrame(fadetoframe);
         fadetimer = -1;
         }
       else {
         DrawingSurface* endbackground = Room.GetDrawingSurfaceForBackground(fadetoframe);
         currentbackground.DrawSurface(backgroundbackup);
         currentbackground.DrawSurface(endbackground, fadetrans);
         currentbackground.Release();
         endbackground.Release();
         fadetimer--;
         currentfadetrans = fadetrans;
         }
       }
     else fadetimer--;
     }
  }
  


Edit: OK, code fixed and tested to work. I added a shortcut key ('F') just to test out the function, the on_key_press section can of course be removed if you're calling the function from script.
#1090
You can't do color cycling in 32-bit short of running a pre-made animation. What you can do however, is draw the night background on top of the day background at variable transparency using DrawingSurface functions. It's best not to use it every game loop as that will slow down the game on low-end CPUs, but calling it every second or two decreasing the transparency by one percent every time should give you a nice day-to-night effect.
#1091
General Discussion / Re: Twitter
Thu 07/05/2009 00:50:45
I still don't get the point of Twitter - beyond being haiku-blogging for readers with ADHD. Not even eloquent people like Neil Gaiman and Stephen Fry (who both write blogs that I follow with great pleasure) seem to be able to convey much of intelligence or interest within a 140 character limit. I understand that it's cool to be able to post updates from your cellphone, but is it really so urgent that you couldn't wait till you get home and can write a proper blog entry about it and provide further context, even just a headline (or perhaps realizing in the meantime that it wasn't worth sharing with the world)? By all means, keep your blog entries short if that's what you prefer, but why involve yet another service when we already have established means of distribution like RSS feeds?

Meowster, apparently you understand something about this phenomenon that I don't, so maybe you'd care to elaborate what exactly it was you discovered in your research?
#1092
Quote from: jfarwyke on Tue 05/05/2009 15:13:32when I tried your code the Speaking View didn't work, so I changed the first else if to an if and it worked like a charm

I think that was before I revised the code - I had overlooked that the two first "if (mouse.Mode)" statements both pertained to the eModeTalkto, so the second one (with "else if") never registered as true. The current version should work though.
#1093
If you trace lines from where your side walls meet the floor, you'll find your vanishing point where they cross. This can then be used to construct the perspective of the wooden base boards, like so (very rough estimate):



Without the lines:

#1094
I'd suggest nesting the code like this:


Code: ags
if (button == eMouseLeft) {
    ProcessClick(mouse.x, mouse.y, mouse.Mode ); 
    if (mouse.Mode==eModeTalkto) {
      player.FaceLocation(mouse.x, mouse.y);
      cPup.Say(" ");
      }
    else if (mouse.Mode==eModeStare) {
      if ((GetLocationType(mouse.x, mouse.y) == eLocationCharacter) || (GetLocationType(mouse.x, mouse.y) == eLocationObject)) {
        cPup.FaceLocation(mouse.x, mouse.y);
        cPup.Think("               ");
        ate -= 1;  
        if (ate == 0) {
          btnIconStare.Enabled = false;
          mouse.SelectNextMode(); 
          } 
        }
      else if (GetLocationType(mouse.x, mouse.y) == eLocationHotspot) {
        Display("You didn't click on a character or object");
        }
      }
    }


Edit: Fixed the indenting (I hope) and combined the two  "if (mouse.Mode==eModeTalkto)" statements.
#1095
I think this line

Code: ags
if ((mouse.Mode==eModeStare) && (GetLocationType(mouse.x, mouse.y) == eLocationCharacter) || (GetLocationType(mouse.x, mouse.y) == eLocationObject)) {


could be problematic (will the OR pertain to the full previous statement or just the GetLocationType check?). Try adding a parenthesis like this:

Code: ags
if ((mouse.Mode==eModeStare) && ((GetLocationType(mouse.x, mouse.y) == eLocationCharacter) || (GetLocationType(mouse.x, mouse.y) == eLocationObject))) {


and see if it helps.
#1096
You're very welcome. Glad to hear it worked!
#1097
Are you using Sierra or LucasArts style speech? To me it sounds like you're intending to use LucasArts speech, but what is in fact running is Sierra style.
#1098
The problem is that Character.Say is a blocking command, so on_key_press isn't being executed. Instead you could check for IsKeyPressed(eKeyP) in your repeatedly_execute_always. You'll probably also have to check for the button being released before allowing it to be activated again, so that holding down P doesn't make the game constantly switch back and forth between paused and unpaused.

Something like this:

Code: ags

bool pressedp;

function repeatedly_execute_always() {
   if ((IsKeyPressed(eKeyP)) && (!pressedp)) {
     if (IsGamePaused()) UnPauseGame();
      else PauseGame();
      pressedp = true;
      }
   else if ((pressedp) && (!IsKeyPressed(eKeyP))) {
      pressedp = false;
      }
   }   


Edit: If you use voice acting in your game, the currently spoken line will play to its end even if the game is paused, and upon resuming the line's text will disappear immediately (as it's timed to the audio).
#1099
Quote from: Pumaman on Mon 04/05/2009 15:58:36
Quote(a save/reload is apparently necessary for changes to the "applies to" value of custom property to register in the editor)

I can't replicate this, can you provide step-by-step instructions for how to see this problem?

Never mind, I can't replicate it either. I could swear that this happened when I imported my game into 3.2 BETA 1, but doing it again everything seems to work fine. Must have confused some similarly named properties. Sorry 'bout that.
#1100
Ogg Theora is really the preferred format for AGS now, since it doesn't require any external codecs to be installed. I don't know if .swf files can be exported as lossless .flv videos. If so, I think that mplayer is capable of converting .flv files directly to Theora. If that's not possible your best bet is to export the video as uncompressed .mpg first and then convert it to Theora format using mplayer or FFmpeg.
SMF spam blocked by CleanTalk