Author Topic: Pic edit and animating inv item picture  (Read 16894 times)

0 Members and 1 Guest are viewing this topic.

Offline totenmaske

Pic edit and animating inv item picture
« on: June 07, 2012, 04:04:43 AM »
I know this isn't a coding problem but I wasn't sure where to put it.
Is there a limit to how big a pic can be?
 Because when I made one of my rooms I seem to have a problem with smaller details I put in. Like doing a tree for example, I first make it solid colours of different shades of green, then to finish it up I use the same shades and also black with the pen style that isn't a solid circle (hope you know why I mean, because I have no idea what it's called).
Once I save and close the pic the detail I put in with the pen seems to have moved around or disappears leaving just white, not all of it will, but enough to make me get rather annoyed.
My pic is only 1.77kb.


Also on a different topic, Are you able to make your inv items animate just through one cycle when you open up the description from the TAB menu.
« Last Edit: June 07, 2012, 04:35:56 AM by totenmaske »



Offline Cloudee1

Re: Pic edit and animating inv item picture
« Reply #1 on: June 08, 2012, 01:20:42 PM »
There is a size limit, but you are no where near it with a 2 kb picture, if anything you probably just uncovered a bug. Are you using studio or companion? My initial suggestion here would be to try out the line tool to add in your shading instead of the pen. As for cycling through an inventory view once I'm not sure but I'll see what I can do. My first guess is that a setCycle(End) is needed somewhere, but since I've gone all point n click, I'm not sure. it's been a while since I've used the template straight from the box
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline totenmaske

Re: Pic edit and animating inv item picture
« Reply #2 on: June 08, 2012, 10:51:22 PM »
Ive tried both Studio and companion for the Pic problem, both seem to have it. I just thought about this, under pen style there is a box ticket "use random pattern" Could it be possible that it just keeps sending each pen detail i've put in a new random pattern when ever i open / save the Pic?

For the Inv problem, i've tried adding a few things to the main script and INV script, but i don't really know what i'm doing, so i'm probably just making things worse seeing as most of the time i would just crash the game.

Not at home at the moment so i can't try out using detail with a line, but i'm guessing that will solve the problem.


Offline Doan Sephim

Re: Pic edit and animating inv item picture
« Reply #3 on: June 09, 2012, 01:39:01 PM »
For the Inv problem, i've tried adding a few things to the main script and INV script, but i don't really know what i'm doing, so i'm probably just making things worse seeing as most of the time i would just crash the game.
I believe this is possible because there is an animating icon for the death sequence. There may be some answers there, but I personally do not know how to have an animation in a window.

Offline totenmaske

Re: Pic edit and animating inv item picture
« Reply #4 on: June 10, 2012, 03:58:11 AM »
i just had a browse of the dying script and found this
Code: [Select]
(instance deadIcon of DCIcon
(properties)
(method (init)
(super:init())
(if(== gRoomNumberExit 540)
= cycler (End:new())
(send cycler:init(self))
)
)
)
So headed over to the DCIcon script and its got
Code: [Select]
(class DCIcon of DIcon
(properties
type ctlICON
state 0
nsTop 0
nsLeft 0
nsBottom 0
nsRight 0
key 0
said 0
value 0
view 0
loop 0
cel 0
cycler 0
cycleSpeed 6
signal 0
)
(method (init)
= cycler (Fwd:new())
(send cycler:init(self))
)
(method (dispose)
(if(cycler)
(send cycler:dispose())
)
(super:dispose())
)
(method (cycle)
(var theCel)
(if(cycler)
= theCel cel
(send cycler:doit())
(if(<> cel theCel)
(self:draw())
    )
)
)
(method (lastCel)
return(- NumCels(self) 1)
)
)
" dcicon.sc
 Contains an extension of the DIcon class from controls.sc which allows
 animation."
Had a little go playing around with some of the code from there, i don't really know what it all means so not really getting far.

Offline MusicallyInspired

