Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
hpoonis2010
Apprentice


Joined: 18 Jun 2019
Posts: 188

PostPosted: Sat Mar 13, 2021 8:26 pm   

Variable variables
 
I am trying this

alias 'find'

itemtype fromlvl tolvl worn

Egf.

find armor 5 17 neck

Thus %1 and %4 are variable. I have been trying variations all evening and I cannot find the method.

I want to search a dbvar based on %1 (type being (eg) armor, potion, treasure, etc). I cannot make anything use the %1 as a dbvar name.

$itemkeys=%dbkeys(@DBVar/%1)
$itemkeys=%dbkeys(@{DBVar/%1})
$itemkeys=%dbkeys(@DBVar/{%1})

so that I am actually reading from (eg) @DB_Var/potion, or @DB_Var/weapon

I have tried all manner of delimiters and variations but I must me missing the obvious.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4348
Location: Pensacola, FL, USA

PostPosted: Sun Mar 14, 2021 2:00 pm   
 
%db(@dbvar, %1)
_________________
Discord: Shalimar#3679
Reply with quote
hpoonis2010
Apprentice


Joined: 18 Jun 2019
Posts: 188

PostPosted: Sun Mar 14, 2021 4:41 pm   
 
Yes, but maybe I didn't write it well enough.

File names match item type (armor, potion, treasure, etc)

Thus, if @dbvar=potion (DBVar/potion), %db(@dbvar, %1) is going to try to net me %db(@potion,potion) when I am actually after %db(@potion,<some potion.key>).

Thanks anyway. I slept on it and figured out that @{%1} or @{$var} works...although I cannot get @{DBVar/%1} or @DBVar/{%1}, or any other combination of @class/var working.
Reply with quote
hpoonis2010
Apprentice


Joined: 18 Jun 2019
Posts: 188

PostPosted: Sun Mar 14, 2021 11:37 pm   
 
But here's a question...it might test your skills.

I have a portal table (sample below)
Code:
immhomes="level=1|portExit=543|zone=Immortal Homes|portalItemID=2178928380"
legend="level=10|portExit=42|zone=Land of Legend|portalItemID=2170257837"
petstore="level=10|portExit=4787|zone=Giant's Pet Store|portalItemID=2170229212"
academy="level=1|portExit=319|zone=Aylorian Academy|portalItemID=2136610473"


I want to make aliases and vars for each item. So I have an alias to make aliases and one to make vars. Currently I have to manually add var data as I cannot figure out how to decipher the documentation.

But my make_aliases looks like

Code:
$portList=%dbkeys(@portalTbl)

#FORALL $portlist {
  #ALIAS  %i {
    $portalItem=@
    $portbag=aardbag4
    get $portalItem $portbag
    wear $portalItem
    enter
    dress portal
    put $portalItem $portbag
    } Portal_Aliases
  }


So I want to replace "$portalItem=@" with something that will take the value of @aardZoneTbl.%i.portalItemID ... where %i exists here it is supposed to create the target alias with the value from the table.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4348
Location: Pensacola, FL, USA

PostPosted: Mon Mar 15, 2021 8:34 pm   
 
Perhaps I am missing the point, but why do you want the clutter of giving them all separate aliases and variables?

If all the aliases more or less do the same thing it seems easier to just have one master alias and pass it the relevant material (if not just make all the data keyed into the master variable).

Also, if you use unique variable names there is no need to deal with the @class/variable syntax that is giving you trouble.
Just got straight after @var and leave the class out of it.
_________________
Discord: Shalimar#3679
Reply with quote
hpoonis2010
Apprentice


Joined: 18 Jun 2019
Posts: 188

PostPosted: Mon Mar 15, 2021 8:59 pm   
 
Mapper 'portals' seem to use the portal name as a command. If there is no mud equivalent then it is just meaningless spam and you end up walking anywhere. Thus, it seems a command must exist for each portal to function. So, if I click a room or enter a speedwalk, the mapper will use portals if it knows how to activate them. Command=alias. I do not manually use the alias, the mapper seems to pick it up when it tries to use a mapper portal.

For each aardwolf portal, there is a portal item. You hold the item and enter the portal. If the mapper just spazzes off expecting you to magically zip to that room it will be disappointed.

So, alias = (eg.,) academy

get academy (name of item) from container
hold academy
enter
remove academy

