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

#21
Hullo everyone--

I have a character that moves back and forth across the screen within repeatedly_execute_always(), but when you try to interact with him, nothing happens. Even hovering the cursor over him doesn't display his name. The movement script is straight from the manual, with the coordinates and character name swapped out.

Code: ags

  if (!cJerrysHead.Moving)
  {
    // if Jerry is at the left, bobble him right
    if (cJerrysHead.x < 50)
    {
      cJerrysHead.Walk(860, cJerrysHead.y, eNoBlock, eAnywhere);
    }
    // otherwise, bobble Jerry to the left
    else
    {
      cJerrysHead.Walk(0, cJerrysHead.y, eNoBlock, eAnywhere);
    }
  }


Incidentally, what does the '!' do preceding cCharacter.Moving do/mean? Does it denote 'not'? As in 'if the character is not moving'?

Thanks in advance!  ;-D
#22
Quote from: Khris on Tue 03/08/2021 07:49:22
Writing code like this requires making the mental switch from calling a function that is provided by AGS to writing a function that is called by AGS.
(...)
Quote
What happens is this: you call something like  player.AddInventory(iWhatever);  and this causes AGS to call
Code: ags
  on_event(eEventAddInventory, iWhatever.ID);

Your task is to write this function so you can specify what happens when AGS calls it. This requires adhering to the parameters scheme exactly, for one. As you can see though, the if block ignores the data parameter.

PS: wrapping your mind around this is a lot easier if you are used to writing your own custom functions.

Thank you!!! I had to read that more times than I'd like to admit, but I get it now, it clarifies so very much. This is going to help me a TONNE going forward. Man, you are a gem!  ;-D
#23
Thank you!  ;-D It seemed confusing in the manual to have 'event' as a parameter since the function is named 'on_event', but I guess the function could just as easily have been named Mordred or anything else!

The data for eEventAddInventory is supposed to be the number of the inventory item, but seeing as I want this to happen when any of the items are added I'm not sure what to put for the data. I've tried 0, null, and then dumb things didn't even think about not being valid integers and won't list here because I'm already feeling the programming-block shame/ineptitude so keenly (laugh).

Now I'm getting a 'Function declaration has wrong number of arguments to prototype' error.  ???




#24
Greetings, all -

I'd like a series of actions to take place when anything is added to the inventory. One of the things I've tried is the following:

Code: ags

// When an inventory object is picked up, do this:
function on_event()
{
   if (EventType == eEventAddInventory)
   {
   invenOverlay = Overlay.CreateGraphical(300, 300, 137, false);
   Wait(40);
   invenOverlay.Remove();
   aMalMrBagPaperSack.Play();
   }
}


Which produces 'static non-property access: internal error' when compiled.


I know that it is this bit...

Code: ags
(EventType == eEventAddInventory)


...that's causing the error, so it's a matter of me not understanding what exactly does what, where things are meant to go and not go.

Any advice is much appreciated!  ;-D

#25
Quote from: Cassiebsg on Sat 10/07/2021 00:31:08
Just to make sure we cover the obvious guilty parties:
- Make sure you are importing the image with "Import alpha channel", and that you have set the transparent colour to Leave as-is.

That was it ('Leave as-is')! One of those cases of me staring at the editor like a zombie, but not seeing what is actually on the screen. (laugh) How many hundreds of sprites have I imported by now?  :-\ 

Thank you once again!
#26
Greetings everyone!

Every png I import into AGS that has a 'large' semi-transparent section (could be 1 pixel, could be 1000 pixels) just shows as completely transparent, and yet alpha is recognised on the edges of all of the others, rendering them nice and anti-aliased. These images are fine when viewed in image viewers or editors on my computer, tablet etc. Is this a known issue? I wasn't finding anything in the forums or Discord.

Here is my sweet html 4 demonstration  ;) with an 80% transparent background square with black dots, and an anti-aliased save sprite.

[imgzoom]http://www.invisibleprocess.com/images/screenshot_transparency.png[/imgzoom]


