devolution

Author Topic: General Discussion  (Read 3821242 times)

0 Members and 47 Guests are viewing this topic.

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: General Discussion
« Reply #7290 on: May 01, 2016, 04:38:00 PM »
No, I mean exactly your system, new popups  :)
Even if they will follow each other (update and fail), it's not a big deal. I added support for failing notifications.

Edit: turns out it's very easy to add support for fail+quest log function. Now one can write
Quote
$ pytfall.world_quests.get("Two Sisters").fail("Sadly, you missed you chance to meet her.")
and fail quest with failing notification and a failing note in the log.
 
« Last Edit: May 01, 2016, 06:21:42 PM by DarkTl »

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: General Discussion
« Reply #7291 on: May 02, 2016, 04:52:24 AM »
Ok, if it works, it works. I'll take a look at it little bit later.
Like what we're doing?

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: General Discussion
« Reply #7292 on: May 02, 2016, 05:16:12 AM »
I've added hiding the screen for an unlikely case of two pop-ups being required, it's a bit jerky but it prolly cannot be done any better using the normal screens, or if it can, I am not sure how. We can obviously create displayable that will live independently from one another but it's slightly more complicated than throwing a simple screen together and prolly not required for quest pop ups.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: General Discussion
« Reply #7293 on: May 02, 2016, 05:35:22 AM »
I'm not sure how to indicate quest failing because of the garbage clearing system. I mean, I know how to show the popup, but have no idea what to do with the quest log in such cases.

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: General Discussion
« Reply #7294 on: May 02, 2016, 06:00:05 AM »
I'm not sure how to indicate quest failing because of the garbage clearing system. I mean, I know how to show the popup, but have no idea what to do with the quest log in such cases.

What do you mean? It looked like you did everything right in the code. As you fail the quest, it will be moved to failed list and removed from everywhere else. Last log entry will be on file as the reason for the failure with everything else greyed out (something I've added yesterday, along with a couple of other updates to the log screen).

Seems perfectly reasonable.

==>>
I don't think that the garbage clearing system works like it does with the events btw. It prolly doesn't destroy quest objects like my event system does (because we do not log events and they can become absolutely useless after a while, just creating bloat for the events/saving systems), I can look into that if you like.
« Last Edit: May 02, 2016, 06:03:18 AM by Xela »
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: General Discussion
« Reply #7295 on: May 02, 2016, 06:14:07 AM »
No, when the game kills the quest by itself because can't find valid events, it probably still should show a popup (atm it doesn't, if I'm not mistaken). So I wonder if we should write something in the log quest in such cases.

I can look into that if you like.
Wouldn't hurt.

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: General Discussion
« Reply #7296 on: May 02, 2016, 06:24:31 AM »
I have a problem with data types...
Quote
elif location == "park" or location == "forest":
                excladed.extend(["indoors"])
                if location == "forest":
                    included = ("nature", "wildness")
                else:
                    included = ("nature", "urban")
                if char.has_image("stripping", "nature", exclude=excladed):
                    gm.set_img("stripping", included, exclude=excladed, type="reduce")
The game here ignores included when I try to gm.set_img("stripping", included, exclude=excladed, type="reduce"). How to make it work?

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: General Discussion
« Reply #7297 on: May 02, 2016, 06:34:52 AM »
No, when the game kills the quest by itself because can't find valid events, it probably still should show a popup (atm it doesn't, if I'm not mistaken). So I wonder if we should write something in the log quest in such cases.
Wouldn't hurt.

Code: [Select]
        def next_day(self):
            """Fails quests that have no valid events.
            """
            garbage = list()
           
            # Find incomplete quests with no existing events
            for i in self.active:
                for j in pytfall.world_events.events_cache:
                    if j.quest == i.name:
                        break
               
                else:
                    if not i.manual: garbage.append(i)
           
            while garbage:
                devlog.warning("Garbage Quest found! \"%s\" was failed."%garbage[-1].name)
                self.fail_quest(garbage.pop())

Ok, I've fixed a tiny bit of this code because it wasn't logging sh!t right, but logically it did... something...

So, basically what it does is this:

It iterates over all currently active quests, checks if there are any events in cache that are bound to those events and fail the quests if not so but only if the quest is not set to manual controls.

===>>
It feels (to me), a bit weird because for example:

- We move the quest to the next stage, with an existing event BUT that event is set to activate only in three days onward so it is not cached until then... BOOM... quest is auto-failed for no good reason...
- Shit gets even weirder with menu extension system because there is no event... it's just there.
- The system doesn't account for any quest that may no longer ever start (with their own conditions no longer realistic and no events bound to them (killed off by the event garbage collector, which is some what smarter)). But this isn't a big thing.
- Prolly more...

====>>
I believe it is meant to be used only with quests in auto mode, like the idol quests but even then, only if the newly registered events are cached on the very next day and happen without delay. In either case, if we set quests to manual control, garbage system is not even a thing, I will also change the code a bit one more time because we obviously should check for manual first, before we iterate over a potential 100s of quests and events while we wish to do something to them ONLY if there are no manual controls.
Like what we're doing?

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: General Discussion
« Reply #7298 on: May 02, 2016, 06:41:32 AM »
I have a problem with data types...The game here ignores included when I try to gm.set_img("stripping", included, exclude=excladed, type="reduce"). How to make it work?

You know this and know it well:

Code: [Select]
elif location in ["forest", "park"]:
    excladed.extend(["indoors"])
    if location == "forest":
        included = ("nature", "wildness")
    else:
        included = ("nature", "urban")
    if char.has_image("stripping", "nature", exclude=excladed):
        gm.set_img("stripping", *included, exclude=excladed, type="reduce")

You need to unpacks the tuple or the whole tuple is passed as an argument instead of individual tags. You've done this dozens of times in jobs and interactions!

Edit:
And you should be able to safely use excluded or exclude instead of "excladed" there, there will be no name collisions in Python, especially since you are working on global namespace there and there is nothing to collide against (I don't recall using global names this plain to store something, unless I was heavily intoxicated at such time :D ).
« Last Edit: May 02, 2016, 06:49:37 AM by Xela »
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: General Discussion
« Reply #7299 on: May 02, 2016, 06:51:54 AM »
If I ever done it before, it's because I used parts of your code as examples, not because I knew what that * does  :)

I believe it is meant to be used only with quests in auto mode, like the idol quests but even then, only if the newly registered events are cached on the very next day and happen without delay.
Yeah, I'm not even sure if we need that thing.

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: General Discussion
« Reply #7300 on: May 02, 2016, 06:56:34 AM »
If I ever done it before, it's because I used parts of your code as examples, not because I knew what that * does  :)
Yeah, I'm not even sure if we need that thing.

Yeah... it doesn't do much harm either, maybe we should just make all quests manual my default? It will be much more intuitive that way (since we'd be using manual the most).

** unpacks a dict btw, bloody useful sometimes and I could have sworn that you improved on my own code in whore job removing the unnecessary bloat by using unpacking predefined values instead of typing everything all the time. That's why I was surprised that you've asked about it.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: General Discussion
« Reply #7301 on: May 02, 2016, 07:00:01 AM »
Yeah... it doesn't do much harm either, maybe we should just make all quests manual my default? It will be much more intuitive that way (since we'd be using manual the most).
Yeah, my thoughts exactly.

** unpacks a dict btw, bloody useful sometimes and I could have sworn that you improved on my own code in whore job removing the unnecessary bloat by using unpacking predefined values instead of typing everything all the time. That's why I was surprised that you've asked about it.
Shows how well I can operate blocks of your own code to improve your own code in other places without even understanding everything inside them  :D

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: General Discussion
« Reply #7302 on: May 02, 2016, 07:23:30 AM »
Yeah, my thoughts exactly.

Oki, that is done.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: General Discussion
« Reply #7303 on: May 02, 2016, 07:42:28 AM »
I tried to
Quote
            if location == "beach":
                excluded.extend(["indoors"])
                included = ("beach")
                if char.has_image("stripping", "beach", exclude=excluded):
                    gm.set_img("stripping", *included, exclude=excluded)
                elif char.has_image("nude", "beach", exclude=excluded):
                    gm.set_img("nude", *included, exclude=excluded)
                elif char.has_image("lingerie", "beach", exclude=excluded):
                    gm.set_img("lingerie", *included, exclude=excluded))
It shows completely wrong pictures. But if I replace *included with "beach" again, it works. Why?

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: General Discussion
« Reply #7304 on: May 02, 2016, 08:09:19 AM »
Because you're unpacking a string, not a tuple there, simpler:

Code: [Select]
>>> ("Meow")
'Meow'
>>> ("Meow", )
('Meow',)

Code: [Select]
>>> ("meow" + " Meow!") * 2
'meow Meow!meow Meow!'
>>> "Meow" * 2
'MeowMeow'
>>> ("Meow") * 2
'MeowMeow'
>>> ("Meow", ) * 2
('Meow', 'Meow')
>>>

In Python, you are allowed to use () as code delimiters. Normally, when you are building arguments like you do, lists are used because tuples are immutable and you can't really add sh!t to them.

Code: [Select]
include = ["tag"]
can only mean create a list with a single tag element, nothing else. Just don't confuse it with:

Code: [Select]
list("tag") # or tuple("tag")
cause it will split the string and you ain't going to get the result you want.
Like what we're doing?