 |
TGH Beginner
Joined: 22 Nov 2025 Posts: 20
|
Posted: Mon Mar 30, 2026 9:08 am
Adding path to variable |
What am I doing wrong that I cannot get a variable path added to a local variable?
| Code: |
// fmob $MOB $area
// Find a MOB in an area. If no area given use current area.
#LOCAL $zone
$MOB=%1
#SWITCH (%numparam())
(0) {
#WIN MobLocation "MOB is mandatory."
#WIN MobLocation " "
#WIN MobLocation "USAGE: fmob MOB [zone]"
#WIN MobLocation "Current zone used if not specified."
#EXIT
}
(1) {
$zone=%gmcp.room.info.zone
}
(2) {
$zone=%2
}
$roomNums=%dbkeys(@MOBDB_VARS/$zone)
#FORALL $roomNums {
#IF (%isvalue(%i,$MOB)) {
#WIN MobLocation " "
#WIN MobLocation $MOB "is in room" %i
#EXIT
}
} |
I have tried
@MOBDB_VARS/$zone
@{MOBDB_VARS/$zone}
@MOBDB_VARS/{$zone}
@MOBDB_VARS/${zone}
%concat(classpath,"/",$zone)
but nothing produces a working result.
Any suggestions? |
|
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4799 Location: Pensacola, FL, USA
|
Posted: Tue Mar 31, 2026 10:28 pm |
Have you tested that any of your local variables have a value, much less the correct one, with #ECHO #SAY or #PRINT?
if $zone itself is null you will get a false negative result even with correct syntax. |
|
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4799 Location: Pensacola, FL, USA
|
Posted: Tue Mar 31, 2026 10:31 pm |
and try: %db(@mobdb_vars, $zone)
|
|
|
|
 |
TGH Beginner
Joined: 22 Nov 2025 Posts: 20
|
Posted: Thu Apr 02, 2026 6:38 pm |
MOBDB_VARS is a class note a variable and $zone will reference either current zone or a supplied zone.
Eg.
MOBDB_VARS/aardington
MOBDB_VARS/siege
each zone var will consist of room numbers (keys) and each room will have mobs I encountered (stringlist) |
|
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4799 Location: Pensacola, FL, USA
|
Posted: Tue Apr 07, 2026 1:49 pm |
Its not a matter of what the value should be.
In an ideal world things are always what they should be.
Testing is to verify that it is what it should be. |
|
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4799 Location: Pensacola, FL, USA
|
Posted: Tue Apr 07, 2026 1:52 pm |
as to the pathing issue, local variables dont have a path, they are stored in memory and only exisit within the code block they are called from, as soon as the relevant } is parsed, they are thrown away.
so trying to use a path at all is improper |
|
|
|
 |
TGH Beginner
Joined: 22 Nov 2025 Posts: 20
|
Posted: Thu Apr 23, 2026 7:07 pm |
Maybe you got it wrong as I may have worded it badly.
I have a variable ($zone) made from %gmcp.room.info.zone which I want to add to the classpath zoneX to make zoneX/$zone. Then search each dbvar in the classpath (zoneX/$zone/dbvar) to locate a mob value in one of the vars. |
|
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4799 Location: Pensacola, FL, USA
|
Posted: Sun Apr 26, 2026 5:19 pm |
If it is a standalone variable, then your issue is syntax
$ = local variable, required for referencing and declaring
@ = normal variable, only used to reference, not to define
to define it in a zone you can do:
#VAR zone {%gmcp.room.info.zone} {} {zoneX}
then you can reference it with: @zoneX/zone |
|
|
|
 |
TGH Beginner
Joined: 22 Nov 2025 Posts: 20
|
Posted: Sun Jun 28, 2026 6:07 am |
Again, you have it wrong. You keep coming back to @var.
I have a class
MAPPING
and a sub-class
MOBDB/MOBDB_VARS/
and in this class are other classes, each relates to a specific area. Eg.,
MOBDB/MOBDB_VARS/dunes
MOBDB/MOBDB_VARS/kingholm
MOBDB/MOBDB_VARS/ruins
and in these 'area' classes are dbvars. The identifying key of the vars is the gmcp room number (473, 21553, 54022, etc). The VALUE of each var are the short names of every mob I have found in the room. If I do a bi-hourly quest, the data is delivered (gmcp) as TARGET, AREA, ROOM. Using a search for mob using these MOBDB_VARS/area/room vars I can then search the mapper for the correct description for the room number.
If I am using the AREA (zone) data to narrow the search I can use MOBDB_VARS/$area where area is the gmcp data and thus I want to add the ACTUAL area keyword onto the end of MOBDB_VARS/ WITHOUT HAVING TO SEARCH every zone/area and every var to figure out which room number matches to the given room description.
Does it make sense NOW? I am not sure I am able to make it any plainer. |
|
|
|
 |
|
|
|