Thanks in advance!




#27
A thousand thanks, Crimson Wizard, eri0o, and CassieBSG (the if, else if, else translation was invaluable! You're helping me crush the wall in my brain between human languages and programming!  :-D)!!!

It works!
Code: ags

// called when a mouse button is clicked
function on_mouse_click(MouseButton button)
{
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused())
  {
    // game is paused, so do nothing (i.e. don't process mouse clicks)
  }
  
  // START: THE 'WALK ANYWHERE EVEN IF WALK IS NOT THE ACTIVE MODE'
  else if ((GetWalkableAreaAtScreen(mouse.x, mouse.y) != 0 || (GetLocationType(mouse.x, mouse.y) == eLocationNothing)) && (button == eMouseLeft))
  {
    Room.ProcessClick(mouse.x, mouse.y, eModeWalkto);
  }
  // STOP: THE 'WALK ANYWHERE EVEN IF WALK IS NOT THE ACTIVE MODE'
  
  else if (button == eMouseLeft)
  {
    // left-click, so try using the current mouse cursor mode at this position
    Room.ProcessClick(mouse.x, mouse.y, mouse.Mode );
  }
  else if (button == eMouseRight || button == eMouseWheelSouth){
    // right-click or mouse wheel down will cycle the mouse cursor mode forwards
    mouse.SelectNextMode();
  }
  else if (button == eMouseMiddle)
  {
    // middle-click makes the character walk to clicked area, regardless of cursor mode
    Room.ProcessClick(mouse.x, mouse.y, eModeWalkto);
  }
  else if (button == eMouseWheelNorth)
  {
    // mouse wheel up will cycle the cursor mode backwards
    mouse.SelectPreviousMode();
  }
}


All the best, everyone.  ;-D
#28
Quote from: Crimson Wizard on Fri 02/07/2021 01:35:12
The correct form is:
Code: ags

if (IsInteractionAvailable(mouse.x, mouse.y, eModeLookat))


But you should replace "if"s with "else if", otherwise you may end up having multiple interaction one by one. And probably put "Walkable area" check last, or objects standing on a walkable area won't be interacted with.


Thank you very, very much, for the correct format, the 'else if' tip, and the bit about putting the walkable area last!

Code: ags

// called when a mouse button is clicked
function on_mouse_click(MouseButton button)
{
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused())
  {
    // game is paused, so do nothing (i.e. don't process mouse clicks)
  }
  else if (button == eMouseLeft)
  {
       if (IsInteractionAvailable(mouse.x, mouse.y, eModeLookat))
       {
             Room.ProcessClick(mouse.x, mouse.y, eModeLookat);
       }
       else if (IsInteractionAvailable(mouse.x, mouse.y, eModeInteract))
       {
             Room.ProcessClick(mouse.x, mouse.y, eModeInteract);
       }
       else if (IsInteractionAvailable(mouse.x, mouse.y, eModeTalkto))
       {
             Room.ProcessClick(mouse.x, mouse.y, eModeTalkto);
       }
       else if (GetWalkableAreaAt(mouse.x, mouse.y) != 0)
       {
             Room.ProcessClick(mouse.x, mouse.y, eModeWalkto);
       }
  }
  else if (button == eMouseRight || button == eMouseWheelSouth){
    // right-click or mouse wheel down will cycle the mouse cursor mode forwards
    mouse.SelectNextMode();
  }
  else if (button == eMouseMiddle)
  {
    // middle-click makes the character walk to clicked area, regardless of cursor mode
    Room.ProcessClick(mouse.x, mouse.y, eModeWalkto);
  }
  else if (button == eMouseWheelNorth)
  {
    // mouse wheel up will cycle the cursor mode backwards
    mouse.SelectPreviousMode();
  }
}


The above is working wonderfully, I can walk round and look at stuff, touch/pick things up, and talk to them, but not if the items have multiple actions. Here's my resulting (sort of) pseudocode of what's going on:

