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

#1581
General Discussion / Re: Block PAD
Mon 15/06/2009 18:22:37
Thanks for the contributions everyone, I'm getting a better response than I had hoped for. And thanks Ghost and ProgZmax for the links, I'll check them out. Initially Mods I was going to have music, but then afterwards I thought it would be distracting and irrelevant to the point of Block PAD.
#1582
I've only got 38 lines of code in my global script, 6 of which is a fancy green header ;), so it's not too bad now that you solved the problems for me. Oh, and I've used Khris' suggestion, so thanks for that too.
#1583
Woo! It works! Thanks for your help, otherwise it would have been a boring one-theme room... :)
#1584
Thanks, this has been really helpful. I've decided to use your suggestion of global variables; but I might need some help making this.

I've set up a global variable of int type, called it background_frame and set the default value to 0. In my room script, under room_Load, I've put something along the lines of this...

Code: ags
function room_Load()
{
   if (background_frame == 0) SetBackgroundFrame(0);
   if (background_frame == 1) SetBackgroundFrame(1);
   if (background_frame == 2) SetBackgroundFrame(2);
}


I guess I have to assign the value of background frame when the player leaves the room (and so resets it), and this needs to be done in room_Leave. What coding do I need to check the background frame and assign it as a number to background_frame, or have I got this all wrong?

Thanks. :)

Edit: I've just noticed the GetBackgroundFrame(); function. How do I use this to check it?
#1585
Hullo.

So far I've come across heaps of problems with my project. Here's what's happening:


  • For my one room game I have three themes.
  • These three themes take the form of different background frames which you can change by pressing 1, 2, or 3.
  • I have created a simple label GUI to appear in a certain place in the room, whatever the theme.
  • In my room script, under the room_Load function, I have got 250 different phrases that are randomly selected when the player enters.
  • The phrase that gets selected appears in the label.
  • I want the player to be able to change the text in the label so they get another random phrase.

Now, this last point I have been able to do with no problems. To change the theme, I am using the restart function to restart the game. Since it is only a one room game, it restarts at the very beginning of the game before the phrase is selected. I'm using this because I cannot use resetroom, as the player can't reset the room they're in.

My problem starts when the player changes the theme. The text in the label stays as it is, which is fine, but if you want to get another phrase and continue using that theme you have to press the space bar (which is the button to restart.) This means it restarts the game at the very beginning again, and although it gives a new phrase, it changes from the theme the player chose and uses the default theme.

To stop this happening, I have entered the second line under the button's code.

Code: ags
function on_key_press()
{
   if (keycode == 2) SetBackgroundFrame(2);
   SetRestartPoint();
}


Now, whenever the player changes theme it sets that theme as the restart point so it continues to use that every time the players restarts. BUT this is where the problem continues. The phrase in the label is stuck as it was when you changed theme, and restarting doesn't change the phrase. Then, it doesn't matter it you re-change themes - the phrase is stuck until you close the game.

I have tried having the three themes as separate rooms, but this doesn't work for another reason. How would I reselect the phrase every time the game reloads? I've tried various different things but it never works for something or another is wrong. I probably haven't explained as well as I should have, but I'd appreciate any help at the moment.

Thanks! :)
#1586
I think you could do it this way too...

Code: ags

//In global script, or wherever your on_key_press function is located...

function on_key_press()
{
   if (keycode == eKeySpace) gIconbar.Visible = true;
   if (player.Room == (whatever room number) return;
   if (keycode == eKeyReturn) gSettings.Visible = true;
}


This is just an example. Say you wanted to disable the return key in a certain room, put the second line of code just above it. If this disables other codes that you want enabled, make sure you put what you do want disabled at the very bottom of the function, like shown. Hope this helps! :)
#1587
Hullo.

Restarting is quite an integral part in my game. It is a one room game, and rather simple. Yet when the player restarts by pressing the space bar, it starts playing the music from the beginning again. However, I want the music to carry on playing. How can I get the game to restart without resetting the music, or can't I?