Does this make sense? Before I had made a command alias equal to the mapper portal name, mapper portals were useless. Under my old session I had speedwalk aliases and used those. Now, I am trying to automate as much of this as possible by using the aardwolf zone keywords, supplied by interogating aardwolf. From this data I can get zone name. The mapper zone name = aardwolf zone name. Mapper portal name = aardwolf zone keyword.

Otherwise I have to manually write out 70-80 different commands for all the portals. I can also use the same keyword as the zone 'start room'. So using

#WALK <zone keyword>
mapper portal = zone keyword
portalitem = zone keyword, value = portal item ID # (10-digits)

achieves the best solution as it makes everything fall under one keyword. Also,because of the processing lag I experienced with data capture, I am not convinced that doing lookups on portals will result in the map locating the character with any inherent lag.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4348
Location: Pensacola, FL, USA

PostPosted: Tue Mar 16, 2021 12:53 am   
 
Right, I get the concept of the alias, I just don't see why you need so many of them, one really should suffice.

#ALIAS usePortal {
$destination=%1
$record=%db(@portals, $destination)
$item=%db($record, item)
$container=%db($record, container)
get $item from $container
hold $item
enter
remove $item
put $item in $container
}

You don't even have to define the portals in the mapper if using a portal has text you can trigger off of, you can #TELEPORT %roomNum to move the #LOCATION marker.
_________________
Discord: Shalimar#3679
Reply with quote
hpoonis2010
Apprentice


Joined: 18 Jun 2019
Posts: 188

PostPosted: Tue Mar 16, 2021 9:34 am   
 
I see that but your solution is a manual process that does not include mapper's use of its own portals, which it will use to get a char from A-B. I saw no command issued when I did a walk and mapper used a #portal. So it seems that cmud's internal use of portals would have no use for a generic command if it (somehow) issues itself a 'if a portal exists then use it'.

If there is no equivalent actual command to send to the mud, the map may move but the char stays put. If I use a portal manually the mapper will locate the char but then I would still have to double-click a room, or issue a #walk %roomnum command which, if cmud mapper calculates a faster route, it may try to use a portal to fulfill the walk.

Example, I have been in a zone, dbl-click a room to walk to, cmud caluclated a faster route using a defined portal, and come at the walk from another (shorter) direction.

...leading me back to the point of how will it issue a command that directly references the cmud portal name. Thus, I need a command to map cmud portal use with actual mudportal use.

...and then back to my original question: how to substitute a variable inside an alias which makes other aliases using the variable data and not the variable itself.

If there is no solution then mine will have to suffice.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4348
Location: Pensacola, FL, USA

PostPosted: Tue Mar 16, 2021 1:33 pm   
 
#UNPORTAL

This is why I said there was no need to actually define the portals.
It's actually easier to stay on track if you don't make them (so the mapper doesn't know the shortcuts exist until you actively use it yourself) and just issue a #TELEPORT command when appropriate.

Unless you have the rare portal that CAN be used from anywhere at the drop of a hat.
_________________
Discord: Shalimar#3679
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4348
Location: Pensacola, FL, USA

PostPosted: Tue Mar 16, 2021 2:30 pm   
 
You could have the zone scripts define and undefine the portal commands so that they only ever exist in an area they can be used if you insist on using them.
Just remember that the mapper only calculates the path at the start of a given journey.
So to make use of the newly available command in speedwalking, you would need to finish one path and start another, in the appropriate zone.
_________________
Discord: Shalimar#3679
Reply with quote
hpoonis2010
Apprentice


Joined: 18 Jun 2019
Posts: 188

PostPosted: Wed Mar 17, 2021 9:13 am   
 
I still don't see it working.

If I had no CMUD portals defined and I used an aardwolf portal item, it would get me to the destination in the MUD and the mapper would find me. This is no good for CMUD speedwalking from current position to destination as Aardwolf has no idea about CMUD mapper.

If I had CMUD portals defined and I tried a speedwalk from current position the mapper would issue a bunch of commands based on what it knows so it would use its defined portals but Aardwolf would have no idea about CMUD mapper portals and would never consider using its (Aardwolf) portals

Thus, there MUST be a connection between the Aardwolf portal destination and the CMUD portal destination otherwise I would not be able to click from one room to another and successfully make the journey from both CMUD and Aardwolf.

If I had a generic alias using a passed parameter, the parameter passed must (in some way) map to the CMUD portal name. This, in turn wold have to marry with a method in Aardwolf to use a specific item for a specific portal that it knows about. This is all fine if I always manually use an Aardwolf portal and never consider clicking on a room on the CMUD map and expect to get there using the shortest possible method.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net