RGSS scripting dissections and explinations
#34
(09-09-2017, 06:20 AM)Siletrea Wrote: wow there is alot of stuff in this manual!

ok been poking around the RPGXP manual and theres a few things that aren't compleatly clear so if you guys don't mind I'm gonna post them here

Pseudo Variables

self

The current method's execution constituent.
nil
The only instance of the NilClass class. Signifies NIL.

apparently Pseudo variables can't be changed...so they're like CONSTANTS?
afraid this doesn't make much sense to me...can someone clarify this a tad more?

Numeric Literals
123 0d123

integer
-123
integer (signed)
123.45
floating point number

Floating point numbers beginning with a decimal point, like .1, are not allowed. They must be written with a leading zero (0.1).
1.2e-3
floating point number
0xffff
hexadecimal integer
0b1011
binary integer
0377 0o377
octal integer

Numeric literals can contain an underscore. The Ruby interpreter simply ignores these underscores and does not interpret them in a special way. This can be useful as a thousands separator for large values. However, placing an underscore before and after a literal or connecting literals with an underscore will result in an error.
1_000_000_000 # => 1000000000
0xffff_ffff # => 0xffffffff

String Literals
Example:
"this is a string expression\n"
'this is a string expression'

String expressions begin and end with double or single quote marks.
Double-quoted string expressions are subject to backslash notation and expression substitution. Single-quoted strings are not (except for \' and \\).
String literals with white space on either side are treated as a single string literal.
p "foo" "bar" # => "foobar"

Backslash Notation
\t
tab (0x09)
\n
newline (0x0a)
\r
carriage return (0x0d)
\f
form feed (0x0c)
\s
whitespace (0x20)
\nnn
character at octal value nnn (n = 0-7)
\xnn
character at hexadecimal value nn (n = 0-9, a-f)

Expression Substitution
In double-quoted strings and regular expressions, the form "#{expression}" can be extended to the (string of the) contents of that expression. If the expressions are variables beginning with either $ or @, the surrounding braces may be omitted and the variable can be expressed as a #variable. The character # is interpreted literally if it is not followed by the characters {, $, or @. To explicitly prevent expression substitution, place a backslash in front of the #.
$ruby = "RUBY"
p "my name is #{$ruby}" # => "my name is RUBY"
p 'my name is #{$ruby}' # => "my name is #{$ruby}"


yeah there's alot of good information here but it doesn't make to much sense...are these used very often in scripting?
[Image: SP1-Writer.png]
[Image: 55e3faa432d9efb86b8f19a6f25c0126-dawz35x.png]

new logo for Yesteryear created by Lunarberry!
Reply }


Messages In This Thread
RE: RGSS scripting dissections and explinations - by Siletrea - 09-09-2017, 07:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Help iwth script (RGSS Player crash) Whisper 3 8,530 06-17-2017, 05:03 PM
Last Post: Whisper
  How can I use the cmd of "require" in rgss superegp 2 5,915 11-03-2015, 06:16 AM
Last Post: kyonides
   Scripting in VX vs VX Ace Miharu 5 9,090 02-21-2015, 10:10 AM
Last Post: Taylor
   Combat animations via scripting; How? ZeroSum 2 5,113 09-20-2013, 06:58 PM
Last Post: ZeroSum
Question  RGSS stoped to work Chaos17 5 7,747 02-14-2013, 05:13 PM
Last Post: DerVVulfman
   Ruby, RGSS & General Code Discussion Kain Nobel 6 10,885 12-22-2012, 05:11 AM
Last Post: MechanicalPen
   [Request] Tut. for RGSS Eldur 9 11,907 12-07-2012, 04:27 AM
Last Post: DerVVulfman
   [ASK-RGSS] Behemoth's CBS alike Getsuga_kawaii 0 4,228 04-29-2010, 03:07 PM
Last Post: Getsuga_kawaii
   Scripting I think spazfire 7 10,170 04-12-2010, 03:21 AM
Last Post: DerVVulfman
   Beginner Scripting Tuts? KDawg08 1 4,137 03-31-2010, 11:03 PM
Last Post: Hsia_Nu



Users browsing this thread: 20 Guest(s)