else's Recent Forum Activity

  • Ack! Sorry about this - I just checked through and found I'd missed out a couple of keys (I have loads in each dictionary) and hadn't picked up on them the first time I checked. My fault entirely, everything is working fine now.

  • Sorry to keep resurrecting this thread but this sort of follows on from the problems I had before.

    Everything is now working fine except the dictionaries sometimes return a result of 0 and I'm not sure why. For example, I have a dictionary called 'Jobs' with keys from 1 to 6 containing job names as values and set text from it like this:

    Jobs.Get(str(round(random(1,6))))

    All of the possible jobs will sometimes appear as text but I also sometimes get a 0. This happens with other dictionaries too.

  • Thanks both very much. Nimos100 - that makes a lot of sense and I feel slightly embarrassed for not figuring it out myself! Whiteclaws - the array method is very elegant and I'll certainly make use of it (also, a tip of the hat for spotting me! Hope all is well with you ).

  • I'm having a little trouble with this again. I now want to store different instances of randomly generated text permanently.

    I have a number of floating pages and when clicked on I'd like them to display a block of randomly chosen text (which I can now do thanks to the advice received above) but I'd then like that page to store the text which has been generated (as an instance variable?) so that from now on that particular page will always display the same thing when clicked on.

    What's the easiest way to do this?

  • Ah, thank you - I forgot the quotes.

    That will be very useful because there are times when I want long lists of variables which will be used frequently (so a dictionary is perfect) and times when I want just a few options for variety in one particular piece of dialogue (so the choose method will be best).

    Thanks again to both of you - this is just about the most helpful and supportive forum I know.

  • Works perfectly! Thanks very much - greatly appreciated.

  • That does help! Thanks very much indeed.

    EDIT: Actually, it seems I can't use integers as keys in a dictionary... Perhaps I could do it with an array instead?

  • I'm trying to randomise certain words within dialogue so they will change each time the text object is displayed. As an example, a character might say:

    "I'm a (carpenter/smith/doctor) from the (city/coast/mountains)."

    One of the words in brackets will be randomly chosen each time.

    I can think of a couple of long-winded workarounds to achieve this but I'm wondering whether there's a quick and easy way that I'm overlooking. Ideally, I guess I would like to be able to set a global variable to a random bit of text in the same way that it can be set to a random number. So I could have a variable called 'occupation' and set it to something like this: choose(carpenter,smith,doctor). Then I could reset it each time after use. I know that exact way doesn't work but maybe there's a similar function?

    Thanks in advance for any help.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks so much! After posting, I figured out the 'mouse x and y every tick' method but your second suggestion is much smoother and more elegant. Much appreciated.

  • I have a sprite which plays its default animation correctly when I place it in the layout but when I set this sprite as the mouse cursor it isn't animated. I must be overlooking something...

    Thanks in advance for any advice.

  • Many thanks! Yann and retrodue - your tips worked great. I restored it from the backup file in the end. Excal - I've learned a valuable lesson!

  • In the middle of creating an entry for Ludum Dare, everything was going well. Then without warning I get this message (linked below) informing me of a failure to open the project. I had changed nothing since being able to open it perfectly previously. I've tried restarting everything. Can anyone please advise me if there is a way to salvage my work?!

    imgur.com/cchFI1y

else's avatar

else

Member since 9 Mar, 2013

None one is following else yet!

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies