Lemma Soft Forums

Supporting creators of visual novels and story-based games since 2003.


Visit our new games list, blog aggregator, IRC, and wiki.
Activation problem? Email [email protected]
It is currently Wed May 22, 2013 7:51 pm

All times are UTC - 5 hours [ DST ]


Forum rules


Ask questions about one topic per thread, and use a descriptive subject. "NotImplemented error in script.rpy" is a good subject, "Tom's problems" is not. Remember to include all of traceback.txt or error.txt when reporting a problem, as well as the relevant lines of script. Use the [code] tag to format scripts.



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Help please!
PostPosted: Wed Apr 11, 2012 7:13 am 
Newbie

Joined: Sat Apr 07, 2012 6:07 am
Posts: 2
Location: Philippines
Hi! I need help with something. How do I make it so that you have to finish certain tasks within a time period?

For example, you have to finish 6 tasks, each taking a day or two, within 3 weeks? (Not counting weekends)

I'm a total newbie at this, so some help would be greatly appreciated.


Top
 Profile Send private message  
 
PostPosted: Wed Apr 11, 2012 12:22 pm 
Regular
User avatar

Joined: Sat Feb 04, 2012 9:46 pm
Posts: 34
First, if I dare put a few words of advice in a friendly manner :
1) Be more precise in your title : "Help me" doesn't tell us what your problem is, and that's the important point of your help plea. Here, "Adding time constraints to tasks" would tell your would-be helpers what you need.

2) Be more precise, period. Your message gives us but the barest of facts, so it is complicated to know your precise needs. A code snippet of what you've done yet would help place your problem in its context (Plus, it would show without a doubt that you've tried)

3) Don't be afraid to read the quickstart manual, the Reference Manual, the Tutorials , and (after understanding the rest) the Cookbook. They're full of precious answers and useful tips!

Now, correct me if I'm wrong, but I've understood this from your message (capitals placed for emphasis):
*) The Player has Tasks to complete.
*) Each of these Tasks take Time (mesured in days) to complete.
**) You can't work on Weekends.
*) You want either to Check that, at a precise Date, all the tasks have been done.

Well, here is code that will do that. It is tested and works, but it is ugly in its design and you shouldn't copy it as is - just try to understand how it works and build your own solution from it.
Code:

    $ task1_done = False
    $ task2_done = False
    $ task3_done = False
    $ task4_done = False
    $ task5_done = False
    $ task6_done = False
    $ days = 0
    $ is_slacking_off = False
   
    while (days < 21) :
        $ printedDays = days + 1
        if (days % 7 < 5) :
            menu:
                "Day %(printedDays)s : What do you want to do ?"
               
                "I'll do task 1. (2 Days)" if not task1_done :
                    $ task1_done = True
                    $ day_to_work = 2
               
                "I'll do task 2. (1 Day)" if not task2_done :
                    $ task2_done = True
                    $ day_to_work = 1
       
                "I'll do task 3. (1 Day)" if not task3_done :
                    $ task3_done = True
                    $ day_to_work = 1
       
                "I'll do task 4. (2 Days)" if not task4_done :
                    $ task4_done = True
                    $ day_to_work = 2
       
                "I'll do task 5. (1 Day)" if not task5_done :
                    $ task5_done = True
                    $ day_to_work = 1
       
                "I'll do task 6. (1 Day)" if not task6_done :
                    $ task6_done = True
                    $ day_to_work = 1
               
                "I won't do anything" :
                    $ is_slacking_off = True
                    $ day_to_work = 0
               
            if day_to_work == 2 :
                if days % 7 == 4 :
                    "This task was long, so I had to split it between Friday and Monday, pausing during the weekend."
                    $ days += 4
                else :
                    "This task was so long, it took me two days!"
                    $ days += 2
                   
            else :
                if is_slacking_off :
                    "Being lazy is awesome!"
                    $ is_slacking_off = False
                else :
                    "It took me a day to do... whatever I was doing."
                $ days += 1
               
        else :
            "It's the week end, I will take it easy."
            $ days +=2
           
    if task1_done and task2_done and task3_done and task4_done and task5_done and task6_done :
        "Yay! I done it all!"
    else :
        "Oh, no, I forgot to do something!"


Don't be afraid to ask for more help, though. Not for more code - I just wanted to put you on the correct path - but advice will always be given :wink:


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: Donmai


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Protected by Anti-Spam ACP
Powered by phpBB® Forum Software © phpBB Group