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

#1
Thank you Khris, that's really helpful for the project  :cool:
#2
Quote from: Crimson Wizard on Thu 17/06/2021 23:34:17
Relevant parts of the script tutorial from the manual:

Variables: https://adventuregamestudio.github.io/ags-manual/ScriptingTutorialPart1.html#variables
More on conditions: https://adventuregamestudio.github.io/ags-manual/ScriptingTutorialPart2.html#multiple-conditions

Thanks Crimson. I'm really struggling with this (maybe burned out today).

Would you or anyone you know be willing to consult on my project (paid position of course). I have the ideas I just need help with the scripting. Please drop me a message if you are interested (or if anyone else is interested, Khris?)

Thank you
#3
Quote from: Cassiebsg on Thu 17/06/2021 22:53:34
Here you go, how to declare an IF: https://youtu.be/3LCiL1YCaWU?list=PL21DB402CB4DAEAEF

It's a bit old, but the basics are the same.
If you need the variables only for this room, you can declare them in the room script. If you need them globaly, you can declare them in Global script OR use the Global Variables (it's the Globe icon on the project tree). Once you declare variables here you can just start using them.  ;)

Thanks Cassie. I have watched most of Densmings videos, the one you embedded s AGS Part 1 (introduction), is that right? There is nothing about the variables/bools in there.

Cool, thanks! Never opened or used the global variables tab before. That's a new one for me. Just need to learn what/how to input here I will do some digging for information. Thanks again
#4
Quote from: arj0n on Thu 17/06/2021 20:30:56
You can create 4 bools and for each object when looking at it set the bool to true.
For the exit you can draw a region
When player stands on region:
- check with player.hasinventory if the player has taken the 2 object.
- check if all 4 bools are set to true.
If yes, exit screen, if not show response.

Thank you so much Arj0n.

So I understand what you are saying here but I dont know how to execute it. Would you mind giving me a bit more help please?

How do I set up the 4 bools, does his go in the room or global script? Can I be cheeky and ask for an example of this code please  :~(

#5
Quote from: Matti on Thu 17/06/2021 21:01:08
Using conditions and variables is very basic programming, that's why is has not been mentioned much  ;)

Thanks Matti. I know, I am a retard I'm sorry  :sad:

I have never coded before in my life so this is all new to me, however I am so keen to learn and I won't let it beat me. I WILL produce a full game  :grin:

Sorry for being stupid. It will be basic to most but its all new to me  :P
#6
Hi Guys,

Sorry for being annoying with n00b questions.

This is probably super easy for you masters, not easy for me though as I have been Googling and searching the forums for the past 2 hours and really suprised this has not been mentioned much!

I have finished my very first room and really happy with it. I just need to now know how to prevent player exiting until he has 1) Picked up 2 items and 2) Looked at 4 objects.

Is it a bool? Is it a variable? Is it a condition? I have no idea so I dont know what to search for  :P

Thank you so much! Will post my room for feedback once this last puzzle is in place  :cool:
#7
Quote from: Matti on Wed 16/06/2021 23:52:49
You have to make the walk command blocking, otherwise other things will happen simultaneously.

Code: ags
player.Walk(160, 135, eBlock);


If this doesn't help than the problem is related to the Tumbleweed template and I can't help you with that as I've never used it. But I don't understand why there would be a difference between walking to hotspots and walking to objects.

Thanks Matti, that's all working correctly now!
#8
OK so I have fixed the Unhandled Events, they are now working. it seems they have to be displayed in a certain order.

However I cannot for life or money figure out how to make the player walk to a certain position before ANY interaction with the object. I have tried the below code and the player will walk to the coordinates when clicking 'Walk To', but for example if I say 'Look at Baggage Tag' the player will remain where he is on the screen and say ''Its a baggage tag'' before walking to the object.

I have seen many many posts about this on the forums, but they all seem so complicated? Why can we not move to objects before interactions the same as hotspots?  :sad:

Please help

BAD CODE:

Code: ags
function BaggageTag_AnyClick()
{
// WALK TO
  if (Verbs.UsedAction(eGA_WalkTo)) {
   player.Walk(160, 135);
  }
  // TALK TO 
  else if (Verbs.UsedAction(eGA_TalkTo)) {
    Verbs.Unhandled();
  }
  // LOOK AT
  else if(Verbs.UsedAction(eGA_LookAt)) {
    Verbs.Unhandled();
  }
  // OPEN
  else if(Verbs.UsedAction(eGA_Open)) {
    Verbs.Unhandled();
  }  
  // CLOSE
  else if(Verbs.UsedAction(eGA_Close)) {
    Verbs.Unhandled();
  }
  // USE
  else if(Verbs.UsedAction(eGA_Use)) {
    Verbs.Unhandled();
  }
  // Push
  else if(Verbs.UsedAction(eGA_Push)) {
    Verbs.Unhandled();
  }
  // Pull
  else if(Verbs.UsedAction(eGA_Pull)) {
    Verbs.Unhandled();
  } 
  // PICKUP
  else if(Verbs.UsedAction(eGA_PickUp)) {
    Verbs.Unhandled();
  }
  // GIVE TO (characters only)
  else if(Verbs.UsedAction(eGA_GiveTo)) {
    Verbs.Unhandled();
  }  
  //USE INV
  else if(Verbs.UsedAction(eGA_UseInv)) {
    Verbs.Unhandled();
  }
  else Verbs.Unhandled();
}
#9
I have also tried adding the prompts into the events page (AnyClick, InteractObject etc) but still nothing is happening.

I have also just tried the code for another object in the room and having the same issues.
#10
OK I am sorry for another post  :cheesy:

I have an OBJECT in my first room which can be picked up and added to the inventory.

I have been trying to figure out all day how to make the character move to the object before interacting with it (which is now done) but none of the unhandled event verbs are working.

Code: ags
function BaggageTag_AnyClick()
{
  // WALK TO
  if (Verbs.MovePlayer(160, 133)) {
  player.FaceDirection(eDirectionRight);
  }
  // TALK TO 
  else if (Verbs.UsedAction(eGA_TalkTo)) {
    Verbs.Unhandled();
  }
  // LOOK AT
  else if(Verbs.UsedAction(eGA_LookAt)) {
   player.Say("It's a passengers baggage tag. I can't read it without picking it up.");
  }
  // OPEN
  else if(Verbs.UsedAction(eGA_Open)) {
    Verbs.Unhandled();
  }  
  // CLOSE
  else if(Verbs.UsedAction(eGA_Close)) {
    Verbs.Unhandled();
  }
  // USE
  else if(Verbs.UsedAction(eGA_Use)) {
    Verbs.Unhandled();
  }
  // Push
  else if(Verbs.UsedAction(eGA_Push)) {
    Verbs.Unhandled();
  }
  // Pull
  else if(Verbs.UsedAction(eGA_Pull)) {
    Verbs.Unhandled();
  } 
  // PICKUP
  else if(Verbs.UsedAction(eGA_PickUp)) {
    Verbs.Unhandled();
  }
  // GIVE TO (characters only)
  else if(Verbs.UsedAction(eGA_GiveTo)) {
    Verbs.Unhandled();
  }  
  //USE INV
  else if(Verbs.UsedAction(eGA_UseInv)) {
    Verbs.Unhandled();
  }
  else Verbs.Unhandled();
}


The unhandled events are working perfectly for other hotspots and for the iBlueCup in the demo room 1, and I have copied the exact code over to my custom room but I cannot use any of the unhandled events, only the player walks to the object and faces the right direction.

I have tried putting this in Global Script also but still nothing  :embarrassed:
#11
Quote from: Khris on Wed 16/06/2021 10:17:57
There's no built-in mechanism for this, however there's a really old module called MultiResponse:
https://www.adventuregamestudio.co.uk/forums/index.php?topic=27947.0

This is awesome! Thank you so much (again) Khris  :-*

