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
Gintonic
Beginner


Joined: 04 May 2018
Posts: 12

PostPosted: Sun Jan 23, 2022 11:53 am   

Question about #PORTAL and #UNPORTAL
 
HI Everyone,

This is a hard one, at least for me. I'm trying to achieve something for weeks now, but no prevail.
I play on a non-english mud, where there is an item enabling you to teleport to memorized locations. There is a command to list all the known teleports and it returns something like this:

You have 4 location on your list

[001] Zone 1 ........................................... 100 mp
[002] Zone 2 ........................................... 100 mp
[003] Zone 3 ........................................... 100 mp
[004] Zone 4 ........................................... 100 mp

The "teleport 1" , "teleport 2 " etc commands will teleport you to the entry room of the listed zones. The list is organised in alphabetical order, so whenever you memorize a new location, depending on its name, the port number changes. And here comes my agony.
I want to write a script that would automatically create/delete portals in the mapper.

At first delete all existing portal commands, so I don't have to delete 100 portals in the mapper manually:

I made a triger:

Pattern: ~[(%d)]%s({%x|%x %x|%x %x %x})%s%x%s%d%smp //Some zones have special characters in their name, and multiple words
Script text: #UNPORTAL ~"""teleportal %float(%1)"""

The pattern is OK, extracts the right info, but the #UNPORTAL command does not get rid of the portals.
I tried expanding the #UNP into an alias, variable but still did not work. I also tried writing the "teleport 1" part of the code into a variable and bring it in from that, still no cigar. tried LOOP with %i, same thing.

It seems the you cant expand any fuction or variable within "" in the #UNPORTAL command. Somebody please confirm if this is the case or let me know what I'm doing wrong.
Reply with quote
hpoonis2010
Adept


Joined: 18 Jun 2019
Posts: 279

PostPosted: Mon Jan 24, 2022 7:28 am   
 
Not sure %float is going to help at all. If you have leading '0' then just strip them off.

Plus, I also think that """ is going to cause problems. I have seen problems with my scripts trying to deal with enclosed doubles. """word""" is probably going to just expand to "" "word" "".

Your portalnames are teleportal 1 (or maybe 001) ? If you use the mapper portal editor and see what the names are what can you see? I do not think that having spaces in the names is going to be helpful either.

If your portal naming trigger creates a portal like

#PORTAL portname <roonum>

then

#UNPORTAL portname

will remove the portal.

So, for the sake of simplicity I suggest you make portals such as teleport1, teleport2, and avoid having spaces.
Reply with quote
Gintonic
Beginner


Joined: 04 May 2018
Posts: 12

PostPosted: Mon Jan 24, 2022 7:38 am   
 
The portal names are set by the mud, I can't change them unfortunately.

teleportal 1 is the actual command I have to send to the mud.

Managing 100 portals via the editor takes a long time and it is a gruesome process.

I can manage to get the correct syntax for ECHO, hence the ~"""teleportal %1""" but whilst cmud appends it, it does not translate it as an actual command.
Reply with quote
hpoonis2010
Adept


Joined: 18 Jun 2019
Posts: 279

PostPosted: Mon Jan 24, 2022 8:29 am   
 
Do I have this a-right:

If you have 4 destinations called (eg)

BlackZone
TargetArea
ArthursPass
JumpPoint

If you 'memorise' BlackZone, you can teleport to one room. So your list will be:

[001] BlackZone ....(etc) 100 mp

and if you memorise another, will the list be

[001] BlackZone ...(etc) 100 mp
[002] TargetArea ...(etc) 100 mp

and for 3, will the list be

[001] ArthursPass ...(etc) 100 mp
[002] BlackZone ...(etc) 100 mp
[002] TargetArea ...(etc) 100 mp

So, all this is really immaterial as you will be making a portal to a MAPPER location. Your PORTAL trigger should be creating portals based on the destination. From what you say, the destination should be the same no matter where in the list it is. Therefore, the actual MUD destination and the MAPPER destination will not change.

If your 'teleport' destination contains more than one word then just simplify it by removing the spaces. As:

Destination Area Teleport 1 can be DestinationAreaTeleport1

#PORTAL DestinationAreaTeleport1 roomID

So, no matter where in the list the destination is, it should still map to the same mapper location. Can you un-memorise a teleport destination? If so, what you really may be after is just the same thing: once you un-memorise a teleport, just UNPORTAL that portalname.

Just for clarity, can you provide several examples of how the list looks with some real locations?
Reply with quote
Gintonic
Beginner


Joined: 04 May 2018
Posts: 12

PostPosted: Mon Jan 24, 2022 10:11 am   
 
Not quite.

#PORTAL

Creates a new portal command word for the mapper, or modifies an existing portal. PortalName is the name of the portal and should be exactly the same as the command sent to the MUD to teleport you. RoomID is the ID of the room on the map to move to. If omitted, the current map position is used.
Example:
#PORTAL "cast recall"

If I change the portal name to anything else, such as castrecall, the portal will not work.

So if I want to create a portal to BlackZone, as per your example, the only way I can get the mapper to learn the portal is by giving it the proper portal command. #PORTAL "teleport 1" {roomid in blackzone}

so whilst the zone name and the destination stays the same, the command to get there would change, based on how many memorized location you have listed.

I can have a character on the mud that memorised BlackZone, TargetArea, ArthursPass and JumpPoint listed as 001 002 003 and 0004 and I set up the portals in the mapper, it works alright. But if I relog with another toon, or share my mapper file with someone who, for example has ArthursPass and JumpPoint listed only, would not be able to use the mapper adequately. It will try to get to BlackZone by sending the "teleport 1" command, or to TargetArea via "teleport 2".

The script I'm trying to create, would go through the memorised list and create the required portals in accordance with the memorised locations.

To further simplify, the portals in my instance have 4 attributes.

1. Position in the list 2. Zone Name 3. RoomID of the locations it teleports 4.Command sent to the mud to teleport.

The RoomID and the Zone Name is permanent, whislt the position and the command changes. I have no experience with databases, but I was also thinking to try to create one and manage the variables by triggers. However, I'm not sure, if ammending the unportal command did not work from triggers, would it work from database. For example, would I be able to save a database entry in row 4 as #PORTAL "teleport 1" {1234}, and get CMUD and mapper to handle it as a command not as a verbatim sent to the mud.
Reply with quote
hpoonis2010
Adept


Joined: 18 Jun 2019
Posts: 279

PostPosted: Mon Jan 24, 2022 4:52 pm   
 
You will make your life simple by not sharing such data. The only safe things you could share across characters/sessions would be the map and the scripts.
Reply with quote
Gintonic
Beginner


Joined: 04 May 2018
Posts: 12

PostPosted: Mon Jan 24, 2022 8:25 pm   
 
The portals are part of the map.
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