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

#2781
Very strange, yes. Do you mean it pops up if you move over character/hotspot/object after having clicked somewhere else, or everytime? If it's just after a click, it may be that the buffers (clicked and timer) haven't reset, so when you move onto something the script gets called. Try:
Code: ags

  if (timer >= 20) { 
    if ((GetLocationType (mouse.x, mouse.y) != 0) || (GetInvAt (mouse.x, mouse.y) != -1)) { // Brace here
      SetGUIPosition(2,guix,guiy);
      InterfaceOn(2); 
      clicked=0; 
      timer=0; 
    } // And here
    else { //clicked 'nowhere', so...
      clicked=0; // stop checking
      timer=0; //reset timer
    }
  }


And about the InventoryScreen();  thing, it calls the internal Inventory (smaller, bland, expands when you pick up more items), as opposed to opening the Inventory GUI (GUI3 by default, larger, bland but customisable, fixed size). Look up the show_inventory_window () function near the top of the global script of a new AGS game.
#2782
unhandled_event is for, well, unhandled events - i.e. when the player clicks on something that doesn't have an interaction set, it does something like display an "I can't do that", "That won't work", "I don't see anything special" kind of thing. So, basicly, it doesn't know which hotspot the player looked at, only that it was one without a 'Look at' action defined. If you want to specify which one, you just have to add a couple of extra 'if' conditions, e.g.
Code: ags