It's really fun and easy to add the different responses, so cool.
#12
Quote from: Vincent on Wed 16/06/2021 10:15:55
You should check how many times the player has entered the region with an int, so on your 'Walks onto region' function you should write something simple like this:

Code: ags

int step = 0;

function region0_WalksOnto()
{
  if (step != 3) step ++;
  if (step == 1) player.say("I cant go that way.");
  else if (step == 2) player.say("Seriously, I cant go that way.");
  else player.say("I have told you already, I cant go that way");
}


Thanks Vincent   8-)
#13
Hi All,

I'm sure this is a super easy and I DID see some info on this yesterday but I cannot find it again  :embarrassed:

I want the player to say different responses each time he tries to leave a room (or walk on to a hotspot). Is this a string command? The dialogue options will be similar to:

1: I cant go that way.
2: Seriously, I cant go that way.
3: I have told you already, I cant go that way

Then loop response 3 once the first 2 have been shown.

I dont know the term for this particular script so having difficulty searching for info and it's not in the tutorial!

Many thanks  (nod)
#14
Quote from: Khris on Tue 15/06/2021 11:49:58
Functions for room-specific things like objects and hotspots go into the room script, those for characters and inv items go into the global script.

However: you don't have to worry about that because when you create the event handler, AGS puts the function in the correct script for you. You just provide the contents.

You select the object/hotspot/character, open the events tab (lightning bolt icon) then click on the "any click on" event, then click the ellipses button [...]
AGS creates the function, links it to the event and opens the script for you. Now you insert the code.

Note that how to do this for a hotspot is explained in the manual's tutorial, and you're supposed to complete that before using anything more complex.

You are amazing, thank you Khris  :grin:

I was confused because I thought ALL unhandled events would be included in the global script and you would only add USE, OPEN etc in your room, but now I see the whole script has to go inside each room, for each individual hotpot (or at least that's the way its working for me).

You have helped me nearly complete my first room, thanks alot :) Now onto objects and inventory interactions  :=
#15
Quote from: Khris on Mon 14/06/2021 13:15:16
The Tumbleweed template comes with a  Verbs.Unhandled() function.

Say you have a hotspot, a sign:

Code: ags
function cChar_AnyClick() {
  // WALK TO
  if (Verbs.UsedAction(eGA_WalkTo)) {
    Verbs.GoTo();
  }
  // LOOK AT
  else if(Verbs.UsedAction(eGA_LookAt)) {
    player.Say("It's a sign.");
  }
  // all other actions
  else {
    Verbs.Unhandled(); // show default unhandled message depending on used verb
  }
}


Note that the Tumbleweed template comes with its own manual which details the available functions.
It assumes familiarity with both programming and AGS basics though.

So if for a sign then this would go into the room script, and not the global script?

I have tried entering this in the global script but nothing happens when interacting with objects or hotspots, really stuck with this  :confused:
#16
Quote from: Khris on Mon 14/06/2021 13:15:16
It assumes familiarity with both programming and AGS basics though.

*Chuckles* I'm in danger

#17
Quote from: Matti on Mon 14/06/2021 11:10:27
Yes, you would have a function like this in Global Script:

Code: ags
function unhandled_event(int what, int type) {

  if (what == 1)  // hotspots
  {
    if (type == 1)         // Look at hotspot
    {
    }
    else if (type == 2)    // Interact with hotspot
    {
    }
    ...



The help file does have a part about unhandled events in the Tumbleweed template, and it says: "The messages itself are defined outside of this function, initially in TemplateSettings.asc."

OK. For the life of me I cannot figure this out for the past 2 days  :confused:

I've read up all of the documentation I can and searched the forums but still struggling with unhandled events  :cry:

I see the notes in the Thimbleweed manual, how do I access Template.Settings.asc? I cannot see that anywhere.

I am putting code inside the GlobalSricpt.asc but nothing is happening...Help me Obi Wan Kanobi, youre my only hope.
#18
Quote from: Khris on Mon 14/06/2021 13:25:41
This:
Code: ags
  player.Walk(270, 143, eDirectionLeft);


only works as expected by sheer coincidence. The third parameter of Character.Walk is the blocking parameter and supposed to be either eBlock or eNoBlock. (You want eBlock here.)
As soon as you type the comma after the 143, AGS should show an auto-complete window displaying the two available options. These enums are just ints internally, so this doesn't cause an error, but eBlock is 919 and eDirectionLeft is 6. The line does behave as if you had typed eBlock but again, this is just a happy accident.


As for the "while standing on region" event, the linked function is called 40 times per second. Only code that has to run every frame is supposed to go in there, not one-off stuff like walking back and making a comment.

Thanks Chris, yes guess it was a lucky accident! And thank you for your technical input, I am not a coder or graphic designer; just have a love of adventure games and have always wanted to create my own so I apologies for the basic questions...I am trying to figure it out as I go along but its very kind of you and others to provide their wisdom!  :cheesy:
#19
Quote from: Matti on Mon 14/06/2021 01:36:40
I think what you're looking for is unhandled_event.

Thanks Matti, yes that's exactly what I was looking for :)

I take it these go into the GlobalScript.asc?

I have some pre inserted code here, do I need to overwrite this with the unhandled events text or add new code?

Code: ags
/* Character, Object, Hotspot full blown SAMPLE
function cChar_AnyClick() {
  // WALK TO
  if (Verbs.UsedAction(eGA_WalkTo)) {
    Verbs.GoTo();
  }
  // TALK TO 
  else if (Verbs.UsedAction(eGA_TalkTo)) {
    Verbs.Unhandled();
     Player.Say("I can't talk to that.");
  }
  // LOOK AT
  else if(Verbs.UsedAction(eGA_LookAt)) {
    Verbs.Unhandled();
  }
  // OPEN
  else if(Verbs.UsedAction(eGA_Open)) {
    Verbs.Unhandled();
  }  
  // CLOSE
  else if(Verbs.UsedAction(eGA_Close)) {
    Verbs.Unhandled();
  }
  // USE
  else if(Verbs.UsedAction(eGA_Use)) {
    Verbs.Unhandled();
  }
  // Push
  else if(Verbs.UsedAction(eGA_Push)) {
    Verbs.Unhandled();
  }
  // Pull
  else if(Verbs.UsedAction(eGA_Pull)) {
    Verbs.Unhandled();
  } 
  // PICKUP
  else if(Verbs.UsedAction(eGA_PickUp)) {
    Verbs.Unhandled();
  }
  // GIVE TO (characters only)
  else if(Verbs.UsedAction(eGA_GiveTo)) {
    Verbs.Unhandled();
  }  
  //USE INV
  else if(Verbs.UsedAction(eGA_UseInv)) {
    Verbs.Unhandled();
  }
  else Verbs.Unhandled();
}
*/

/* Inventory SAMPLE
  // LOOK AT
  else if(Verbs.UsedAction(eGA_LookAt)) {
    Unhandled();
  }
  // USE
  else if(Verbs.UsedAction(eGA_Use)) {
    Unhandled();
  }
  // Push
  else if(Verbs.UsedAction(eGA_Push)) {
    Unhandled();
  }
  // Pull
  else if(Verbs.UsedAction(eGA_Pull)) {
    Unhandled();
  }   
  //USE INV
  else if(Verbs.UsedAction(eGA_UseInv)) {
    Unhandled();
  }
  else Unhandled();

*/


Not entirely sure what/where to edit the manual is not exactly clear in this area  :tongue:
#20
Hi Guys,

Me again  :cool:

Just wanted to see if there is any kind of shortcuts for automatically displaying a message when an action is invalid.

For example I have a room with 10 hotspots inside (sign, door, window etc). For example if the character attempts to 'Push Door' or 'Pull Window' or 'Pickup Sign' do I have to enter an event for every single possible interaction, or is there a shortcut to show that this action is not possible?

Many thanks!
SMF spam blocked by CleanTalk