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

#21
Like I said: Depends what you want to do :).

For what you want, a dummy Character might be the way to go. You Won't need to declare it in every room (if it's only one room, you could use a dummy Object), you don't need to worry about DynamicSprites or DrawingSurfaces - it'd just be normal positional changing (Character/Object.Move) - it could be above or below other things as needed, and you could turn it off when you wanted.
If it only has to be below other graphics you could still use DrawingSurface.DrawImage, but you'd need to remove and re-draw the image every frame - well, if the sprite needs to change position (e.g. a 'blacklight'/UV effect that follows the player character/mouse, or in a scrolling room). And if it only needs to be above (e.g. a frame or shadow effect) you could use a GUI, or Overlay as KhrisMUC suggested.
#22
What are you trying to do, and what exactly have you done with DynamicSprites and DrawingSurfaces? If you just want to draw an existing image onto the room background, DrawingSurfaces are the way to go. Something like
Code: ags

  DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
  surface.DrawImage(50, 100, 12);

Which will draw sprite 12 onto the Room background at 50, 100 (Room coords, not screen coords).

If you want to edit the sprite for use as an Object or Character graphic, then you're looking at needed DynamicSprites. Create a DynamicSprite from the existing sprite, get its DrawingSurface, draw whatever you want, set the Character/Object to use it, like this:
Code: ags

  DynamicSprite *sprite = DynamicSprite.CreateFromExistingSprite(object[0].Graphic);
  DrawingSurface *surface = sprite.GetDrawingSurface();
  surface.DrawingColor = 13;
  surface.DrawLine(0, 0, 20, 20); // Draw pink diagonal line across sprite 12 ...
  surface.Release();
  object[0].Graphic = sprite.Graphic; //  ... and use it for object[0]
  // Stolen from manual...


But, really, it depends what you want to do...
#23
At the most basic
Code: ags

  // in repeatedly_execute
  if (GUI.GetAtScreenXY(mouse.x,mouse.y) != gInventory) gInventory.Visible = false;


That should work, provided when the Inventory GUI appears it's under the cursor. If not, it'll switch right back off - try moving the cursor with mouse.SetPosition, or allowing the GUI to be visible if the cursor is over the Menu GUI as well, or whatever. If the Menu GUI switches off when the Inventory is on, try
Code: ags

  if (GUI.GetAtScreenXY(mouse.x,mouse.y) != gInventory && gInventory.Visible == true) {
    gInventory.Visible = false;
    gMenu.Visible = true;
}


For anything more advanced - more details please, or is it complex enough for you to handle now?  :P
#24
So, the font imports OK, but crashes when you try to run the game?
Is the path you gave in the first post exactly right, or could there be some non-English characters in there? If there are, it might be part of the on-going 'AGS vs. unicode' problem (like this issue). What if you move the font (or the whole game, if necessary) to a different folder?
#25
Graphical Variables are no longer supported by AGS, AFAIK, because they're no longer needed having been replaced in the editor by Global Variables (which act more like script variables).

The function should still work, however, for backwards-compatability issues like this... Is there a line number attached to that error? There's nothing in the code that you've posted that looks like it's calling SetGraphicalVariable.

Two other things: The error refers to Paso, and your variable is now called IntVar_Paso - unless this is just a typo here, that might explain the problem. And, since you're now using regular (non-Graphical) variables, you can change them directly in script, no need for any function, e.g.
Code: ags

  IntVar_Paso = 1;
  // Instead of SetGraphicalVariable("IntVar_Paso", 1);


Finally, you might want to make that second if an else if - if IntVar_Paso is set to 1 by hotspot3_a();, the second condition will run as well.
#26
What's stopped working about it? Is it possible it's NOT the first time the player has been in that room? Try adding some other command, like a Display to see if it's running at all, or moving it to room_AfterFadeIn.

As Mr Matti said, what's the purpose? I'd guess it's an intro splash screen kind of thing? (Display your company name, before going to first room or menu screen.)

EDIT:
Heh, great minds, KhrisMUC. I was just about to edit that suggestion in...
#27
You might want to look into Fimo. It's a lightweight oven-hardening modelling clay (not as brittle as 'normal' clay, more of a soft plastic), comes in a lot of colours, good for jewellery etc, fairly cheap and available at most craft/arty stores AFAIK. At least, it used to be.

Official Site.

(Sorry If that sounds too much like an advertising spiel :) There's probably other brands out there, Fimo's just the first one I thought of.)

EDIT: Reading the comments in that link, it looks like Erin used Fimo there.
#28
Is that all there is to the function? What do those parameters do? (It looks like you just copied and edited the on_event function declaration.) Can you give an example of what you're doing when the items are collected? The code's pretty basic, but it should work OK, if Materials ever reaches 3... Throw in a Display("%d", Materials); - outside the condition - to check what's happening with it. If it's never 3 or never displays anything at all, the problem probably isn't with the function but where you're using it.

If that's all you want to do, the function is perhaps a little overkill. You could just add if(Materials==3) Display("You found all the materials!"); at the end of each of the interactions. Or, move the Materials ++; line into the function.
#29
I thought the major definition of 'forum' was 'a place to come together for discussion'? Certainly pre-internet it was, and I figured that was why internet forums were called 'forums'. So a 'philosophy forum' sounds perfectly sensible to me.