function unhandled_event (int what, int type) {
if (what == 0) {
  if (type == 1) { //if 'Look at Hotspot'
    if (GetHotspotAt (mouse.x, mouse.y) == 3) { //if 'Look at Hotspot 3'
      Display ("That's hospot number three.");
    }
    else { // if looking at a hotspot other than 3, with no 'Look at' action
      Display ("I don't know what that is, but it's not hotspot number 3.");
  }
}
}


You could also add an if (player.room == x) condtion, but really you'd be better just setting the Hotspot interaction directly.

I don't think there's an on_event event for after fade in, so you'd either have to use a timer, as you said, or type the script in every room. You could put it all into a custom function, though, so you'd only have to copy-paste one line.
#2783
What exactly is the trigger event? Since that probably effects where you'd but the script.
#2784
What inventory GUI are you using? Have you setup your custom one yet, or are you still using the InventoryScreen() one? For me, it didn't work on the InventoryScreen() one, but does on a custom one. If you are using a custom one, the problem maybe that it's popup modal - which means the rep_ex script might not run. Try setting it to 'Normal', and switch it off in game_start.
If it's already set to 'Normal', or if that doesn't work, then I'm out of ideas, it works fine for me.

Also, I think you're missing a couple of braces, which may be why the GUI pops up wherever you click:
Code: ags

Ã,  if (timer >= 20) { //when you've held it for 20 (half a sec.), the GUI pops
Ã,  Ã,  if ((GetLocationType (mouse.x, mouse.y) != 0) || (GetInvAt (mouse.x, mouse.y) != -1))
Ã,  //Checks if mouse is over character/hotspot/object/inv first
Ã,  Ã,  SetGUIPosition(2,guix,guiy);Ã,  //selfexplanatory? Oh, our GUI is numero 2.
Ã,  Ã,  InterfaceOn(2); //turn the GUI on
Ã,  Ã,  clicked=0; //guess what..
Ã,  Ã,  timer=0; //and this?
Ã,  Ã,  }


should be (I've trimmed out the comments to make it more obvious where they go):
Code: ags

Ã,  if (timer >= 20) { 
Ã,  Ã,  if ((GetLocationType (mouse.x, mouse.y) != 0) || (GetInvAt (mouse.x, mouse.y) != -1)) { // Brace here
Ã,  Ã,    SetGUIPosition(2,guix,guiy);
Ã,  Ã,    InterfaceOn(2); 
Ã,  Ã,    clicked=0; 
Ã,  Ã,    timer=0; 
Ã,  Ã,  } // And here
Ã,  }


I just checked, and they are there in my earlier post, not sure how they got missed out.
#2785
Well, see, you're changing two cursor modes there (MODE_LOOK, MODE_WALK), which might be confusing it - you might be altering the cursor for a mode you're not in, which wouldn't have any noticeable effect. What happens if you try:
Code: ags

if ((GetLocationType (mouse.x, mouse.y) !=0) || (GetInvAt (mouse.x, mouse.y) != -1)) {
  //Is cursor over hotspot, object, character or Inv item?
  // Yes it is, so...
  ChangeCursorGraphic (MODE_LOOK,2056);
  ChangeCursorGraphic (MODE_WALK, 2056);
}
else {
  ChangeCursorGraphic (MODE_WALK,2054); //No it isn't, so cursor goes back to normal
  ChangeCursorGraphic (MODE_LOOK,2054);
}

Just as a test. This should change the cursor regardless of which mode you're in.
#2786
Yeah, what Stuh505 said. INVENTORY is the name of the default inventory GUI, which I was using, so you need to change it if that's not what you're using. Looks like (GetGUIAt (mouse.x, mouse.y) == 3) should do it.

Same with REDCURSOR and WHITECURSOR - which should be sprite numbers - and mode - which is whatever cursor mode you're using as default. Sorry if I wasn't clear.

However, try this instead:
Code: ags

if ((GetLocationType (mouse.x, mouse.y) !=0) || (GetInvAt (mouse.x, mouse.y) != -1)) {
  //Is cursor over hotspot, object, character or Inv item?
  // Yes it is, so...
  ChangeCursorGraphic (mode, REDCURSOR);
}
else ChangeCursorGraphic (mode, WHITECURSOR); //No it isn't, so cursor goes back to normal


Should also change on characters, hotspots, and objects now.
#2787
Go to the 'Views' window of the editor.
Click the 'New View' button. Import the images into the new view, just like with characters.

In the 'First Time player enters screen' section set the Object view (SetObjectView (obj, view), or Object - Set object view number in the Interaction Editor.

Then, in the button's 'Interact hotspot'(or 'Interact object', if it's an object) section, add an AnimateObject(); or Object - Start object animating command, specifying the view number, and the loop number (probably 0).
#2788
What if you change:
Code: ags

if (timer >= 20) {
  SetGUIPosition(2,guix,guiy);  //selfexplanatory? Oh, our GUI is numero 2.
  InterfaceOn(2); //turn the GUI on
  clicked=0; //guess what..
  timer=0; //and this?
}

to:
Code: ags

if (timer >= 20) {
  if ((GetLocationType (mouse.x, mouse.y) != 0) || (GetInvAt (mouse.x, mouse.y) != -1)) {
  //Checks if mouse is over character/hotspot/object/inv first
    SetGUIPosition(2,guix,guiy);  //selfexplanatory? Oh, our GUI is numero 2.
    InterfaceOn(2); //turn the GUI on
    clicked=0; //guess what..
    timer=0; //and this?
  }
}


For the second part:
Code: ags

//in rep_ex
if ((GetGUIAt (mouse.x, mouse.y) == INVENTORY) && (character[EGO].activeinv == -1)) {
// If you're on the inventory, and haven't selected an item
  if (GetInvAt (mouse.x, mouse.y) != -1) ChangeCursorGraphic (mode, REDCURSOR);
  // Change cursor if over inv item ...
  else ChangeCursorGraphic (mode, WHITECURSOR);
  // ... And back when it isn't
}
else SetDefaultCursor ();

Or something like that, anyway. Works for me, but you'll have to play with it a bit, depending on how exactly your game's set up.
#2789
Oh bum, Ishmael's right. You'd have to use:
Code: ags

// in 'Repeatedly Execute'
Ã,  string hp;
Ã,  StrFormat (hp, "%d", GetGlobalInt (1));
Ã,  SetLabelText (0, 1, hp); // or whatever GUI/Object you're using


Which means it's probably as easy to create a custom int.

Was the countdown link in my last post no use, then?
#2790
what does the score have to do with it? And why would you need 2 GUIs?
Would one be the character HP, and the other the enemy?
If so, try using a GlobalInt to store one of the HP values, and use @GIx@ (where x is the number of the GlobalInt) instead of @score@ on one GUI.

And about the countdown timer, checkout strazer's second bit of code in THIS THREAD.
#2791
There used to be a big thread about his, but I guess it's off-line just now.

However, there's a smaller version HERE that might give you some ideas. Personally, I use Paint Shop Pro, but I've never actually finished a game in it.....

EDIT: but that's my fault, not PSP.
#2792
This is what I've used for opening/closing a drawer, it should work for you too:
Code: ags

// Where ever you want is triggered from (Object interaction or Hotspot interaction)
if (GetObjectGraphic (0) == xx) { // where x is the sprite number of the 'open window' graphic
Ã,  AnimateObjectEx (0,0,3,0,0,1); // You could use AnimateObject, but I wanted it blocking.
}
else if (GetObjectGraphic (0) == yy) {// where yy is the sprite number of the 'closed window' graphic
Ã,  AnimateObjectEx (0,0,3,0,1,1); // runs the loop backwards
}


Check the parameters for AnimateObjectEx (..)to make it run how you want (e.g. delay, blocking)
#2793
I think the warning marker means the sprite was imported at a different colour depth than the game is running at. Have you recently changed it? As you said, it isn't really a problem, but if it becomes one I think you'll either have to change the colour depth back, or re-import the sprites.
#2794
I think you have to import a font with the characters you need (Ö and ö for example). There used to be some around, but with the forums as they are....
However, you can import any Windows font (.ttf), or you could edit one of these AGS fonts using Radiant's font editor.
#2795
Look these up:
   SetCharacterView ();
   AnimateCaharacter();
   ReleaseCharacterView();

If you're using the Interaction Editor:
  Character - Quick animation
does the same thing.
Basicly, you'll need to set up a new view to hold the kneel down loop (or loops, if you want one for each direction), then switch to that view to run the  animation.

I think that's the 'Proper' way to do it, but you could set your character to 'no diagonal loops' on the character options screen, and then use loops 4-7 of the walking view to hold the kneeling animation. Or, if you have diagonal loops, loops 8-15 can hold other actions.
#2796
Change the 'Room transition style' option on the 'General Settings' window (by default it's set to 'Fade out/in').
The one you mentioned is 'Black box out'.
#2797
And the winner is....

Mr_Frisby
(I never could resist salty, salty snackfoods.)

An 'Honourable Mention' goes to Hotspot, but the Earth itself isn't exactly the greatest invention in the world, is it. Unless you're from Magrathea, I suppose.

Congratulation Frisby, and thank you all for playing.
#2798
The second version looks nearly right, but:

1. There's a typo in the the IsTimerExpired() description in the manual - you need to use 'if' not 'If' (case sensitive, which is why you get the 'undefined token' message)

2. You missed the ) off the end of if (IsTimerExpired(1)==1)

3. If they don't help, try putting this bit:

if (IsTimerExpired(1)==1)
{DisplayMessage(9);}

in the room's repeatedly_execute. As it is, it might only display the message if the timer was expired when you entered the room, which it never will be.

EDIT:
Didn't see the second question.
I think you'd need to use a variable to keep track of where the timer was, and reset from that when you enter the room. I don't know if there's an easy way to do that, though. Sorry.

EDIT 2:
This is the way I'd do it:
1. Remove all references to the Timer - you won't need it.
2. Create an int in the room, called timer.
   (Open the Room Script, and add int timer; at the top, outside any functions)
3. Paste this code in to the repeatedly_execute:
Code: ags

  // script for room: Repeatedly execute
if (timer < 1000) timer++;
else if (timer == 1000) {
  DisplayMessage (9);
  timer ++;
}


This should do the same thing as a Timer, but will pause the countdown when you're not in the room, and pick up where it left off when you go back.
#2799
I'm not sure I totally understand the question, but wouldn't SetCharacterViewOffset (CHARID, int view, int xOffset, int yOffset) work? It's slightly more fiddley than the Left/Centre/Right style of SetCharacterViewEx(), but should do the job - assuming I read the problem right, of course.
#2800
The Rumpus Room / Re: The MSPaint game
Mon 25/10/2004 12:19:15

The smaller sign says:
Quote
Change here for:
Fancy
Invention
Visualisation.

Next: "Oh no, it happened again."
SMF spam blocked by CleanTalk