I am probably going to be told that this explanation allready exists but I have tried and I have a limited budget...err can't be online to long.
Problem: As title suggests How do I go back to a room that I have allready been to? I am in room 3 and want to go 'back' to room 1. I have created a hotspot in room 3 just before the exit back to room1.
I used ther following command : Player - Go to a different room(1,100,100).
But when I ran the game the character went through to room 3 from room1 and went right back out again back to room1 .
I can see why this happened so I tried using:
if (!(HasPlayerBeenInRoom(1))){
NewRoomEX(1,100,100);
}
This allows the character to go into room 2 but does not allow it to go back to room 1.
Again I can see why but I am wandering wheterh I am missing the obvious.
Could someone please help.
Bhup
Only a guess here but you may have the player character going to room 3 and starting out on the hotspot? That would be the obvious thing.
What do you have as the script for your room 1 exit?
To jrl2222,
Quote
What do you have as the script for your room 1 exit?Ã,Â
The code I have for the hotspot which exits to room 3Ã, is not a script command.Ã, It is simply the option chosen from the the hotspot interaction menu. It is: Player - Go to a different room (at specified coordinates)(3,232,168).
Quote
Only a guess here but you may have the player character going to room 3 and starting out on the hotspot? That would be the obvious thing.
Could you please expand on this...I'm not quite sure what you mean.
Oh yes one more thing.Ã, In rooms 1,2 and 3 the inventory window seems ok and displays the items properly so that they all show but in room 4 my inventory window spans across the from left to right so much that you can't see any of the items on either end as they are only half showing.Ã, How can make my inventory window display all the items I want to display so that they all show properly.
ThanksÃ, Ã, :)
Bhup
Try using:
if (HasPlayerBeenInRoom(1)==0){
Ã, Ã, NewRoomEX(1,100,100);
}
instead.
As far as I remember CJ was too lazy to make the scripting engine completely on par with the C implementation, so the if (!variable)... part may not work (well don't know if this had been fixed or not though).
To Gilbot,
Thanks for the reply. Ã, I tried what you said and used :
if (HasPlayerBeenInRoom(1)==0){
Ã, NewRoomEx(1,100,100);
}
This is on the hotspot in room 3 which is on the entrance of room 3. I can go into room 3 but still cannot go back to room 1 from room 3. Ã, Basically whatever room I am in I would like to go back to the room I came from. Ã, Is this possible???
Also would you or anyone be able to answer some more stuff..stuff that I mentioned previously:
Quote
Oh yes one more thing. Ã, In rooms 1,2 and 3 the inventory window seems ok and displays the items properly so that they all show but in room 4 my inventory window spans across the from left to right so much that you can't see any of the items on either end as they are only half showing. Ã, How can make my inventory window display all the items I want to display so that they all show properl???.
from Bhup Ã, :)
First off, I have no idea about the inventory thing, sorry.
Secondly, I don't know if I fully understand your other problem, but:
1) The code you've got now would only send the character to room 1 if they'd never been there (
if (HasPlayerBeenInRoom(1)==0)) which would never be the case if they've come from room 1 in the first place, which is probably why it doesn't work.
2)
QuoteBasically whatever room I am in I would like to go back to the room I came from.
Is the
character[CHARID].prevroom variable what you're after? It stores the last room the character was in, so:
NewRoomEx (character[EGO].prevroom, 100, 100);
would send them to room 1 if that was where they came from, to room 2 if that was, to room 27 if
that was, etc.
To Ashen,
A million thanks!!!!!!!!! You have given me exactly what I was looking for:
NewRoomEx (character[EGO].prevroom, 100, 100);
Shame you or anyone else can't answer my inventory problem. (She says, as if you haven't allready helped me out allready.) ;D
When I run the game and display my inventory window by the time I have reached room 4. The items in the inventory at each end, go off the screen. What can I do to avoid this?
Any takers???
Bhup
Can some one tell me how to attach/upload images with my the post/reply. I want to show an image to describe my problem. I could not do it before as when I used Alt printscrn it just showed a black screen. Anyway I have had to recreate the problem using photoshop. Now I have an example. Can anyone help please?
Bhup
Use http://www.2dadventure.com/ags/upload/upload.html to upload your image (please use jpg or gif format) and then enter
[img]http://www.2dadventure.com/ags/yourfilename.jpg[/img]
when composing your message.
Strazer ThanksÃ, fot that.
1. Here is the inventory image:
(http://www.2dadventure.com/ags/InventoryExample.gif)
(I know the animations are a bit lame but I can draw better on paper than the computer LOL anyway I'm still learning).
As you can hopefully see, the rope and the turkey are cut off. How can I shape the inventory so that it will show all the items without cutting anything off.
Also I wanted to add a slider to the inventory window but how do I make AGS register the changes.Ã, I saved the game but the game did not acknowledge the changes.
2. Here is another problem:
(http://www.2dadventure.com/ags/Demon.gif)
The cup objects have been left on. The user is supposed to click on the parts where the
the cup objects are placed in the image above in an X formation using the rod and then he can cross the bridge.Ã, So the user has to click from the top left cup, then, click on the the bottom right cup, then click on the top right cup and finally click on the bottom left cup.Ã, The cup object below his left foot is just so that the animation can start there.
Strazer you said to use:Ã,Â
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=13771
(http://www.adventuregamestudio.co.uk/yabb/index.php?topic=13771)
Which works but I don't see the problem with my code:
Ã, // script for object2: Use inventory on object
if ((GetGlobalInt(1) == 0) && (GetGlobalInt(1) == 2) && (GetGlobalInt(3) == 0)) {
Ã, SetGlobalInt(0,1);
}Ã,Â
else{
SetObjectView(6,15);
AnimateObjectEx(6,0,0,40,0,1);
ObjectOff(6);
}
The GetGlobalInt values are, to me, like boolean values which AGS does not really have.Ã, Each of those Global values will be set each time a cup object is clicked on.Ã, I use SetGlobalInt to do it.Ã, The code above will be pasted in the other interaction editors for each of the objects which are placed on the demons shoulder arm and legs.Ã, Except they will each be testing other GlobalInts.Ã, Can you tell me if this poses a problem??
The other thing is that I don't think the rod sees the objects because when I click on it nothing happens.
Are the GlobalInts not 0 by default or something.
Please someone put me out of my misery.
Bhup
The first obvious thing is, as I've told you already, that you check GlobalInt 1 twice in your if-clause:
if ((GetGlobalInt(1) == 0) && (GetGlobalInt(1) == 2)
A global integer can't be two values at once. It's either 0 or 2. I guess the second part is supposed to read
(GetGlobalInt(2) == 2)
?
As for your inventory, you say it works in room 1, 2 and 3 but not in 4. How can that be if your inventory is on a fixed-size gui?
How large is your gui? How large is the inventory area?
The default size for inventory slots it 40x22 pixels, so your width should be a multiple of that: You want 4 inv items visible at a time? Make the inventory area 4*40 pixels wide. To set a custom size for inventory slots, use the SetInvDimensions function.
To see how to implement inventory scrolling, I recommend searching the forum (http://www.adventuregamestudio.co.uk/yabb/index.php?action=search), and checking out some templates (http://www.freewebs.com/skimbleshanks) (unfreezes January 9th) and game sources: Airbreak (http://www.adventuregamestudio.co.uk/games.php?action=detail&id=408), Exile (http://www.adventuregamestudio.co.uk/games.php?action=detail&id=448), Keptosh (http://www.adventuregamestudio.co.uk/games.php?action=detail&id=168).
Strazer or anyone else,
QuoteThe first obvious thing is, as I've told you already, that you check GlobalInt 1 twice in your if-clause:
if ((GetGlobalInt(1) == 0) && (GetGlobalInt(1) == 2)
A global integer can't be two values at once. It's either 0 or 2. I guess the second part is supposed to read
(GetGlobalInt(2) == 2)
?
Yes I see your point.Ã, Dumb mistake.Ã, I guess I'm trying to rush this game I have so
much work to do I'm not paying much attention to the obvious.
Anyway, I corrected the code and put a display statement in and commented everything out temporarily, I then, moved the demon(pictured in past reply if your new) out of the way. And sure enough after correcting the scriptÃ, the object interaction displayed the message. But when I put the demon object back it did not work.Ã, My question is, do object interactions not work if there placed on top of other interactions?Ã, Look at past diagram.
If so how can I put a hotspot on my demon object.Ã,Â
Quote
As for your inventory, you say it works in room 1, 2 and 3 but not in 4. How can that be if your inventory is on a fixed-size gui?
Thats what I thought if your talking about the width and height there all the same in the Gui properties -> settings and values.
Quote
How large is your gui?
Gui..err.what do you mean? Yes I know GUI means graphical use interface.Ã, But what do you meanÃ, by Gui size?? Could you be more specific?
Quote
How large is the inventory area?
All I know is what I can tell you from viewing the Gui option.Ã, Height = 130 width = 220
If I am looking in the wrong area then let me know.
Quote
The default size for inventory slots it 40x22 pixels, so your width should be a multiple of that: You want 4 inv items visible at a time? Make the inventory area 4*40 pixels wide. To set a custom size for inventory slots, use the SetInvDimensions function.
Hold on slow down..40 X 22..pixel..I can't see anywhere that I can change the pixels except the width and height of the inventory window and other buttons e.t.c in the GUI. BTY I am using AGS 2.61 if that makes any difference.
Quote
To see how to implement inventory scrolling, I recommend searching the forum (http://www.adventuregamestudio.co.uk/yabb/index.php?action=search), and checking out some templates (http://www.freewebs.com/skimbleshanks) (unfreezes January 9th) and game sources (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=16921.msg225632;topicseen#msg225632).
I'm looking into this except my other problem is that when I make a change in the GUI option and add for example a slider then it does not seem to register the changes. Yes, I don't know what I am doing wrong.
Bhup
Ref:Demon (above):
I have tried very hard to see if I am doing something wrong maybe not clicking in right place but I have come to the conclusion that if you put an object on top of another object , it hides the top object. I have decided to chop up my character and make parts of his body seperate objects. Anyway if anyone has any comments on this it would be nice to hear it. Also I still have problems with inventory window (look above for details). Thanks in advance.
Bhup
Quoteif you put an object on top of another object , it hides the top object.
It's all in the baselines. The default baseline of an object is its bottom-left corner.
So if the bottom-left corner of one object is further down than the bottom left corner of the other one, the former one gets drawn on top.
You can set object baselines manually in the room editor. Just set the baseline of the object that should be drawn on top higher (down) than the baseline of the one that should be drawn beneath.
Do you have pixel-perfect click detection enabled? If not, transparent parts of an object will obscure any objects beneath, hence not triggering their interactions where obscured.
Strazer,
Yeah thanks again. But I'll try that next time since I've allready chopped up the character and written the code.Ã, :)
Has anybody any ideas on the inventory window problem?? (Look at postings above).
Bhup
Are you using the built-in inventory window or a custom one?
From your screenshot, it looks like your inventory images are simply too big for the built-in inventory screen. Normally, inventory items measure about 32x32 pixels.
If you need to have such large inventory items, you'll have to create a custom inventory window.
Pumaman big thanks for the reply, :)
Your right my images are bigger than 32 X 32. But if I reduce the images you can't see them. So I guess I'll have to create a customary inventory screen.
What I'm about to say may sound a little confusing. :P
1. In the GUI section of Ags, it allows you to increase the size of the inventory screen, add a slider and add new buttons e.t.c. But when I save the changes they don't register in the game. Where is my game getting its inventory display from and how can I change it e.g add slider e.t.c? (I have got Ags 2.61).
2. The GUI contains a STATUSLINE, ICONBAR and INVENTORY. (I'm not shouting thats the way they are written.) Are these for customising a new inventory screen and if so how do you register the changes because when I save the game and play it, the changes do not register.
3. I know there is a createNewGUI button but when I click the button e.g. Add GUI button it does not do anything ???
I hope I haven't repeated myself..totally confused.
Bhup
AGS has a built-in inventory GUI that cannot be changed. This GUI is shown when you call the function InventoryScreen().
To show your customized GUI INVENTORY, call GUIOn(INVENTORY) instead.
Strazer, Thanks again for the tip. :)
But...if I may point out you don't appear to be very generous with your explanations :P
for example, :
1. Which script do I amend to add the command with GUIOn(INVENTORY) ? I looked in the GUI optionin Edit Script..is this the write script?
2. I presume INVENTORY in GUIOn(INVENTORY) is a number representing the GUI number as in GUI1?
3. This has nothing to do with inventory but I am curious about this manual that I hear about where can I see this or is the help in AGS?
8)
Bhup
1. Go to menu "Script" -> "interface_click" and replace
show_inventory_window();
with
GUIOn(INVENTORY);
2. where "INVENTORY" is either the name or the number of your custom inventory GUI.
3. Yes.
Curious about the manual? Did you read this forum's sticky thread about the rules and resources? The AGS manual is the AGS help file. Press F1 in AGS or look at AGS.CHM.
To anybody reading this I discovered some helpful info.Ã, :)
Quote
1. Go to menu "Script" -> "interface_click"
Quote
In the script under the function show_inventory_window ()Ã, there is commented out code for adding a custom window.Ã, So it seems that one just needs to "uncomment" the bit under "custom inventory window". This code maybe seen below I haven't uncommented the custom bit yet though.
function show_inventory_window () {
Ã, // This demonstrates both types of inventory window - the first part is how to
Ã, // show the built-in inventory window, the second part uses the custom one.
Ã, // Un-comment one section or the other below.
Ã,Â
Ã, // ** DEFAULT INVENTORY WINDOW
Ã, InventoryScreen();
/*Ã,Â
Ã, // ** CUSTOM INVENTORY WINDOW
Ã, GUIOn (INVENTORY);Ã,Â
Ã, // switch to the Use cursor (to select items with)
Ã, SetCursorMode (MODE_USE);
Ã, // But, override the appearance to look like the arrow
Ã, SetMouseCursor (6);
*/
}
Quote
2. where "INVENTORY" is either the name or the number of your custom inventory GUI.
3. Yes.
Cool/ich dankbar/ich der Gedanke dasÃ, Ã, ::)
Quote from: Bhup on Thu 13/01/2005 18:23:24
Strazer, Thanks again for the tip.Ã, :)
But...if I may point out you don't appear to be very generous with your explanations :P
for example, :
You see, most of the things you have asked about is either covered in the AGS Manual or AGS Beginners FAQ. Strazer tries pointing you to the right direction in solving the issues, so that you could open the manual and find the info on the related topics; but it's hard to know in advance of all the possible problems you may face, therefore that's how it works -- you try solutions that people suggest and then post back your following specific questions, if any. But if you need a generous (yet broad) description on a certain topic then the best way, really, is to browse the manual and read through the BFAQ. But of course that doesn't mean you can't post questions that are already covered by the manual. We just can't quote large sections from the manual because otherwise it'd be simplier to direct to it. :)
QuoteIt appears that I was right this also is the same script revealed by EditScript in the GUI option.
Yeah, "edit script..." leads you into the interface_click function of the main global script.
QuoteIn the script under the function show_inventory_window ()Ã, there is commented out code for adding a custom window.Ã, So it seems that one just needs to "uncomment" the bit under "custom inventory window". This code maybe seen below I haven't uncommented the custom bit yet though.
Yep, uncomment the custom inventory script but be also sure to comment out (or remove) the InventoryScreen(); function there, because it displays the built-in inventory window (which you don't need). :)
Scorpiorus,
Quote
Yeah, "edit script..." leads you into the interface_click function of the main global script.
Actually I have withdrawn my claim that Edit Script in the GUI tab is the same as the main global script in -> script ->interface_click.Ã, "Edit Script", does not lead to the "main global script". Edit Script only partially shows some code which belongs to the GUI.Ã, 8) I don't know whether it is generic code in response to the default/built in Gui or what.Ã, What are your thoughts???
Oh yes and one more thing, I am also confused as to the Gui one is presented with when going into the INVENTORY tab in GUI. I understand that Ags has a built in inventory window which cannot be changed my question is: is the inventory window in INVENTORY, the default/built in inventory screen/window, if so why am I allowed to add a slider to it. ??? (By the way adding a slider does not make any difference to my game, it simply does not register it. Again Why is this?)
I want to create my own Gui because the default one does not seem to allow more than 5 objects. :o
Bhup ;D
Quote from: Bhup on Fri 14/01/2005 14:11:54Actually I have withdrawn my claim that Edit Script in the GUI tab is the same as the main global script in -> script ->interface_click.Ã, "Edit Script", does not lead to the "main global script". Edit Script only partially shows some code which belongs to the GUI.Ã, Ã, 8) I don't know whether it is generic code in response to the default/built in Gui or what.Ã, What are your thoughts???
Yes, clicking the "Edit Script" button will only show you the content of the interface_click function as there is a little need to view the whole global script. However, you can also open the global script and find
the same interface_click code there.
The thing is, a GUI in AGS is not exactly what you might thought of. Yes, a word GUI stands for "Graphical User Interface", but in AGS a single GUI is
one of the many windows you can have to put other controls (buttons/labels/sliders/inventory windows/etc. onto -- it is not about a GUI
in general.
As you see, there can be a bunch of GUIs (i.e. windows). One is a statusline, the other is a iconbar, the third is an inventory dialog window. You can add you own GUIs, of course.
The interface_click function operates ALL these GUIs. To distinguish between different GUIs you use their names (you can also use their numbers):
#sectionstart interface_clickÃ, // DO NOT EDIT OR REMOVE THIS LINE
function interface_click(int interface, int button) {
Ã, Ã, // when we click over ICONBAR GUI's controls:
Ã, Ã, if (interface == ICONBAR) {
Ã, Ã, Ã, Ã, ifÃ, Ã, Ã, (button == 4 ) { } // code when clicking on GUI control(object) 4
Ã, Ã, Ã, Ã, else if (button == 6 ) { } // code when clicking on GUI control(object) 6
Ã, Ã, Ã, Ã, else if (button == 7 ) { } // code when clicking on GUI control(object) 7
Ã, Ã, Ã, Ã, else if (button == 8 ) { } // code when clicking on GUI control(object) 8
Ã, Ã, Ã, Ã, else if (button == 9 ) { } // code when clicking on GUI control(object) 9
Ã, Ã, Ã,Â
Ã, Ã, }Ã, // end if interface ICONBAR
Ã, Ã, // when we click over INVENTORY GUI's controls:
Ã, Ã, if (interface == INVENTORY) {
Ã, Ã, Ã, Ã, < code for GUI controls there (similar to ICONBAR's) >
Ã, Ã, }
Ã, Ã, ...
Ã, Ã, ...
Ã, Ã, etc.
You can use that function to handle clicks over all GUIs. As to built-in inventory dialog, you can't change how it works -- there is no code about it in the interface_click function and there is no related GUI window either.
QuoteOh yes and one more thing, I am also confused as to the Gui one is presented with when going into the INVENTORYÃ, tab in GUI. I understand that Ags has a built inÃ, inventory window which cannot be changed my question is: is the inventory window in INVENTORY,Ã, the default/built in inventory screen/window, if so why am I allowed to add a slider to it. ???
So, considering all the above, INVENTORY is a name of the customizable GUI window and the inventory window is its control (GUI object), just like a button or a label. And just like as buttons you can add inventory window controls to any other GUI and then, for example, the iconbar can additionally display the inventory items. Therefore, by adding a slider you change the custom INVENTORY Gui -- not the built-in inventory dialog. You see, I refer to the built-in GUI as inventory dialog, not as the inventory window, just to avoid confusion. This built-in inventory dialog (or the built-in inventory screen, considering the name of the function to show it - i.e. InventoryScreen() ) also has its own inventory window (that black-coloured rectangle where inventory items are shown) as well as other buttons.
Quote(By the way adding a slider does not make any difference to my game, it simply does not register it. Again Why is this?)
You probably see not the INVENTORY Gui but the built-in one. To show a GUI you need, as Strazer has already said, to use the GUIOn(<gui name>) function. Uncommenting that code to replace the built-in dialog, you must have seen GUIOn(INVENTORY); there.
QuoteI want to create my own Gui because the default one does not seem to allow more than 5 objects.Ã, :o
The built-in inventory dialog does allow having more inventory items displayed. On adding new items it gets resized automatically. But if there is too many items then an arrow appears right under the bottom right corner of the inventory window of the built-in dialog. So, you can scroll down to see more items.
Scorpiorus,
Thanks for for making the effort with a lengthy explanation.Ã, Ã, :)
Quote
The built-in inventory dialog does allow having more inventory items displayed. On adding new items it gets resized automatically. But if there is too many items then an arrow appears right under the bottom right corner of the inventory window of the built-in dialog. So, you can scroll down to see more items.
Thats my problem. In rooms 1,2,3 the inventory window seems allright and quite happily displays the items.Ã, Ã, But when I reach room 4 and add another
item the screen is displayed in the way shown onÃ, page 1 back(at the top).Ã, The only explanation (from pumaman) that I have had is the pictures are bigger than 32x32.Ã, Its true, they are, but would that really affect the window.Ã, As you said if there are too many items thenÃ, it would become scrollable. But it in my case it doesn't.Ã, (The only reason I wanted to customise a new inventory window was because I wanted something scrollable since it wasn't doing this in the built in version.)
I feel a real dunce as it is and I realise your getting fed up with this topic as well as I, but if you do reply, please be gentle.
BhupÃ, ;D
I think it's the number of displayed inventory items that makes it being scrollable and not their size, I'm not fully sure though.
In that case it well may be the built-in inventory dialog doesn't support displaying items of a big size.
Scorpiorus and Pumaman,
You were absolutely right!!!! The images "were" too big for the inventory window.Ã, Yes I repeat the "inventory window" which is the key. I didn't realise you could use seperate images for the inventory window and the objects.Ã, Mine were one and the same.Ã, I was reluctant to reduce my images to 32 x32 because when I executed the game the images were far too small but of course it all makes sense now because you can use one set of images for the objects and another for the inventory window. So I reduced the images to 32X32 for the built in inventory window and used the large ones for the objects. It all seems so easy now and makes sense but I just didn't get it before..durrrr and :-[
Thanks for all your help and putting up with me.
Bhup
QuoteI didn't realise you could use seperate images for the inventory window and the objects.
Yeah, this is deliberate because you can, for example, make a cupboard as a hotspot and by clicking over it get a cup (inventory item) -- you don't even use an object in that case.