I ... have nothing else to add. Sorry. Maybe there's just something about philosophers that keeps them off the internet?
#30
I think the problem is with AGS not being able to properly handle some/most non-english characters, as you suggested (so pretty much all the Russian for 'My Documents', I'm guessing). I thought I'd seen the problem reported with save games, but the closest I can find is a music.vox error - seems like the same issue, though.

Lyaer, unless I* misunderstand your suggestion, isn't that covered by Game.SetSaveGameDirectory? (At least as of V3+, if not earlier.) Although it's limited in WHERE exactly you can save to (My Docs and sub-directories, game folder and sub-dirs), and it's "recommended that you do not use this function" in the manual, so maybe not...

*And GarageGothic, who posted while I was typing :)
#31
You can't call the global on_mouse_click like that unless you've made it a global function (imported into the Global script header). And, if you did that, I don't think you'd be able to have room-based on_mouse_clicks when you need them.

Depending on what you're after, ProcessClick might be the way to go. It'll work with Characters, Objects and Hotspots - just not with GUIs. Otherwise, you'll need to copy the relevant bits of the global on_mouse_click into the room script... (I don't think that'll work with GUIs either, however.)
#32
Yes, it's entirely possible. Are you still using KhrisMUC's code I linked you to in that other thread?

If so, or you've gone for something similar, you just need to change the lines that 'centre' the object on the mouse (the if (ob != null) condition at the bottom) to one that check the offset of the mouse from the Object's coords, and updates based on that. Something like (untested)
Code: ags

  if (ob != null) {
    int XOff  = mouse.x - ob.X;
    int YOff = mouse.y - ob.Y;
    ob.Baseline = game.room_height;
    ob.SetPosition(mouse.x-XOff, mouse.y+YOff);
  }


As I said, untested - in particular, I'm not sure I've got the + and - the right way round in the last line, and I don't think it'll work properly in scrolling rooms. Also, it might be better to declare X/YOff outside of repeatedly_execute and set them once, when the Object is first 'grabbed'. But hey, it's a start ... (And the question was 'is it possible', not 'how do you do it' :))

EDIT:
OK, so you WILL have to declare X/YOff outside of rep_ex and set them once, otherwise the object seems to jitter something awful (or not move at all). I'm assuming that's the reason, 'cause this way fixes it: Declare XOff and YOff, before room_RepExec. Add a line to the condition for 'mouse button not down' setting XOff to -1, and use
Code: ags

  if (ob != null) {
    if (XOff == -1) {
      XOff = mouse.x - ob.X;
      YOff = mouse.y - ob.Y;
    }
    ob.Baseline = game.room_height;
    ob.SetPosition(mouse.x-XOff, mouse.y-YOff);
  }


EDIT 2:
Heh, good timing with my edit I see. Glad it was too far wrong to start with...
#33
As a rule of thumb: If it has an entry in the manual, it already exists - no need for you to declare it. (Now bring on some older AGSers to give a list of exceptions to that :P)  Look at the sample usage in the manual
Code: ags

if (player.HasInventory(iKey))
{
  Display("The player has the key!!");
}


That's all you need to do, not the initial declaration.

The bracketed part of the condition - (player.HasInventory(iKey)) - is really shorthand for (player.HasInventory(iKey) == true). So, to make your example work you'd just need to add the '== false', like so
Code: ags

if (cBob.HasInventory(iGold) == false)
  {
    [game code here]
  }


Note the number of brackets in the conditional line. The extra brackets you've got around cBob.HasInventory won't cause any problems in this case - what you've got works out to if ((cBob.HasInventory(iGold) == true) == false) which is just a bit redundant - but may cause logic errors in more advanced conditions.
#34
Do you have some sort of strange triggering going on there, or what? The code you posted seems to be an InventoryItem's OtherClick() function (i.e. any mode other than Look, interact, talk or Use Inv on an item), so unless you're calling it from a Hotspot interaction (for some reason?) the mouse won't be over the 'Basin' Hotspot. (Or am I missing something about how overhotspot works? Assuming you even mean the @OVERHOTSPOT@ token, and not your own script.) Or, it might be that @OVERHOTSPOT@ - if that IS what you're using -  registers as just that, rather than the actual Hotspot name.

If you've already disabled the Hotspot somewhere then it won't show up in @OVERHOTSPOT@ or Hotspot.GetAtScreenXY, which a custom overhotspot script will probably use. (It's simply not there to be recognised.) If you're talking about that disablehotspots(); line you've got, the condition is already running by then so it won't affect it.
Did you try that Display line I suggested to see what's actually going on here? As KhrisMUC said, the engine won't arbitarily skip conditions on a whim :) so one or more of your conditions must not be being met.

And the forums look perfectly normal to me...
#35
OK, I might've misunderstood your question, sorry.

