Rikifive

Bringer of Happiness
Veteran
Joined
Jun 21, 2015
Messages
1,441
Reaction score
680
First Language
Polish
Primarily Uses
Other
Glad you found that script useful. ^^

It is possible, though it will be a little bit more difficult (less automatic).

I'm not sure, but try putting this here:

(...) ############################################################################## pic = Cache.picture("yourpicturefilename") rect = Rect.new(0,0,pic.width,pic.height) contents.blt(0,0,pic,rect,255) # ^ ^ # Set your X/Y position. # The picture will be taken from Pictures folder.#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■##■ END OF CUSTOMIZATION, Do not edit anything below, unless you know ■##■ what you're doing! ■##■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■# @playtime = $game_system.playtime end # Refresh (...)I'm not sure if it's a 'professional' way to achieve this, but it works.
 

devilbringer450

Villager
Member
Joined
Dec 6, 2015
Messages
6
Reaction score
2
First Language
English
Primarily Uses
OMG your awesome thanks it worked:) kinda been a learning experience here since i'm a nub at scripting just know a few basic things but been wondering the method for pic in script now i know thanks to you thanks again!! :)

Edit:

quick question:) how would i change the picture if a switch gets turned on? example: Default picture it shows pic #1 and if they get sick it turns on a switch and shows pic #2 sorry for all the questions but really appreciate it!

nevermind i figured it out:)

    if $game_switches[15]

      pic = Cache.picture("healthy")

      rect = Rect.new(0,0,pic.width,pic.height)

      contents.blt(0,0,pic,rect,255)

    else !$game_switches[15]

      pic = Cache.picture("sick")

      rect = Rect.new(0,0,pic.width,pic.height)

      contents.blt(0,0,pic,rect,255)

      end
 
Last edited by a moderator:

Rikifive

Bringer of Happiness
Veteran
Joined
Jun 21, 2015
Messages
1,441
Reaction score
680
First Language
Polish
Primarily Uses
Other
Glad could help! (=

~And yup, you got it perfectly! (=

Though I think you could do just this:

if $game_switches[15]  pic = Cache.picture("healthy") else   pic = Cache.picture("sick") end  rect = Rect.new(0,0,pic.width,pic.height)  contents.blt(0,0,pic,rect,255)

There's no any bigger difference, but it just looks neater, because the two last lines are the same, no matter on switch, so there's no need to separate them.

Good luck with development! ^^
 
Last edited by a moderator:

devilbringer450

Villager
Member
Joined
Dec 6, 2015
Messages
6
Reaction score
2
First Language
English
Primarily Uses
Sweet just rewrote it as you suggested:) was playing around with it some more but can't seem to get another option in there say i have 4 pics instead of 2

can you only have one if and else?
 

Rikifive

Bringer of Happiness
Veteran
Joined
Jun 21, 2015
Messages
1,441
Reaction score
680
First Language
Polish
Primarily Uses
Other
Yup, you cannot have more 'ifs' and 'else' in 'if', but there is something else you're looking for.

besides 'if' and 'else' you have also 'elsif'. (a combination of else and if - basically another 'if' in an 'if')

'if' - just opens the conditional - it asks if such a condition is met and if it's true - then reads the code inside until it hits other conditionals or just 'end'. - that's what you probably know, but now you have things between 'if' and 'end':

'else' - just sets what will happen if such a condition will not be met, for example:

if something do stuff and more stuffendif something is true, then it does the stuff inside to an end, otherwise, it's just skipped, but this:

if something do stuff and more stuffelse explode PCendwill do the stuff if something is true, but if not, it will do the stuff only from else to an end - which will explode your PC. ( ͡° ͜ʖ ͡°)

Okay, that's what you probably knew already, but now we have something called 'elsif':

if something do stuff and more stuffelsif something_else do other stuffelse explode PCendif something is true, then it does stuff, but if not, then second conditional appears, where it checks if something_else is true, if yes, then does other stuff and that's all, however if not, it does 'else' - where 'else' does not ask for anything, but just does the thing if conditionals above are false.

You don't have to use everything, just use what you need, for example:

if something do stuff and more stuffelsif something_else explode PCendif something is true, then do stuff and more stuff and it skips elsif part (your PC is safe) - the first condition was true, so it takes the priority, just like with 'else' - that is skipped, if condition above is true.

if something is false, then it checks the next one - elsif - is something_else true? If yes, explosion, if not, skip to next one ~ there's no more conditionals, it ends.

So, here we have the serious example on what for example you would like to achieve:

if $game_switches[15] pic = Cache.picture("sick") elsif $game_switches[16] pic = Cache.picture("poisoned") elsif $game_switches[17] pic = Cache.picture("tired") else pic = Cache.picture("healthy") end rect = ... con...so:

if only switch 15 is true - he'll be sick

if only switch 16 is true - he'll be poisoned

if switches 15 and 17 are true, he'll be sick, because the first one is true and it takes priority, like it not reads 'else', it also does not read 'elsif's.

if switches 16 and 17 are true, he'll be poisoned, because the first is false and it checks the next one, where it is true, so does the thing in it and ends here.

if all of the switches will be false, he'll be healthy, because none of the conditionals above were true, so it just does 'something else' then.

It can run only one conditional at once (either: 'if', 'elsif' or just 'else') or not at all if the condition is not met and there's no 'else' specified.

That's what you were asking for? (=

Hope it helps! ^^
 
Last edited by a moderator:

devilbringer450

Villager
Member
Joined
Dec 6, 2015
Messages
6
Reaction score
2
First Language
English
Primarily Uses
ah i see. Once again great explanation:) helped a ton an very detailed thank you thank you! been playing around with the options i now have thanks to you:) i have it set so that there is a main display pic an when a new status effect pops up it over lays on top of the default one.
 

Rikifive

Bringer of Happiness
Veteran
Joined
Jun 21, 2015
Messages
1,441
Reaction score
680
First Language
Polish
Primarily Uses
Other
Glad could help! ^^
 

Latest Threads

Latest Posts

Latest Profile Posts

just destroyed hours of work again. i don't know why I bother.
World Map for the inside of my main character's head. Every spot is an area that either occupies his thoughts or staples of everyone's "headspace"
How can I look up the components for a medieval bomb for my game without the FBI showing up at my door?
I don't think I can handle using the real SNES resolution of 512x448 because resizing absolutely every interface element I had on hand by painstaking trial & error/guess and check (is there any other way?) is KILLING me.

Forum statistics

Threads
108,992
Messages
1,041,105
Members
141,458
Latest member
EvieOverwrite
Top