RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
I'm clueless...

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 88
...
This might sound extremely stupid, but I have two problems with some minor scripts of mine. First of all, everytime I try to change a global variable using the script event command, nothing happens. Say, if I want to disable a type of CMS, I make a method and enclose it in an if statement asking whether an already defined boolean (CMS_ENABLED?) is true. Now, the script is fine, that I know, but when I use a script from an event in the game saying

Code: [Select]
CMS_ENABLED? = false

the switch doesn't change, apparently, because the CBS is still enabled. Note that this is a rhetorical situation, I have no idea why anyone would want to disable the entire CMS.

Secondly, what's the problem with this code? I placed it above Main, it makes some changes with the message class. Every time I run it, it keeps interpreting * or + as an undefined method. Am I doing anything right at all?

Code: [Select]
#----------------------------------------------------------------------------
# Message Adjustment
#----------------------------------------------------------------------------
# Making the message window dynamically adjustable according to the text
#----------------------------------------------------------------------------

class Window_Message < Window_Selectable
  def initialize
    @mes_width = (@row_max * 32) + 50
    @mes_height = (@column_max * 32) + 50
    @mes_x = 80 - mes_width / 2
    @mes_y = 304 - mes_height / 2
    super(@mes_x, @mes_y, @mes_width, @mes_height)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.visible = false
    self.z = 9998
    @fade_in = false
    @fade_out = false
    @contents_showing = false
    @cursor_width = 0
    self.active = false
    self.index = -1
  end
end
...

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
Why are on earth are you putting a local variable in your call script command? Just kidding! What you just posted is called a local variable.
Code: [Select]
CMS_ENABLED? = false
It is contained and used only within the method it is declared in. If you declared "foobar = 0" in method "initialize", you could use "foobar" in the method you declared it in but if you were to try and use "foobar" in the method "main", it would flag it as an error unless you were to declare another local variable called "foobar"


Code: [Select]
@CMS_ENABLED? = false
This piece is called an instance variable. They are usable throughout the entire class so be careful when using these to check true/false or what not.

Code: [Select]
$CMS_ENABLED? = false
THIS is a global variable. As the name global would suggest, these are usable and callable throughout ANY script you have. I've only used these once and that was in a small item window script I made for personal use.

If you feel insulted by my explanations, I apologize for I only wanted to clear up any misunderstandings you may have had over the types of variables.

On your message script, it seems to be flagging @row_max as an containing nil. What is the exact purpose of your Message_Window script?

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
Heh, it's not local, it's a constant. Constants start with a capital letter and can't be changed during the execution.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
 :-[ oooh... *crawls off into a corner*  ;9

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
And basically the ? at the end doesn't work with variables. =/
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
*speaks from corner* That's true. I found that out when messing around with Input method check thingies. All the ? does is work as a check if a thing is true or false or so I believe.

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
It works for methods, i.e. "def have_some_money?"
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
Hmmm...strange. Regardless, any idea what's causing Pyroken's Window_Message modification to toss an error? I really hate quoting myself but...I'm clueless like Pyroken as to why it's throwing an error when @row_max IS defined in Window_Selectable. Perhaps the method was simply misused?
Quote
On your message script, it seems to be flagging @row_max as an containing nil. What is the exact purpose of your Message_Window script?/

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
There is no @row_max in Window_Selectable. row_max is a method. Use self.row_max instead.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

***
Rep:
Level 88
...
Quote
It is contained and used only within the method it is declared in. If you declared "foobar = 0" in method "initialize", you could use "foobar" in the method you declared it in but if you were to try and use "foobar" in the method "main", it would flag it as an error unless you were to declare another local variable called "foobar"

Really? I thought variables with nothing before them were global variables. I'll try that...

Actually, I wasn't using a variable for that, I wanted a boolean, like a switch in eventing. But I see what you mean.

Quote
1) On your message script, it seems to be flagging @row_max as an containing nil. 2) What is the exact purpose of your Message_Window script?

1) I had no idea it was doing that, either. o.O

2) This script is supposed to adjust the dimensions of the message window depending on the contents. Like if there's only word in the box, it would resize the message box to fit in only that word with no excess space.

Quote
There is no @row_max in Window_Selectable. row_max is a method. Use self.row_max instead.

I tried that, but now it starts thinking the "+" in Line 44 of Window_Selectable (row_max, essentially) is a method. Weird.
...

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
I'd say use all like in a usualy window, then just add self.width = self.contents.width + 32 and self.height = self.contents.height + 32
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

***
Rep:
Level 88
...
But self.contents.width and height aren't synonimous with row_max and column_max. They're only the dimensions of the contents which are modeled off the dimensions of the window, which aren't dynamic. I tried it out; that's how I figured it out.

Man!
...