Re: Pic edit and animating inv item picture
« Reply #5 on: June 11, 2012, 01:54:56 AM »
I was given some code from troflip, I believe it was, on the old Mega-Tokyo boards for getting animated window icons to work for death windows and such things. It's in my KQ2SCI source. I'll share it as soon as I have time. It works, though.
Brass Lantern Prop Competition

Offline Collector

Re: Pic edit and animating inv item picture
« Reply #6 on: June 11, 2012, 04:32:03 AM »
Put it on the Wiki, too, please.
KQII Remake Pic

Offline totenmaske

Re: Pic edit and animating inv item picture
« Reply #7 on: June 13, 2012, 02:31:52 AM »
Cheers Music, I'll look forward to you getting some free time :)

Offline Doan Sephim

Re: Pic edit and animating inv item picture
« Reply #8 on: June 13, 2012, 11:08:31 AM »
Well, I spent some time with the code and I came up with a workable Print command with an animating icon! Something I had been wanting to do probably about 10 years ago lol!

But there is a small problem. The code isn't elegant and it kinda takes up some space. I believe there will be someone smarter who can do it better. But until Music gets back, this is what I did.
Code: [Select]
(instance testIcon of DCIcon
(properties)
(method (init)
(super:init())
(if(== gRoomNumberExit 540)
= cycler (End:new())
(send cycler:init(self))
)
)
)
I added this code to the room that you wanted the animation widow to be in. Because you are referencing DCIcon Script, you need to add (use "DCIcon") at the top of the script.

