A couple of development / style questions...

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

User avatar
DeathSpiral
a ghoul
a ghoul
Posts: 95
Joined: Thu Aug 22, 2002 6:31 pm

A couple of development / style questions...

Post by DeathSpiral » Mon Aug 26, 2002 4:34 am

Howdy all-
I'm new here, did a bit of searching and havn't come up with what I'm looking for. Just a couple questions about MQ# (as I saw someone call it) and, for lack of a better term, 'style'...

First off, is there any upper limit on the number of variables, timers, or arrays that you can have? 1 byte unsigned int (255), 2 bytes unsigned int (short int) (65,535)?

Next off, is there any functionality available that can tell me how many items are in an array? IE, we set a(0,0), a(0,1), and a(0,2) - any way to determine that a(0) has 3 items in it?

Also... any functionality similar to a regular expression, or anything I can do character swapping with in a string?

It doesn't look like it right now, but are there any plans to support &&'s and ||'s in /if checks? And nested? /if (("$char(name)"~~"$p0") && ("somestring"~~"$p1")) ?

Also, on 'style'... are there any 'preferred' ranges for variables? IE, variables that should always be function-local v90-v99, money related v50-v59, etc? There seems to be some commonality between scripts, but I havn't seen anything clearly defined... Granted, that would be required to be adhered to, but would make portability a little better (imho, atleast...)

Well, thanks in advance. =) Looking forward to 'working' with you. =)

S_B_R
a lesser mummy
a lesser mummy
Posts: 72
Joined: Tue Jul 30, 2002 11:12 am

Post by S_B_R » Mon Aug 26, 2002 10:18 am

I was just thinking about requesting && and || aswell. They would be So helpful. :mrgreen:
[b]dd if=/dev/zero of=/dev/hda[/b]

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Mon Aug 26, 2002 11:52 am

Salutations,
for v#,p# and a(_,#) the hashes have a limit of 100. The underscore also has a limit of 100 (for both of them it is 0-99). the p# limit can be changed with

Code: Select all

#define MAX_MACROVARS 100
(this is the default) and the v# limit can be changed with

Code: Select all

#define MAX_STACKVARS 100
. Don't know about array support, but if you do this:

Code: Select all

/varset v0 0
:loop
  /if "$a(0,$v0)"!="" {
    /varadd v0
    /goto :loop
  } else /if n $v0==0 {
     /varset v0 -1 
  }
v0 should come out as the number of thingies in the set (-1 if there is nothing in it)[/code]

powerspike
a ghoul
a ghoul
Posts: 80
Joined: Sun Aug 11, 2002 11:40 pm
Location: Australia
Contact:

Post by powerspike » Mon Aug 26, 2002 9:21 pm

OoO thanks for that liz it should help abit

and it looks like you went a bit to [/code] happy as well ;)
One for the Road guys, what's the worst that could happen......

LOADING, PLEASE WAIT ....

User avatar
DeathSpiral
a ghoul
a ghoul
Posts: 95
Joined: Thu Aug 22, 2002 6:31 pm

Post by DeathSpiral » Tue Aug 27, 2002 7:26 pm

L124RD wrote: for v#,p# and a(_,#) the hashes have a limit of 100. The underscore also has a limit of 100 (for both of them it is 0-99). the p# limit can be changed with

Code: Select all

#define MAX_MACROVARS 100
(this is the default) and the v# limit can be changed with

Code: Select all

#define MAX_STACKVARS 100
.
Testing has shown that in the default copy downloaded, the upper limit for p# variables is 5... *goes to grab the source, make some changes, and recompile...*