Script Editor won't accept Code cause "Illegal Syntax"

Non-platform specific questions.

Re: Script Editor won't accept Code cause "Illegal Syntax"

Postby speckford123 » Mon Jun 01, 2015 5:13 pm

Oh yeah, I didn't even notice the period at first glance when I looked at the original post, haha
Glad it's all sorted out
speckford123
 
Posts: 334
Joined: Fri May 05, 2006 6:33 pm
Score: 49 Give a positive score

Re: Script Editor won't accept Code cause "Illegal Syntax"

Postby bat78 » Wed Jul 29, 2015 1:41 am

For the sake of argument CONSTANT refers to either a
  • character literal 'a'
  • double literal 0.05
  • float literal 0.05F
  • integer literal 360
  • long integer literal 360L
  • string literal "Hello World"
i.e values passed directly, in read-only way.
____________________________________________________________________________________________________________________________________________
Variables are something slightly different as they store the value in read/write memory, which means they can be changed/accessed at some point(s) through their name identifier.
A variable value cannot be changed generally if the variable is declared with the const type qualifier (which makes it a constant variable) or passed as a function argument.
____________________________________________________________________________________________________________________________________________
Code: Select all
xvelocity = 40.0;

In that case, xvelocity is a variable type double and we change it (by assigning) to contain 40.0 which is passed as a double literal.
____________________________________________________________________________________________________________________________________________
A MACRO is what actually can be identified (adhering the syntactic standards) by its capitalized name identifier
a MACRO is a textual replacement of code
Code: Select all
#define XVEL xvelocity

Will define XVEL to be used as if xvelocity is used instead.
Code: Select all
#define XVEL_IS_40 xvelocity = 40.0

Can be used like that
Code: Select all
XVEL_IS_40;

instead of:
Code: Select all
xvelocity = 40.0;

Although I would prefer a MACRO function for such preemption (but that will go again way too far)
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron