Question an inconsistancy?

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

Zxeses
a ghoul
a ghoul
Posts: 103
Joined: Tue Jan 07, 2003 4:17 pm

Question an inconsistancy?

Post by Zxeses » Fri Oct 03, 2003 4:55 pm

Code: Select all

  /declare counter global
  /varadd counter 1 
  /echo @counter 
Why does setting and declaring a variable not require the variable signifier, but extracting from the variable does?

wouldnt the following be more consistant:

Code: Select all

  /declare @counter global
  /varadd @counter 1 
  /echo @counter 
Also, why are we using "@" instead of "$" (?)


-Zx

Plazmic
The One
The One
Posts: 800
Joined: Fri Jun 14, 2002 12:31 am
Contact:

Post by Plazmic » Fri Oct 03, 2003 6:09 pm

The @ is to retrieve the value in the variable
@ as opposed to $ to differenciate user variables from the "EQ variables"
- Plazmic

Zxeses
a ghoul
a ghoul
Posts: 103
Joined: Tue Jan 07, 2003 4:17 pm

Post by Zxeses » Fri Oct 03, 2003 6:19 pm

I know that @ is the signifier to get data, why isnt it used consistantly like, say, perl or basic, where in every place you have used that variable you use the signifier?


my $perlvar;
++$perlvar;
$perlvar = $this + $that;


I'm pointing this out now in an effort to have it changed now, while these major revisions are happening. Its a lot easier to read and understand when every time you use @myvar, its always @myvar and not sometimes just 'myvar'..

User avatar
Curious
a ghoul
a ghoul
Posts: 88
Joined: Wed Aug 27, 2003 5:19 am

Post by Curious » Mon Oct 06, 2003 4:25 am

I'll have to second Zxeses ... I can't count the number of times I've typed /varadd $counter 1 and then spent quite some time trying to figure out what's wrong with my script! Or, even worse, is when I finally get use to /varset, and type something like /if n counter==10

Plazmic
The One
The One
Posts: 800
Joined: Fri Jun 14, 2002 12:31 am
Contact:

Post by Plazmic » Mon Oct 06, 2003 10:49 am

I really don't want to rewrite the entire basis of the parser right now:
1. receive /command
2. run all params through PMP
3. call appropriate handler for /command

PMP dereferences any @VarName before any /command would see what the variable name was.

Pretend it's like a pointer dereference, without the "&" operator.
- Plazmic

fryfrog
a hill giant
a hill giant
Posts: 271
Joined: Fri Jun 20, 2003 5:37 am

Post by fryfrog » Wed Oct 08, 2003 7:38 am

speaking of the && operator... are we going to see anything like && and/or ||? :)

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Wed Oct 08, 2003 11:51 am

Personally, I like the @userdefined more than $userdefined exactly for the reason Plazmic said.

@ for user defined variables.
$ for reserved MQ variables
/ for EQ/MQ commands

Makes sense to me and not that much of a stretch to adjust.