I also tried removing some of this code like
Code: [Select]
(if(== gRoomNumberExit 540) in hopes of streamlining it, but when that was gone, the animation looped only once.

Ok, after that is added in there are 2 more things to do:
I added this to the handleEvent Method:
Code: [Select]
(if(Said('test/window'))
Load(rsVIEW 905)
(testIcon:init()view(905))
            = message "What a wonderful day for a walk!"
            (if(Print(
                message
                #icon testIcon
                    )
                )
            )
        )
You will need to put (var message) after the (method (handleEvent pEvent) also, so that it doesn't go crazy trying to compile an unknown variable.
Then when you type "test window" you will have an animating icon in your window! But with one small problem.

If your view has any transparencies, the animations will overlay eachother. So each frame cannot have any transparency, so that each frame will overlay the last without anything showing through.

Try it out! It works for me and now I get to think of new things to do with this design space :)
« Last Edit: June 13, 2012, 11:15:47 AM by Doan Sephim »
Artificial Intelligence Competition

Offline totenmaske

Re: Pic edit and animating inv item picture
« Reply #9 on: June 14, 2012, 08:07:41 AM »
That's a nice little part you've made there Doan, works like a charm for said statements, I was playing around with it to try out different things (Thinking about using it for when you talk to people, just a face with a moving mouth as an icon).

While playing around with that, I've noticed that i can't enter my 5th room. Rooms 1-4 work flawlessly, but as soon as i hit the control to go to room 5, it just freezes my game with the stop cursor showing up. I've tried porting in with troflip debug code, and the same thing will happen. Do you think this is a memory problem or I've just made a boob of my rm005 setup code?

Edit - I took everything out of the rm5 start up code, apart from everything actually needed and entered from room 4 via the control I've got setup, the room loaded, but it loaded very slowly.

Haven't had time to have a look into it just yet, I've been swamped with work and other things.
« Last Edit: June 14, 2012, 08:37:33 AM by totenmaske »

Offline Doan Sephim

Re: Pic edit and animating inv item picture
« Reply #10 on: June 14, 2012, 08:51:23 AM »
I took a walk around my room and it had no problems with any control lines.

If you post the code, I think I or someone else may be able to discover the problem

Offline totenmaske

Re: Pic edit and animating inv item picture
« Reply #11 on: June 14, 2012, 10:02:38 PM »
This problem occurred before i started playing with your code, i believe, as i  put that in room one, so it should have no effect on this.
Here is room 4 - the room where i can't exit from....
Code: [Select]
/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 4)
/******************************************************************************/
(use "Controls")
(use "Cycle")
(use "Door")
(use "Feature")
(use "Game")
(use "Inv")
(use "Main")
(use "Obj")
/******************************************************************************/
(local
lDoor = 0 //0=closed, 1= open
)
(instance public rm004 of Rm
(properties
picture scriptNumber
north 0
east 0
south 0
west 0
)
(method (init)
(super:init())
(self:setScript(RoomScript))
(if(== gPreviousRoomNumber 3)
(aDoor:init()setCycle(Beg)))(else(aDoor:init()cel(0)))
(aTable:init())
(aChair1:init())
(aChair2:init())
(aPlant1:init())
(aPlant2:init())
(switch(gPreviousRoomNumber)
  (case 3  (send gEgo:view((send gEgo:view))loop((send gEgo:loop))posn(120 53)init()))
  (case 5  (send gEgo:view((send gEgo:view))loop((send gEgo:loop))posn(216 156)init()))
)
(if(== gNaked TRUE)SetUpEgo()(send gEgo: init() view(015))
)(else
(if(== gSuit TRUE)SetUpEgo()(send gEgo: init() view(000))
)(else
SetUpEgo()(send gEgo: init() view(232))
)
)
)
)
/******************************************************************************/
(instance RoomScript of Script
  (properties)
    (method (doit)
    (if(& (send gEgo:onControl()) ctlGREEN)
      (send gRoom:newRoom(5))
)
    (if(== lDoor 1)
    (if(& (send gEgo:onControl()) ctlMAROON)
      (send gRoom:newRoom(3))
    )
)
)
(method (handleEvent pEvent)
(super:handleEvent(pEvent)
)
  (if (Said('eat'))
  Print(004 011)
  )
    (if (Said('sit / down'))
  Print(004 012)
  )
(if (Said('(look<at) , look>'))
(if (Said('/chair'))Print(004 010))
(if (Said('/plant'))Print(004 009))
(if (Said('/table'))Print(004 008))
(if (Said('/bench'))Print(004 006))
(if (Said('/kitchen'))Print(004 006))
(if (Said('[/!*]'))Print(004 005))
(if (Said('/*'))Print(004 004))
)
(if (Said('take, get >'))
(if (Said('/hint, help')) = gHint TRUE)
(if (Said('[/!*]'))Print(004 014))
(if (Said('/*'))Print(004 015))
)
(if (Said('open,pull >'))
(if (Said('/ door'))(if(== lDoor 0)(if(< (send gEgo:distanceTo(aDoor)) 20)(aDoor:init()setCycle(End)(++ lDoor)))(else Print(004 000)))(else Print( 004 003 )))
(if (Said('[/!*]'))Print(004 016))
(if (Said('/*'))Print(004 017))
)
(if (Said('close, shut >'))
    (if (Said('/ door'))(if(== lDoor 1)(if(< (send gEgo:distanceTo(aDoor)) 20)(aDoor:init()setCycle(Beg)(-- lDoor)))(else Print(004 001)))(else Print( 004 002 )))
(if (Said('[/!*]'))Print(004 018))
(if (Said('/*'))Print(004 019))
)
(if (Said('find / [ /* , !* ]'))
  Print(004 013)
)
)
)
/******************************************************************************/
(instance aDoor of Prop
  (properties
    y 49
    x 120
    view 4
    cel 2
  )
)
(instance aPlant1 of Prop
  (properties
    y 59
    x 85
    view 12
    loop 2
  )
)
(instance aPlant2 of Prop
  (properties
    y 59
    x 156
    view 12
    loop 2
  )
)
(instance aTable of Prop
  (properties
    y 144
    x 125
    view 9
 )
)
(instance aChair1 of Prop
  (properties
    y 144
    x 90
    view 9
    loop 1
    cel 0
  )
)
(instance aChair2 of Prop
  (properties
    y 144
    x 160
    view 9
    loop 1
    cel 2
  )
)

