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
talonnb
Apprentice


Joined: 30 Oct 2004
Posts: 127

PostPosted: Thu Jan 13, 2011 11:01 pm   

Getting the mappers ID for a Vnum room
 
I have code set up to capture from gmcp the room vnum, which it also saves in my mapper correctly. Now, I have a bunch of Vnums that I want to color on the map, which I found %roomcol for, but it reacts to the mappers' numbers, not the Vnums. I've played around with %roomvnum and %roomnum to no avail.

I have a string database with vnums in there I want colored, and from what I experimented with my code looks somewhat like this

$rooms=2342|12313|5433|1232|5566
#forall $rooms {%roomcol(%roomvnum(%i),blue)}

but this does not color the rooms, and I've figured out that %roomvnum is giving me a different room number than what the appropriate Vnum is. Now, if I'm in the room, I can do %roomvnum() and it'll display the right number for the room I'm in, but that's as far as I got. I'm sure it's just something stupid I've missed, thanks for any help
Reply with quote
shalimar
GURU


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

PostPosted: Thu Jan 13, 2011 11:52 pm   
 
you need to toggle %maplocked if you want to color rooms via script
_________________
Discord: Shalimarwildcat
Reply with quote
talonnb
Apprentice


Joined: 30 Oct 2004
Posts: 127

PostPosted: Fri Jan 14, 2011 12:14 am   
 
No no, it's not that it's not in edit mode, cause I do have the toggle before and after the script to toggle that. The coloring works properly, it's that the %roomvnum(Vnum) does not give me the associated mapper number for that room, but rather another ID that doesn't match anything I've seen.....
Reply with quote
shalimar
GURU


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

PostPosted: Fri Jan 14, 2011 12:30 am   
 
Try this... I haven't tested it though

$rooms=2342|12313|5433|1232|5566
#CALL %maplocked(0)
#FORALL $rooms {#CALL %roomcol(%roomnum(%i), blue)}
#CALL %maplocked(1)
_________________
Discord: Shalimarwildcat
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Jan 14, 2011 12:34 am   
 
%roommode is what you need.

Code:
#CALL %roommode(0)


will set it to use the vnum factors and not the database keys.
Reply with quote
shalimar
GURU


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

PostPosted: Fri Jan 14, 2011 12:53 am   
 
The big issue was likely the lack of #CALL-ing the functions.
_________________
Discord: Shalimarwildcat
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Jan 14, 2011 1:19 am   
 
shalimar wrote:
The big issue was likely the lack of #CALL-ing the functions.


No, the big issue was gmcp vnums vs database vnums. That's why %roommode is there. When you have it set to %roommode(1), where it's accessing the database keys, the results are far different from %roommode(0). Though you are right with the #FORALL loop needing the #CALL. Command lines cannot start with a function or a variable.

This is easily tested by creating a bunch of rooms, setting the vnums, and setting %roommode(0) and doing #TELE <vnum>, then doing %roommode(1) and repeating the #TELE command, unless you are extremely lucky and can match up database keys with the vnums.
Reply with quote
shalimar
GURU


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

PostPosted: Fri Jan 14, 2011 4:05 am   
 
%roomnum returns the vnum, so i stand by referencing #CALL
_________________
Discord: Shalimarwildcat
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Jan 14, 2011 4:19 am   
 
Ah, I had missed that. Sorry about that! :P
Reply with quote
talonnb
Apprentice


Joined: 30 Oct 2004
Posts: 127

PostPosted: Fri Jan 14, 2011 4:43 am   
 
Yep, got it working 100% once I switched the %roommode(0) it works perfectly with the vnums from the room now. Thank you guys!
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