I need help with this too. I have nine buttons...
M1
M2
M3
I1
I2
I3
R1
R2
R3
M = 1000
I = 1
R = nothing in particular
I want it to add up to 2003 which is the password...
MMIII
Is this possible? I've gone through the sheets and I get the objects and solo numbers but I'm not getting how you get it to add up to the right number and then include what you pushed into the GUI label box.
I really love AGS by the way... I've built a really cool player character... and the rooms are all high res with running streams and flying birds... Awesome game engine... Steve
If you look at this you should be able to make it work
Yes, just change the numbers, so if you wanted the code to be 9362 it'd be like above, but:
- Put this in hotspot 9:
if (sequence == 0) sequence++;
else sequence = 0; // wrong combination, so start again
- This in hotspot 3:
if (sequence == 1) sequence++;
else sequence = 0; // wrong combination, so start again
- This in hotspot 6:
if (sequence == 2) sequence++;
else sequence = 0; // wrong combination, so start again
- And this in hotspot 2:
if (sequence == 3) { // correct combination so
AddInventory(5); // give player the ice cream
}
else sequence = 0; // wrong combination, so start again
And, you'd probably want the hotspots for the other keys - 1, 4, 5, 7, 8, 10 (for 0) - to all have:
sequence = 0; // wrong combination, so start again
(So that, for example, 9-3-6-4-2 wouldn't work.)
Your just using letters were I'm using numbers.
Using the hotspots for the letters and do the samething.
But that's only part of it, of course. And, for what you (theatrx) want, not particulary relevant. (Sorry, Candle.)
Basically, you'll need a string to store the 'password', an extra line to add the new character on button press, and a Label.SetText(string) command to display what's been entered.
(This post (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=8231.msg101622#msg101622) explains it in a bit more detail but uses 2.62 code, which will need updating.)
You may also want to use an int, instead of a string, add to that, and check it against the required amount (2003):
// pressing button 'M1'
passcode += 1000; // Add 1,000 to passcode.
if (passcode == 2003) {
//Do stuff
}
// pressing button 'M2'
passcode += 2000; // Add 2,000 to passcode.
if (passcode == 2003) {
//Do stuff
}
// Etc
Displaying gets a bit more complicated. You could just copy the int to a string, and set the label to display that. Somewhere on the forums, someone has written a function to convert a figure to Roman numerals - perhaps that would be usefull for you?
However, without more details about what you've got so far (what code you have, how your GUI is set up, how exactly you want it to work, etc) these are only general points.
Thank you so much for your response. I will try it today and see if I can get it working.
EDIT: I tried your suggestion but I keep getting unexpected passcode... Do I have to set up "passcode" first?
EDIT 2:
Here is a pic of GUI3
http://theatrx.8m.com/Passcode%20Panel.jpg
I want to push M1 and get 1000
M2 = 2000
M3 = 3000
I1 = 1
I2 = 2
I3 = 3
R1 = 0
R2 = 0
R3 = 0
I want this numbers to add up to 2003 which will show up in the label at the bottom of the GUI. So as you see there are a few ways to get the right password. When you get the right password, I want the 'portal' to activate which is actually an animated object.. after that the character will walk through the portal... which brings up the next question... can I activate a new walkable path up into the heavens? I think I can since I read it in the forums... This doesn't seem to be as complicated as I'm making it out but I worked on this all day and read through most of the forums on the subject and can't quite get a handle on what I'm doing wrong. Hmmm.
I know I've posted this before and have gotten some responses which I have followed up on but nothing seems to work.
Here's the deal.
Our hero needs a passcode to get through "the portal".
The heroine knows the passcode but doesn't want to give it to him. He gives her flowers and she tells him the passcode... The passcode she gives is "2003".
Great!
When he gets to the panel to input the passcode all he sees is...
M M M
I I I
C E X
There are no numbers! What's a hero to do?
The buttons are labeled as such:
M1 =1000
M2 = 2000
M3 = 3000
I1 = 1
I2 = 2
I3 = 3
C = Clear the label
X = Exit the GUI
E = Enter the passcode
I thought this was sort of a cool puzzle since it's in Roman numerals to Alpha Romaic.
So the combination could be attained by pressing...
M1 twice and I3 once or
M2 once and I3 once or I2 once and I1 Once and so on...
So it looks like I need a counter... which I have but I can't
seem to make M1 =1000 and have it show up on the label.
I've tried Global Integers... that doesn't seem to work so
I've tried text... It doesn't add...
So any suggestions...
The other problem is that the added figures need to show up in the GUI Label on the Passcode GUI as they are being added to each other.
I do have one other question... and I've been through the tutorials and the forums...
If the Statusbar and Inventory can be so easily customized...
Why can't the Save Restore and Yes and No be customized as easily. If I knew where they were and how they were accessed Couldn't I write over them if they were the same size and with the same number of details? I just don't want them to look so bad compared to everything else.
I've downloaded the Module for save/restore/yes/no but it doesn't work correctly. I am currently using 2.7. I do have the new Beta version but that only complicated modules. I've eliminated all modules that don't work with the new beta AGS... So... I've built new Rain... New snow... new fire... etc. so they work if you have the module or not.
I really love AGS but I'm having these two problems and I hope someone can help.
I'm makng this game for my son for Christmas... I'm about half way done... The other reason I'm doing it is I wanted to learn the program so I could provide the website for my theater with a virtual tour with an action character but I couldn't do that until I learned how AGS worked. It is extraordinarily versatile and thankfully you don't need to know how to 'script'... (except for the passcode and custom GUI issue).
I've been working on the game for almost a month and I've written some cool game music and have some great screenshots if you care to look at...
http://theatrx.8m.com/MICHAEL%20(zipped)%20Folder.zip
The biggest file is the music file... sorry...
Any help would be GREATLY appreciated.
Actually I think this AGS thing could have a whole new life as a tour provider for websites or 'specialty' games for mothers and dads to give to their kids... Starring 'THE KID'
Thanks for the help... Steve (THEATRX)
You were right that you had to set up the passcode variable - did you try doing that? (Add int passcode somewhere in your script - probably the top of the global script.) I can get it working, using the code I provided - what (apart from the 'unexpected passcode' error) is wrong with how it runs for you?
Same with the modules - you can't just say 'It doesn't work', and expect (useful) replies. By "I've downloaded the Module for save/restore/yes/no" I guess you mean SSH's Savegame Screenshot Module? What about it doesn't work right?
If you want to customise the Save/Load GUIs, you'll need to make your own - or download premade ones, as you have - you can't just change them as you do the Inventory & Statusbar. You also need to tell AGS to use those GUIs instead of the in-built ones (change the on_key_press commands, and the scripting for the buttons). I don't know which one you mean by the 'Yes and No' GUI (apart from the one that comes with SSH's module), is it the Quit GUI? Again, you need to make a custon one (but that's much simpler than custom save/load GUIs).
There are just too many different ways in which this can be achieved so in absence of exact details it would be very difficult to resolve.
I would suggest that you post a test file on your website that only contains this problem (portal issue) and supply a link so we can take a look at it and see what we can come up with.
ASHEN built a module that works perfectly... actually mine worked pretty well but I was using the wrong version of AGS... The new version... makes things work! Thanks for the response though... Steve
EDIT by Ashen: Quote removed - not need to quote the whole of the post directly above.
And here is that module:
SumPasscode for 2.7, (http://www.geocities.com/whoismonkey/SumPass27.zip) or
SumPasscode for 2.71 (http://www.geocities.com/whoismonkey/SumPass271.zip)
I've made it slightly more generic than theatrx wanted (well, I've let you set your own code), and added a few things. It should all be explained in the README, but PM me or post HERE (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=23793) if you need anything clearing up. DON'T POST IN THIS THREAD.
theatrx:
Quoteis it possible to have the "Passcode Accepted" within the same label as the Code itself.
Yes, just change the line
Display("CODE ACCEPTED"); to
lblPass.SetText("CODE ACCEPTED"); - and make sure the label is big enough to fit the text in properly. You might also want to add a slight delay (
Wait(10) for example) before the GUI shuts off, just so the player gets a chance to see it.
Same goes for the wrong code message - change
Display to
lblPass.SetText and add a delay before reseting.
ASHEN! You're the bong! This is a great little module. I'm sure it will be greatly appreaciated by all who use it! Steve
EDIT by Ashen: Big quote removed.