I'm not sure why you need the return in there at all, TBH. Unless there's some other use for it I haven't come across* it just stops any further code from running, which is unnecessary there as the if/else should do that automatically. Still, there's no reason that code shouldn't work as you want, provided the conditions (Label text and room) are being met. Maybe throw in a Display line, to check what they're registering as when the function runs? (Display("%s, %d", Label23.Text, cEgo.Room);) Could it be that the Label text is changing before the conditions run, or something?



* Well, there's obviously returning a value (e.g. return a + b;) - which'll also stop further code from running - but is there any other use for return; on its own?
#36
It depends on what exactly is in the conditions, I think, so it's hard to answer based on that example...

However, you may want to look into the else keyword - I think it's considered 'more polished' than using return every time
Code: ags

if (Thing1 == false) {
  Result(1);
  // code will run if Thing1 is false, IGNORING Thing2 and Thing3 (won't check their states)
}
else if (Thing2 == true) {
  Result(2);
  // code will run if Thing1 and Thing2 are true, IGNORING Thing3
  // will not run if Thing1 is false
}
else if (Thing3 == true) {
  Result(3);
  // code will run if Thing1 and Thing3 are true
  // will not run if Thing1 is false, OR Thing2 is true
}
else {
  Result(4);
  // code will run in any other case (i.e. if Thing1 is true and Thing2 and Thing3 are both false)
  // optional condition - I only included it for display. If you don't want anything to happen here, just leave it out :)
}


It doesn't matter if you change the outcomes for Thing2 or Thing3 in an earlier condition (e.g. set Thing2 to true in the Thing1 condition), it goes on their state when the first if runs, and won't re-check until the code is called again.
#37
Tutorial -> Starting off -> Part 7 - Animations and cutscenes (there's an on-line version, but it's from a previous version of AGS - not that much has changed...), and Tutorial -> Setting up the game -> Animations (also on-line).

There's nothing specifically about door animation because, well, it's just a basic Object interaction/animation, and they're pretty well covered.
For the art side (actually drawing the frames of the door opening view), I can't help you - and it probably doesn't come under 'technical' questions anyway ;). There's a list of tutorials (two lists, in fact) in the Critics Lounge that may be of use. Or, you could post what you've got over there, and get suggestions for improvement.

EDIT:
Gilbet, I found that version too, but when I try to get at the actual 'Starting off' tutorial pages that way, it's all 404s so I didn't mention it. Is it just me that it doesn't work for? Going through the website tutorial links work, though, I've updated my links accordingly.

EDIT 2, to clarify that a little:
This page, reached via the link in Gilbet's post, only leads to 404 errors for me. However, go back up a level to the main Tutorial page and the other sections work fine (I didn't bother checking them before, because 'Starting Off' didn't work), so I changed the second link to that version of the 'Animations' help.
Going to Resources/Tutorials on the navigation menu will give you a link to this version of 'Starting Off' - this is the version that's in the current manual, and one that has working links to the subsections. Maybe the on-line manual should link there as well? You know, since it works an' all... :)
#38
Aren't GUI coordinates based on screen (Viewport X/Y) coords anyway?

I think the GUI position IS static (at least, it's always at the same y coord), it's just where 0,0 is that changes. The taller rooms work relative to the top left of the screen, while the shorter rooms are placing the GUI relative to the top left of the image - not counting the 20 pixel border, so it looks further down the screen/window than in taller rooms despite being the same y position.

I think you could solve it by either having an eEventEnterRoomBeforeFadein that checks room height and moves the GUI accordingly, or maybe just by saving the shorter rooms including the borders in the image (bulking them out to 240 high).
#39
OK, it looks like I was wrong about TextBoxes being able to handle a line longer than can be seen. I was sure it worked that way, but testing (in 3.1.2 and 2.71) says not. Sorry about that, but it doesn't really affect this suggestion:

Make a Label on your GUI the width you want the TextBox 'line' to be, but tall enough to show 2 or more lines. Make the TextBox wider - much wider, so it can contain text 2 (or more) time llonger than you want a line to be - and then move it so it can't be seen on the GUI. In the global script, add this line to repeatedly_execute
Code: ags

MyLabel.Text = MyTextBox.Text;

(replacing MyLabel and MyTextBox with the right script names)

You should now have the appearance of a multi-line textbox the player can type into. This is a very simple solution, and might not be exactly what you want - if not, you'll need to give us more details to work with :).

Dualnames' code should work OK in 2.72 as-is, you just need to move it from the TextBox OnActivate function, to the if (keycode == 372) { condtion. Also, if you use my code above, you'd need to modify it to clear the Label text as well
Code: ags

  if (keycode == 372) {
    String contents = MyTextBox.Text;
    MyTextBox.Text = ""; //clears the text box
    MyLabel.Text = ""; //clears the label
      //replace 'MyTextBox' and 'MyLabel' with real names
    File *output = File.Open("file.txt", eFileWrite);
    output.WriteString(contents);
    output.Close();
  }


One problem with that code, is that it'll overwrite the contents of file.txt every time you use it. Try replacing eFileWrite with eFileAppend.
#40
Try putting the import line in the Global script header (GlobalScript.ash). I'd guess functions have to be globally accessible to be used in Dialogs (based on the first error), and that will fix that.
SMF spam blocked by CleanTalk