if the game is paused, don't do anything
otherwise, when the left button is clicked
check to see if you are on anything you can interact with
if it is something you can look at, look at it
otherwise, interact with it
<-- it's the otherwise, there, it needs something additional. And even though you were totally right about 'else if' preventing the unwanted multiple, one by one interactions, I tested it without the 'elses' just because I'm weird that way!  (laugh) And you know, it's fun to see what happens.

So then I tried combining all of the interactions into a handful of lines, crossing my fingers that AGS wouldn't care that I was missing out a parameter (it did, of course), but then even if had worked it I'm guessing it would've just done them all, just as though I'd taken out all of the 'else ifs' or done them all at once or something:

Code: ags

  else if (button == eMouseLeft)
  {
       if (IsInteractionAvailable(mouse.x, mouse.y, eModeLookat || eModeInteract || eModeTalkto))
       {
             Room.ProcessClick(mouse.x, mouse.y);
       }
       else if (GetWalkableAreaAt(mouse.x, mouse.y) != 0)
       {
             Room.ProcessClick(mouse.x, mouse.y, eModeWalkto);
       }
  }


I really appreciate the way help is provided on the forum, like a really good hint system rather than a walkthrough. I could copy and paste all day but then I wouldn't learn anything, wouldn't know why things worked, which would drive me crazy. Anyway, thanks again! It's pretty late here... I'm going to unwind with someone else's game and prod at the inner-workings of my own again tomorrow!  :-D

All the best to you!
#29
Hey everyone  ;-D

I'm using the Sierra template but looking to eliminate the need to cycle through in order to walk. Referencing this thread:

https://www.adventuregamestudio.co.uk/forums/index.php?topic=57050.msg636603983#msg636603983

I did implement some of what was suggested with some (maybe totally wrong) alterations, replacing the original Sierra click-handling section in the global script with the following:

Code: ags