and room 5 - the one i can't enter because of the game freezing up
Code: [Select]
/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 5)
/******************************************************************************/
(use "Controls")
(use "Cycle")
(use "Door")
(use "Feature")
(use "Game")
(use "Inv")
(use "Main")
(use "Obj")
/******************************************************************************/
(local
lDoor = 0 // rm004
lDoor1 = 0 //rm006
)
(instance public rm005 of Rm
(properties
picture scriptNumber
north 0
east 0
south 0
west 0
)
(method (init)
(super:init())
(self:setScript(RoomScript)
)
(if(== gPreviousRoomNumber 4)
(aDoor:init()cel(2)setCycle(Beg)))(else(aDoor:init()cel(0)))
(if(== gPreviousRoomNumber 6)
(aDoor1:init()cel(2)setCycle(Beg)))(else(aDoor1:init()cel(0)))
(atable:init())
  (switch(gPreviousRoomNumber)
  (case 4  (send gEgo:view((send gEgo:view))loop((send gEgo:loop))posn(49 51)init()))
  (case 6  (send gEgo:view((send gEgo:view))loop((send gEgo:loop))posn(247 51)init()))
)
(if(== gNaked TRUE)SetUpEgo()(send gEgo: init() view(015))
)(else
(if(== gSuit TRUE)SetUpEgo()(send gEgo: init() view(000))
)(else
SetUpEgo()(send gEgo: init() view(232))
)
)
)
)
/******************************************************************************/
(instance RoomScript of Script
(properties)
     (method (doit)
(super:doit())
    (if(== lDoor 1)
    (if(& (send gEgo:onControl()) ctlMAROON)
      (send gRoom:newRoom(4))
    )
)
(if(== lDoor1 1)
(if(& (send gEgo:onControl()) ctlNAVY)
      (send gRoom:newRoom(6))
)
)
)
(method (handleEvent pEvent)
(super:handleEvent(pEvent)
)
  (if (Said('look, (look<at), (look<in) >'))
(if (Said('[/!*]'))Print(005 000))
(if (Said('/*'))Print(005 001))
)
(if (Said('take, get >'))
(if (Said('/hint, help')) = gHint TRUE)
(if (Said('[/!*]'))Print(005 002))
(if (Said('/*'))Print(005 003))
)
(if (Said('open,pull >'))
  (if (Said('/ door'))(if (< (send gEgo:distanceTo(aDoor)) 20)(aDoor:init()setCycle(End)(++ lDoor)))(else(if(< (send gEgo:distanceTo(aDoor1)) 20)(aDoor1:init()setCycle(End)(++ lDoor1)))(else Print(003 000))))
(if (Said('[/!*]'))Print(005 004))
(if (Said('/*'))Print(005 005))
)
(if (Said('close, shut >'))
(if (Said('/ door'))Print(005 006))
(if (Said('[/!*]'))Print(005 007))
(if (Said('/*'))Print(005 008))
)
(if (Said('find / [ /* , !* ]'))
  Print(005 009)
)
)
)
/******************************************************************************/
(instance aDoor of Prop
  (properties
    y 49
    x 50
    view 4
  )
)
(instance aDoor1 of Prop
  (properties
    y 49
    x 247
    view 4
  )
)
(instance atable of Prop
  (properties
    y 58
    x 144
    view 10
    loop 1
    cel 1
  )
)

I condensed most of the script so i could keep track of things a bit better.

Offline Doan Sephim

Re: Pic edit and animating inv item picture
« Reply #12 on: June 15, 2012, 07:29:50 AM »
It looks to me like you forgot the (super:doit()) after your doit method begins. This may be causing the problem

Offline MusicallyInspired

Re: Pic edit and animating inv item picture
« Reply #13 on: June 15, 2012, 08:42:47 AM »
It seems my memory was faulty. The animated icons were only for my death window, and that works out of the box. I haven't ever tried with inventory items I guess. Sorry about that.
Brass Lantern Prop Competition

Offline totenmaske

Re: Pic edit and animating inv item picture
« Reply #14 on: June 16, 2012, 12:01:22 AM »
No worries Music, i'll play with the code Doan gave me and maybe it can be adapted.
And Doan i added the (super:doit()) but still no change, it didn't seem to fix anything.


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.025 seconds with 16 queries.