Noob Coding symbol question..

Need help running MacroQuest2? Ask your questions about how to get things to work on your computer.

Moderator: MacroQuest Developers

gohan4
a ghoul
a ghoul
Posts: 85
Joined: Sat Dec 18, 2004 11:36 am

Noob Coding symbol question..

Post by gohan4 » Thu Jan 13, 2005 12:17 pm

Just curious...My question is, what do the the Dollar signs and the various other symbols mean in the coding? I have read the manual and alot of the other information and I know nothing about coding, I even did a search on the internet about programming lingo definitions but I can't find anything. The manual just explains how to use them and is pretty vague, it does tell what slashes and some of the others are, but not dollar signs.

Thanks

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Thu Jan 13, 2005 12:25 pm

In my limited understanding, the $ followed by { basically denotes the beginning of an object, like

Code: Select all

${Me.Dumbass}
A { all by itself, on the other hand, denotes that the next line below this statement is a continuation of the same line essentially, example:

Code: Select all

/if (${Me.Dumbass}) {
/kill myself
}
After completing an if statement, always remember to end it with a }
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Thu Jan 13, 2005 1:29 pm

The $ in programming is often, especially here, used to define a "string" for a parameter within the code. Basically, anything that you use to take data in or put data out that is not a numerical function (meaning used for math) is a string.

The example given by A_Druid_00 of ${Me.Dumbass} is a string. The full string is defined by the boundries of the { and } signs.

Oh, and you always MUST keep track of all nesting done, because for each time you open a bracket [ or { you MUST close it as well with its match. If you fail to have an equal number of opening and closing brackets of the same kind you will run into many problems.

I hope this helps.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

cronic
a grimling bloodguard
a grimling bloodguard
Posts: 536
Joined: Wed Nov 26, 2003 11:01 pm

Post by cronic » Thu Jan 13, 2005 2:43 pm

I would have never expected responses like that from any of you people.

Cheers.

cronic

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Thu Jan 13, 2005 3:44 pm

Well, it wasn't the typical "flame me" post, so why not give him good answers? He wanted to understand something that is not really explained well so I gave him the answer as best I remember it from back when I was first learning DOS basic programing in highschool on a TSR-80(black and white) in 1983.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Thu Jan 13, 2005 3:56 pm

Monochrome 4 life
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

Zeus
a hill giant
a hill giant
Posts: 180
Joined: Wed Feb 19, 2003 10:03 am
Contact:

Post by Zeus » Thu Jan 13, 2005 5:34 pm

The dollar sign tells the interpreter that inside the next bracket there's going to be a variable. The parser in turn looks for that variable on the list and returns the value of it to do whatever you want with it.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Thu Jan 13, 2005 7:51 pm

And that variable is referred to as a "string" because it can be any string of letters and numbers used to define it.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Thu Jan 13, 2005 8:02 pm

Isn't it an Object.... a string is a type of object, as is an integer and timer. Variables are just /declared objects. But what the hell do I know, I've never even taken a programming class, I'm self taught.

Dictionary.com says:
object
<object-oriented> In object-oriented programming, an
instance of the data structure and behaviour defined by the
object's class. Each object has its own values for the
instance variables of its class and can respond to the
methods defined by its class.
string
<programming> A sequence of data values, usually bytes,
which usually stand for characters (a "character string").
The mapping between values and characters is determined by
the character set which is itself specified implcitly or
explicitly by the environment in which the string is being
interpreted.
Variable
<programming> (Sometimes "var" /veir/ or /var/) A named memory
location in which a program can store intermediate results and
from which it can read it them. Each programming language
has different rules about how variables can be named, typed,
and used. Typically, a value is "assigned" to a variable in
an assignment statement. The value is obtained by
evaluating an expression and then stored in the variable. For
example, the assignment
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

Zeus
a hill giant
a hill giant
Posts: 180
Joined: Wed Feb 19, 2003 10:03 am
Contact:

Post by Zeus » Sat Jan 15, 2005 12:52 am

Yes it's a "string" of values, problem is that in programming lingo a string stands for a sequence of alpha numeric characters. You can't do a mathematical operation on the contents of a sting even if they are numbers without telling the compiler to change it to numerical values first (ASCII Table is a good place to visualize the different between numerical and alphanumerical characters and why they aren't interchangeable) Deep down in a compiler parser what it does is look the address in memory of that variable and it returns it to you.

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Sat Jan 15, 2005 7:45 am

I love it when people try to explain technical terminology, but their grasp of the meta-language is so poor that matters become even more cloudy.

The things that do stuff to make it such that things of such-and-such a nature do the things that those things do when substituted for those other things are called "pronouns". Learn to use them, please.

gohan4
a ghoul
a ghoul
Posts: 85
Joined: Sat Dec 18, 2004 11:36 am

Post by gohan4 » Mon Jan 17, 2005 11:33 am

Thanks for the responses