vaendryl / Sunrider

source code of the visual novel 'Sunrider'
http://sunrider-vn.com/
41 stars 21 forks source link

Introduce battle log #62

Closed DoumanAsh closed 9 years ago

DoumanAsh commented 9 years ago

1) I aim to get it ready for 7.0 2) Integration of battle log will require sparing a proper place in battle UI. Guess Vanendryl you will need to help me out with that. Battle UI is kinda full enough with other stuff :D

vaendryl commented 9 years ago

if people can hide it and drag it around I don't think that needs to be a problem. the player can solve it for us :) a hotkey to summon and hide it would be nice too. Maybe Sam will spare some time making a good looking image for the frame background instead of just the transparent solid.

DoumanAsh commented 9 years ago

Actually i want some nice button for log :) With log itself there only one issue. You cannot drag scroll without affecting battle screen... You can scroll only via middle mouse button :(

vaendryl commented 9 years ago

that's odd. when I tried out your update2 version yesterday I was able to drag the frame around just fine with the left mouse button and it did not drag the battlemap with it at all. middle mouse button is supposed to cycle through your units!

could it be the mac version somehow works differently in this?

DoumanAsh commented 9 years ago

Try the same with final version: http://innomenpro.com/forums/index.php?topic=669.msg15930#msg15930

I think that there should not be any differences in behavior of renpy screens

vaendryl commented 9 years ago

I tried it. it works perfectly except for dragging the vertical bar to the side. I'd rather have that bar not be clickable then try to really fix this issue. seems far too much of a bother for what it's worth. it all works just fine except for that one tiny issue.

except for actually logging issues. I tried attacking the PACT support with the blackjacks assault and I got some weird results. too much of a pain to describe fully but the phrase 'PACT support negated 0 damage of black jack's kinetic attack' shows up 3 times. it shows 19 misses and no hits. it just seems a bit weird, y ou should try it yourself.

DoumanAsh commented 9 years ago

when details enabled it wirtes in <> information about each shot And then summary is present like ".... total damage" You can see how fire is being logged. Guess you'll understand immediatly why there are so many traces :) It just depends on number of weapon shots :)

Regarding scrollbar... i'm not sure what to do with that, i suspect that i will need to make it by myself instead of auto-created by view port

vaendryl commented 9 years ago

renpy offers some flexibility in that regard. you can use the bar screen element http://www.renpy.org/doc/html/screens.html#bar and link it up with the viewport via the id system. there's an example of this further down the viewport documentation: http://www.renpy.org/doc/html/screens.html#viewport

it seems to me the click event doesn't get absorbed by the drag if you're right above the built-in bar. this makes sense as the click events should be available for the bar. regrettably this also makes it available for the mousetracker causing you to also drag the battlefield along.

DoumanAsh commented 9 years ago

Seems like even with custom vbar i cannot make a proper dragging... I guess it is not possible to disable mouse tracking for specific area?

vaendryl commented 9 years ago

the changed property allows you to set a custom python version to execute. maybe you can abuse that?

or actually, you can have the hovered action set a value that disables the mousetracker. (I suggest reusing BM.draggable for this) again, it'd be too much trouble for me to bother this much with it :P

DoumanAsh commented 9 years ago

I have no idea what to set to changed :) i guess it is not difficult to just use hovered/unhovered :)

BlueOrange commented 9 years ago

Tried to help by looking for the relevant source in renpy. Couldn't find it - ahh, learning curves :/

DoumanAsh commented 9 years ago

Actually i found bug with auto-adjustment. Sometimes renpy re-evaluate screen just for fun when you're scrolling up.

Anyway i would like to have some help with this drag-ability of scroll...

vaendryl commented 9 years ago

can't be arsed to do this properly via a PR but this fix seems to work well. https://www.dropbox.com/s/tycidu7vd1b3bxc/combat%20log%20drag%20fix.zip?dl=0

DoumanAsh commented 9 years ago

Yep, you're right. That works just fine. Regarding # $yadjust.change(200*len(BM.battle_log)) #renpy does not handle this well. You're right too... it breaks a little... Though i'm not sure how to make auto-scrolling down else.. I guess player will need to do it by himself :D

btw how exactly it can be done properly? and what is PR?

vaendryl commented 9 years ago

renpy often runs all the code in a screen as part of the image prediction process and Tom repeatedly states in the documentation that it's a very bad idea to have code inside a screen that changes values like that. I've run into similar problems myself on multiple occasions. it never works well.

there's probably still a way to do it though. I personally would prefer using a function to add log entries and this function would also drop down the viewport. this way it'll only scroll down automatically whever something actually happens, which imo is the perfect behavior.

now, how about adding the ability for the player to resize the frame? :D renpy doesn't offer that for sure, so an inventive solution would be required...

DoumanAsh commented 9 years ago

is it possible access screen outside of its code?

vaendryl commented 9 years ago

I've tried that before and got pretty close, but no. all the values are read only. or rather, they appear to be changed but it doesn't affect anything. some sort of quasi read-only feature.

you can have the size of the frame be set to the value of a variable which itself gets changed by code. you would have to restart the interaction to update the screen a couple of times a second to properly get the drag-resize effect though. this might not work out which means the entire thing would have to be moved into a custom displayable...

hehe. I'm just kidding though. that's crazy talk!

DoumanAsh commented 9 years ago

there is actually renpy.restart_interaction() but it seems to work only inside of action statement... Anyway thanks for help. It looks almost perfect now