// called when a mouse button is clicked
function on_mouse_click(MouseButton button)
{
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused())
  {
    // game is paused, so do nothing (i.e. don't process mouse clicks)
  }
  else if (button == eMouseLeft)
  {
       if (GetWalkableAreaAt(mouse.x, mouse.y) != 0)
       {
             Room.ProcessClick(mouse.x, mouse.y, eModeWalkto);
       }
       if (IsInteractionAvailable(mouse.x, mouse.y) != 0 && (eModeLookat = true)
       {
             Room.ProcessClick(mouse.x, mouse.y, eModeLookat);
       }
       if (IsInteractionAvailable(mouse.x, mouse.y) != 0 && (eModeInteract = true)
       {
             Room.ProcessClick(mouse.x, mouse.y, eModeInteract);
       }
       if (IsInteractionAvailable(mouse.x, mouse.y) != 0 && (eModeTalkto = true)
       {
             Room.ProcessClick(mouse.x, mouse.y, eModeTalkto);
       }
  }
  else if (button == eMouseRight || button == eMouseWheelSouth){
    // right-click or mouse wheel down will cycle the mouse cursor mode forwards
    mouse.SelectNextMode();
  }
  else if (button == eMouseMiddle)
  {
    // middle-click makes the character walk to clicked area, regardless of cursor mode
    Room.ProcessClick(mouse.x, mouse.y, eModeWalkto);
  }
  else if (button == eMouseWheelNorth)
  {
    // mouse wheel up will cycle the cursor mode backwards
    mouse.SelectPreviousMode();
  }
}


This produces an 'End of input reached in middle of expression' error. I've checked the curly brackets (from what's been said in the forums this error is commonly the result of missing brackets), but they all seem right.

Any suggestions are most welcome. Thanks in advance!

#30
Quote from: Crimson Wizard on Thu 24/06/2021 01:01:31
First of all I'd double check that your condition sais what you mean it say. I won't be able to tell if it's correct unless you describe what logic you want there in plain language.

But logical conditions are easy place of error, similar to math btw, because of how logical operations interact with each other. In short - they only apply to nearest neighbours.

And a thousand thanks to you, too, Crimson Wizard! Any thorough explanations regarding maths and programming concepts are always very helpful, as both subjects have been pretty challenging to me.  You're great--thank you!  ;-D
#31
Quote from: Matti on Thu 24/06/2021 00:51:47
Hi there  ;-D

You need some extra brackets:

Code: ags
if ( (aliceCount >= 1 || lilaCount >=1 || tedCount >= 1) && brushCount == 0 && cMalcolm.ActiveInventory == iDinceyDollBrush)


Because in your code the condition would be true even if brushCount would be higher than zero as long as aliceCount or lilaCount would be >= 1.

Oh wow! Thank you so much--you are a lifesaver! So it's just like maths, then! Seriously, you're awesome. Vielen dank!  ;-D
#32
Hullo, everyone!  ;-D

Ok, so here's what I'm trying to do:

In room 2 (a shelf with dolls), when you use an inventory item on a specific object, the character is meant to switch to room 1 (crypt), where the character animates for a few seconds and a sound is played. No problems there, that works great.

All of the counters in the bit of code from room 1 (crypt) below are global variables with the initial value of 0.


Code: ags

  function room_AfterFadeIn()
{
    if (aliceCount >= 1 || lilaCount >=1 || tedCount >= 1 && brushCount == 0 && cMalcolm.ActiveInventory == iDinceyDollBrush)
  {
    cMalcolm.LoseInventory(iDinceyDollBrush);
    cMalcolm.Walk(705, 590, eBlock, eWalkableAreas);
    cMalcolm.SayBubble("bla bla bla");
    cMalcolm.LockView(21);
    cMalcolm.Animate(0, 5, eRepeat, eNoBlock, eForwards);
    aDollBrush.Play();
    Wait(160);
    cMalcolm.UnlockView(1);
    brushCount += 1;
    }
   sackOverlay = Overlay.CreateGraphical(1472, 743, 213, false);
}



But, every time he re-enters room 1 from any other room, the animation, sound, etc all happen again, even though the counter should no longer be set to 0. Is this something that ought to be in the global script rather than room 1 or is my code totally weird and wrong? If you have any other recommendations they are most welcome. I'm really enjoying this as a learning project, but sometimes find myself feeling more insane than usual.  8-0

Many thanks in advance!

PS -  I've also tried it with:
Code: ags
brushCount += 1;

within it's own brackets/printers' braces/curly braces thusly:
Code: ags

{
brushCount += 1;
}


Again, thanks.  :)



#33
This is wonderful news and I really like what you've come up with thus far! Following is my input which hopefully reads OK. For the most part it's organised into coherent sections, but it is 3am here and my brain feels a bit melty after a long day. Oh. And now I've just noticed there is a third page of responses. Welp, here goes nothing:


DESIGN/ORGANISATION
Thank you for retaining the colours and overall look in the mockup. I second Reiter's request to use the pale blue for the background, and eriOo's photo idea (more about that later*). Design overhaul whiplash is disconcerting ('Did the site get hacked? Did I mistype? Am I hallucinating?'). It's heartening to learn that you're coding it yourself; Wordpress has brought out my murderous side on too many occasions to count.

Relieved to hear the only alteration to the forums will be responsive scaling--that'll be most welcome.

Agreed, eriOo, please do implement a donation button on the main page. And the splash of orange with the blue--mwah! Definitely liking this complimentary colour scheme.

Regarding browsers and mobile: all's well with the mock-up in Safari on an iPhone 12+ Max!

Regarding sthomannch's comments about any scrolling confusion and featuring MAGS: maybe the hamburger menu can have links to anchors (?) on the sections of the main page for those who aren't keen on scrolling, as well as a link directly to the Competitions and Activities area of the forums.


GAMES PAGE
I would prefer cups (stars) to thumbs. There are way too many games I've been on the fence about, because I really loved, for example, the UI, graphics, and characters, but found the music irritating, and was disappointed that the game had no voice acting. I'm guessing this is why you qualified the thumbs suggestion with 'if your userbase is big enough'. With the masses and masses of Steam users you get the aggregated 'Overwhelmingly positive' 'Mostly positive' 'Somewhat negative' etc. That and a glance at a few reviews you start to see patterns--lots of people loving the same thing/encountering the same bug.

Trimming out the review requirement and specifics seems like a good idea. I play a lot of games late at night and its not uncommon for me to be too tired to leave a review at that point but I want to give *some* sort of feedback to the dev(s). For my part, I feel some feedback is better than none. Invaluable, really.


MISCELLANY
This is more to do with the manual, but seeing as it is part of the site: far more examples of AGS script in action need to be employed. I have completed projects in C#, Javascript, Python, and have dabbled in a handful of other languages, but unless snippets are provided along with instruction, I've often found programming/scripting really difficult. Something to do with  learning styles, I guess. In Snarky's list of personas (which was great, BTW) I would be slotted somewhere fairly near Bruno, although my first language is English, I successfully worked as a freelance artist/graphic designer, and the game I'm poking away at isn't going to be commercial.

The registration: At least some bar to entry, please, keep out the riff-raff, haha. When I registered in 2016 I was surprised there was a test but thought it was funny. There were a few minutes of ranting from my partner when he registered, however. Maybe an 'introduce yourself/why AGS' requirement, and as has already been suggested, a brief probationary period with limited posting capabilities.

Laura Hunt, Potajito, 'Think you've got what it takes?' is one of the things that rubbed my partner up the wrong way and I never liked it either (no offence to whomever put it there).

Oh yes--I'm very much in favour of the 'want-to-play', 'games played', 'favourites' lists idea. It's 'follow' on itch, I think, something else at gamejolt, and 'wishlist' on GOG and Steam, but only the latter two have favourites, right? Anyway, yes, all three would be fabulous.


Thank you a million times over for keeping this site going strong. I know you'll do a brilliant job updating it whilst retaining that ineffable AGS quality.


* My partner is an excellent photographer and we have a nice looking setup here, so if you're interested in eriOo's photo idea DM me here or on Discord. Laura Hunt has offered proofreading, and one of my other jobs involved writing copy for websites and other promotional material, so if there's enough to require extra assistance I'd be happy to chip in. You probably have loads of artists to hand already but let me know if you need any more. Again, thanks, all!
#34
Quote from: Snarky on Sun 09/05/2021 20:37:50
In short: no.
Room objects may appear in front of or behind characters. It depends on their Z-order, which by default is the y-coordinate of their bottom edge. (This gives the expected result in many common situations. If it isn't what you want, you have to override it.)

Brilliant--thanks so much! I didn't want to integrate the objects (torches in this case) into an animated background, so I just put

Code: ags
oTorches.Baseline = 1;


into

Code: ags
room_Load()


For anyone reading this later, 1 is as low as it goes (no zero/0).

Again, thank you (and a third thanks for your having written the SpeechBubble module)!  :-D

All the best,

Skeevy
#35
Hullo, all!

Is it the default for objects to be drawn in front of characters, and if so is there a way around this?

Thanks again to the community.  :)
#36
Hiya, everyone--