Thanks!
#1588
General Discussion / Re: Block PAD
Sat 13/06/2009 18:41:37
Wow those are great! I'll definitely use these, too, with credit given to their authors. Thanks for directing me there!
#1589
General Discussion / Re: Block PAD
Sat 13/06/2009 11:33:18
Thanks everyone for their contributions so far. I'll definitely be using them!  :)
#1590
General Discussion / Re: Block PAD
Fri 12/06/2009 20:26:34
Thanks, I'll have a look through them now. Actually, I've just realised that the maximum number of words can be much higher than 10, so I'll change that in my original post as well.
#1591
General Discussion / Block PAD - Thread Closed
Fri 12/06/2009 20:00:37
Block PAD
Suggestion Thread

You're not a writer if you don't get afflicted with that terrible ailment: writer's block. But with Block PAD, there's no need to snap your pen in frustration or tear up that manuscript of yours - there's a wealth of fresh ideas to keep you going.

I'm creating a one room AGS-abused game with a random phrase generator to help with writers' block. A bit like a toilet plunger for the mind. And seeing how everybody on the forums has a certain creative flare, I thought that this would be a good place to gather phrases to add into Block PAD. There are however a few criteria that your contributions need to meet...


  • It cannot be too long (max. 10 words)
  • It must be kept suitable for every age. :)
  • Quotes are fine.
  • Single words are fine.
  • Plots are fine.
  • Random midnight muses are definitely fine.

Thanks for looking at Block PAD, and thanks for your co-operation in anticipation! Contributions may not be added into the first version, but in a later expanded version I'll put everything in! :) (Credit will be given to all you good people on the forums, of course!)

You can visit the production thread for Block PAD HERE, if you're interested/care.

#1592
AGS Games in Production / Re: Yellow Button
Fri 05/06/2009 22:16:09
Will you throw in a free magnifying glass with each game so people can see the rooms? Looks interesting, good luck!
#1593
Wow could you have any more signs in that shop? :)
#1594
That probably might explain why it was acting really strangely and adding duplicate items into the display box. If that wasn't the reason then :-\
Thanks, I'll know what to do next time I deal with strings.
#1595
Good! Now that my brain's in gear today I was able to successfully do it using the second method. It works really well; cuts down on code; and I don't get that annoying thing where it adds two versions of it and does really weird stuff.

Thanks for helping me all the way on this, I really appreciate it - and I've learnt quite a bit too.  :)
#1596
I've copied the first block of code into the global script, and that seems fine. But when it gets to the room script, it claims that 's' is an undefined token. Does it need a global variable?
#1597
Maybe this might explain it better:

Code: ags
function hGrass_Look()
{
   int ran = Random(4);
   String s;
   if (ran == 0) s = "A herbacious plant counting for most of the vegatation on the world!";
   if (ran == 1) s = "Flattened by stampeding spectators.";
   if (ran == 2) s = "Trodden, withered, and sad...";
   if (ran == 3) s = "A member of the grass family Poaceae.";
   if (ran == 4) s = "Trampled, yellowed, and dying...";
   DisplayBox.AddItem(String.Format("%s", s));
   DisplayBox.ScrollDown();
}

Rather than having all this for one hotspot, I've used your code in the global script and just imported it instead. BUT the code in the global script has outcomes like "first" "second" etc. So, I was wondering how to change these outcomes to suit the hotspot looked at. I hope that makes it clearer.  :) I admire you perseverance, I have to say. Thanks!
#1598
I'm using this as a random phrase generator, so looking at an item/hotspot could produce one of five outcomes, in no particular order, making everything much more interesting. My very first post might explain it a little better. I was wondering whether there's a way to change the value of s for each individual outcome for looking at a particular hotspot?
#1599
Ahh, that makes sense now. Admittedly, I only did what I said in the last post because I didn't understand and didn't want to be a further pain, but I ended up being more of a pain. :) I've done what you said and it works nicely. The 21 lines of code I used to have are now 1. Hopefully the last question on this though: How would I change the value of 's' for each hotspot? At the moment every hotspot either says first, second etc, so how is it done?

Thanks for your help.
#1600
Success!

I entered the first block into my room script, changed the hs for the hotspot name, and it worked perfectly. This meant I could take out the coding from the global script. The script may be longer in the room script, but it frees up space in the global script and it's not too complicated for me.  :)

Thank you Khris, thank you Trent; that seems to be the only problem left for the basis of my game.
SMF spam blocked by CleanTalk