deengames / a-day-and-a-night

Top-down adventure game based around a day and night in a small village. With epic dragons, an evil empire, and a rousing rebellion.
7 stars 5 forks source link

Item Avatars #199

Closed ashes999 closed 9 years ago

ashes999 commented 10 years ago

When you get items, avatars appear in the message window.

Like this:

image

Wulf commented 10 years ago

I just looked at your event. From what I can tell, you are using the script "Ace Message System." What are you looking for exactly? Do you want something like giveItem(itemID) to automatically do everything? i.e. something like this? capture

ashes999 commented 10 years ago

The giving of the item can be done separately. I just need some way to show the message window with the image and text centered, like the fake screenshot in this issue.

Wulf commented 10 years ago

Ah. I should've tested it thoroughly before posting a bag of ignorance.

So this this the actual image:

capture

Last question; can I assume the given image will be rotated?

ashes999 commented 10 years ago

Oh you really are back alhamdulillah :)

Yes, you can assume the image is already rotated.

Don't worry about bags of ignorance. This entire idea is poorly-defined and this is finally when we figured it out (by faking screenshots and showing them to our artist).

Issues left:

ashes999 commented 10 years ago

Did you have time to work on this @Haris1112 ?

Wulf commented 10 years ago

I have a midterm on friday, after which I should be relatively free. Was this an urgent task?

ashes999 commented 10 years ago

Nope. Just thought eight days is a long time for you to go without posting updates :)

Wulf commented 10 years ago

lol :)

Well here's my game-plan: 1 Look at the drawing code that is used in the custom script. 2 Adjust the draw method of Draw Icon / Draw Text to center text.

Wulf commented 10 years ago

Yaay, I centered the sword!

centered

I have no idea how to center the text yet.

Anyway, I found the documentation to rgss3!! It's in the script editor -> help button! Also I changed the AceMessageSystem in a way where all \pic usage will result in centered images.

when 'PIC'
  text.sub!(/\[(.*?)\]/, "")
  msgbox($1)
  bmp = Cache.picture($1.to_s)
  rect = Rect.new(0, 0, self.width, self.height)
  contents.blt(self.width/2 - bmp.width/2 - self.padding, 0, bmp, rect)

I could add another condition during the checking of \commands: example: when 'PIC_C' .. .. that way, \pic_c would center a picture :trophy:

ashes999 commented 10 years ago

Whoa, low-level drawing APIs. I'm not sure I approve, but okay, mashaAllah good find :D

Wulf commented 10 years ago

O.o I thought this was high level. Isn't low level when it's closer to the 1's and 0's?

How would you like it? Something like show(image_in_pictures_folder, message)?

ashes999 commented 10 years ago

blt is a pretty low-level operation. I don't mind it, I just prefer avoiding low-level stuff where possible. If it works, it works, I'm not complaining :)

Wulf commented 10 years ago

ok :)

Wulf commented 10 years ago

Kay it's done :cake:

In the event text, you have to use this:

\pic[inventory\\sword-inventory]
\ct[Found a sword!]

And these are the (minor) changes to the AceMessageSystem.

    when 'PIC'
      text.sub!(/\[(.*?)\]/, "")
      bmp = Cache.picture($1.to_s)
      rect = Rect.new(0, 0, self.width, self.height)
      contents.blt(self.width/2 - bmp.width/2 - self.padding, 0, bmp, rect)

    when 'CT'
      text.sub!(/\[(.*?)\]/, "")
      rect = Rect.new(0, pos[:y], self.width - 2 * self.padding, self.height)
      contents.draw_text(rect, $1.to_s, 1)
ashes999 commented 10 years ago

Is it possible to wrap this into a single script call? Something like your suggested show(image_in_pictures_folder, message) which appropriately uses \pic and \ct. You can use the show_message API call for this, I believe (see: unofficial API guide)

Wulf commented 10 years ago

okay I'll try

Wulf commented 10 years ago

The API call doesn't parse the text correctly though it comes out exactly as the input.

I tried creating a window_message but it doesn't want to show! I need to take a break :P

ashes999 commented 10 years ago

I'm sure you can figure something out :) it's not a big deal if you can't do this though

ashes999 commented 10 years ago

So this is done? @Haris1112

Wulf commented 10 years ago

almost, i created my own module. and will just implement the drawing function therein

ashes999 commented 9 years ago

(ping)

Is there any work left here?

Wulf commented 9 years ago

Yea, I'm wrapping the script call around a method. Last time I tried the show_message show_message API call, but it didn't work. So if I just have another \function to do the centering, I think it would be better - it will preserve the original \pic functionality.

ashes999 commented 9 years ago

@Haris1112 mashaAllah I know you've moved on to other things. Can you please wrap this up so you don't have any loose ends left for ADAAN?

Wulf commented 9 years ago

I've changed the text of the blacksmith-sword event to the following:

    \nc\cpic[inventory\\sword-inventory]
    \ct[Found a sword!]