I've been staring at this and tweaking it and referencing and re-referencing the manual, but haven't been able to sort out why it isn't working. On the first click, the character is meant to say his line and enter room 2, which works fine. On a subsequent click, if the character is holding inventory item iDinceyDollBrush, he's to walk to the X and Y coords given and change views (if he's not holding iDinceyDollBrush, he just says something else and goes into room two). For some (probably very simple) reason, he just keeps doing the first thing: he says his line and enters room 2.

Code: ags

function hDincey_AnyClick()
{
    if (dollsCounter == 0)
  {
  cMalcolm.SayBubble("Those are some of my friends. I like to play with them, but I'm not sure they like me overly much.");
  cMalcolm.ChangeRoom(2);
  }
    if (dollsCounter >= 1 && cMalcolm.ActiveInventory == iDinceyDollBrush)
  {
  cMalcolm.LoseInventory(iDinceyDollBrush);
  cMalcolm.Walk(650, 546, eBlock, eWalkableAreas);
  cMalcolm.SayBubble("Here you are, my pretties. Theodora, please forget what I said about you looking like my mum. Although as cruel as she was, she was legendarily beautiful. Ow!");
  cMalcolm.UnlockView(21);
  Wait(40);
  cMalcolm.LockView(1);
  }
    if (dollsCounter >= 1 && cMalcolm.ActiveInventory != iDinceyDollBrush)
  {
  cMalcolm.SayBubble("Time to check in on the well-being of my little friends again...");
  cMalcolm.ChangeRoom(2);
  }
}


Here's another if statement that's working fine, a simple, 'Say something else when you click the hotspot if you've already picked up the item' bit of business.

Code: ags

function oSpidergraph_Interact()
{
    if (spidergraphCounter == 0)
  {
  cMalcolm.Walk(505, 617, eBlock, eWalkableAreas);
  cMalcolm.SayBubble("Yes, I do love Spidergraph. Let's play! I'll take the jar.");
  cMalcolm.AddInventory(iSpidergraphJar);
  invenOverlay = Overlay.CreateGraphical(300, 300, 137, false);
  Wait(40);
  invenOverlay.Remove();

    }
    if (spidergraphCounter == 1)
  {
    cMalcolm.SayBubble("The box is now as empty as my existence.");
    }
    if (spidergraphCounter == 2)
  {
    cMalcolm.SayBubble("Es ist total leer.");
    }
    if (spidergraphCounter >= 3)
  {
    cMalcolm.SayBubble("...cough.");
    }
    if (spidergraphCounter < 4)
  {
    spidergraphCounter += 1;
    }
}


What have I f***** up? I try to figure stuff out on my own and not clutter the forum, and always really appreciate any help, hints, and suggestions given. Thanks very much in advance!

:)

EDIT: Gahhh... minutes after I posted this my partner pointed out that I missed out the line to increment.

Code: ags

  {
    dollsCounter += 1;
    }



I'll delete this post if I can.

:-[
#37
Quote from: Khris on Tue 23/03/2021 23:24:43
Great, so did you test this? Given that arj0n says an idle view with a single loop works fine for him?

Hey!

Apologies, I didn't see this until now. Yes, it did fix it for me.

Again, thank you! ;-D
#38
Quote from: Khris on Tue 23/03/2021 21:02:06
AGS supports directional IdleViews; did you put sprites in all first four loops of View #15?
Because if you only put them in the first loop, that's why AGS crashes: it tries to display viewframes that don't exist.

Oh my god, thank you! *smacks forehead* That makes perfect sense! He's turned to the left or going backwards or whatever and yet I only had idle frames in the front-facing (0) loop.

Before I checked back here on this thread I was trying to mess about with custom properties.  ???

Again, thanks a million!  :-D
#39
Hullo everyone,

I'd like the delay until my character switches into idle mode to be shorter (two seconds to be precise; in this post https://www.adventuregamestudio.co.uk/forums/index.php?topic=54519.0 the default is said to be 20 seconds).

So I wound up putting

Code: ags
cMalcolm.SetIdleView(15, 2); 


in the game_start function in the global script, which works great if he's walking forwards (Y axis), but if he walks to the side (X axis) or even towards the back of the room the game crashes. 'The game engine does not appear to have shut down properly. If the problem persists, post the problem on the Tech forum.'

Alternatively, I've tried it in the room_load function in the main room, but get the same crash. Apologies in advance if this is a completely bizarre/wrong thing to do. Still learning!

Thanks!  ;-D
#40
What brilliant news--!  :-D I'm still referencing your videos densming, and just revisited the one on the book about half an hour ago. It was awesome to see a link to this thread among my search results for a current source of the pdf (thank you Khris) and that you were talking about putting together the second section of the book as of 2019! Crossing my fingers that 2020 has been as OK for you and yours as it could be. Whatever the case, thanks very much everything you've done.  ;-D
SMF spam blocked by CleanTalk