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
Novice


Joined: 18 Jun 2019
Posts: 41

PostPosted: Thu Jul 11, 2019 7:07 am   

Mapping, rooms and event scripts
 
Hi all,

I know I may just be dense but I am trying to auto-colour the mud rooms according to (primarily) room type. Aardwolf supplies area/room info via gmcp functions so this provides a surefire way to get correct room data.

I have two events for new rooms and for checking/adjusting existing rooms. Both work only (obviously) when in MAP mode.

OnRoomCreate

#IF (%ismember(%gmcp.room.info.details, "shop|healer|bank|questor")) {#CALL %roomcol(,coral);%roomnote(,%gmcp.room.info.details)} {#RAISE PaintRoom}

and

OnRoomEnter

#IF (%ismember(%gmcp.room.info.details, "shop|healer|bank|questor")) {#CALL %roomcol(,coral);%roomnote(,%gmcp.room.info.details)} {#RAISE PaintRoom}

I assume (quite naturally) that if the room DETAILS equals one of the supplied items (shop, etc) that the room gets coloured according to the roomcol call...and it does. The roomnote adds the roomdetails to the room properties so that it may be possible to search for room types in the notes.

I also assumed (quite incorrectly) that the #IF conditional would do the other option if the room details were not in the list, and paint the room according to the 'PaintRoom' event. It seems that this 'elseif' option is never called.

I have raised a support ticket as the PaintRoom script seems to only colour highlight a few lines of code, the rest are just plain. From switch option 'field4' to the end, all code is plain black and not highlighted. I have checked the code in a plain text editor and there is nothing untoward: no tabs, no formatting, nothing, just text.

PaintRoom

Code:
#SWITCH (%gmcp.room.info.terrain)
  ("air") {#CALL %roomcol(,deepskyblue)}
  ("alley") {#CALL %roomcol(,dimgray)}
  ("aylorcity") {#CALL %roomcol(,slategray)}
  ("afountain") {#CALL %roomcol(,yellow)}
  ("beach") {#CALL %roomcol(,darkorange)}
  ("bloodyroom") {#CALL %roomcol(,crimson)}
  ("bridge") {#CALL %roomcol(,slategray)}
  ("cave") {#CALL %roomcol(,dimgrey)}
  ("castle") {#CALL %roomcol(,slategray)}
  ("city") {#CALL %roomcol(,slategray)}
  ("crossroad_nw") {#CALL %roomcol(,saddlebrown)}
  ("crossroad_se") {#CALL %roomcol(,saddlebrown)}
  ("dark") {#CALL %roomcol(,midnightblue)}
  ("desert") {#CALL %roomcol(,palegoldenrod)}
  ("dead_field") {#CALL %roomcol(,wheat)}
  ("dead_forest") {#CALL %roomcol(,wheat)}
  ("dungeon") {#CALL %roomcol(,darkslategray)}
  ("field") {#CALL %roomcol(,lawngreen)}
  ("field2") {#CALL %roomcol(,limegreen)}
  ("field3") {#CALL %roomcol(,forestgreen)}
  ("field4") {#CALL %roomcol(,darkolivegreen)}
  ("flowers1") {#CALL %roomcol(,yellowgreen)}
  ("flowers2") {#CALL %roomcol(,tomato)}
  ("forest") {#CALL %roomcol(,forestgreen)}
  ("hell1") {#CALL %roomcol(,darkorange)}
  ("hell2") {#CALL %roomcol(,orangered)}
  ("hell3") {#CALL %roomcol(,indianred)}
  ("hellfountain") {#CALL %roomcol(,red)}
  ("hills") {#CALL %roomcol(,tan)}
  ("ice") {#CALL %roomcol(,lightskyblue)}
  ("icehills") {#CALL %roomcol(,lightcyan)}
  ("icemount") {#CALL %roomcol(,white)}
  ("inside") {#CALL %roomcol(,gainsboro)}
  ("jungle") {#CALL %roomcol(,darkgreen)}
  ("lottery") {#CALL %roomcol(,tomato)}
  ("moon") {#CALL %roomcol(,ghostwhite)}
  ("mountain") {#CALL %roomcol(,firebrick)}
  ("ocean") {#CALL %roomcol(,seagreen)}
  ("ocean2") {#CALL %roomcol(,mediumseagreen)}
  ("ocean3") {#CALL %roomcol(,mediumaquamarine)}
  ("ocean4") {#CALL %roomcol(,lightseagreen)}
  ("palace") {#CALL %roomcol(,silver)}
  ("pillar") {#CALL %roomcol(,slategray)}
  ("plain") {#CALL %roomcol(,palegreen)}
  ("quicksand") {#CALL %roomcol(,darkgoldenrod)}
  ("river") {#CALL %roomcol(,darkturquoise)}
  ("road") {#CALL %roomcol(,saddlebrown)}
  ("rocks") {#CALL %roomcol(,darkslategrey)}
  ("ship") {#CALL %roomcol(,burlywood)}
  ("shore") {#CALL %roomcol(,aqua)}
  ("smallroad") {#CALL %roomcol(,chocolate)}
  ("smallroad_ew") {#CALL %roomcol(,chocolate)}
  ("snow") {#CALL %roomcol(,snow)}
  ("space1") {#CALL %roomcol(,midnightblue)}
  ("space2") {#CALL %roomcol(,navy)}
  ("space3") {#CALL %roomcol(,darkblue)}
  ("space4") {#CALL %roomcol(,mediumblue)}
  ("swamp") {#CALL %roomcol(,olivedrab)}
  ("temple") {#CALL %roomcol(,gold)}
  ("trail") {#CALL %roomcol(,sienna)}
  ("trail_ew") {#CALL %roomcol(,sienna)}
  ("underwater") {#CALL %roomcol(,darkcyan)}
  ("underground") {#CALL %roomcol(,darkslategray)}
  ("volcano") {#CALL %roomcol(,orangered))}
  ("water") {#CALL %roomcol(,steelblue)}
  ("waternoswim") {#CALL %roomcol(,royalblue)}
  ("waterswim") {#CALL %roomcol(,cornflowerblue)}
Reply with quote
hpoonis2010
Novice


Joined: 18 Jun 2019
Posts: 41

PostPosted: Fri Jul 12, 2019 6:50 am   
 
OK. So, even after no manual input...all is working again for the #IF condition...aside from the ismember logic not working against multiple inputs. There is something flaky about all this.

I have also noticed some extreme lag from time to time where a restart of the cMUD application corrects the delays.
Reply with quote
shalimar
GURU


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

PostPosted: Fri Jul 12, 2019 7:47 pm   
 
#IF (this is true) {do this} {else to that}

Is, in fact, a valid way of expressing your code.
If you got no results off of an #IF statement of similar design, the issue is with what it is doing, not with the #IF statement.

This likely stems the fact that trying to change colors by script, still requires you to put the mapper into mapping mode first.

#CALL %maplocked(0)
#IF
#CALL %maplocked(1)

The lag could potentially be caused by bad user code elsewhere.
CMUD is a notorious memory hog and I suffered from similar issues until I got my current machine with excessive amounts of RAM.
_________________
Discord: Shalimar#3679
Reply with quote
hpoonis2010
Novice


Joined: 18 Jun 2019
Posts: 41

PostPosted: Tue Jul 16, 2019 9:49 am   
 
It is possible that the insane lag happens after doing a find room. In which case it could well be database related.

[Update]

It seems this is the case. In every instance when I do a find room, after I walk to the room the client enters extreme lag mode and only restarting it resolves the problem.

Given that development on this software has ceased I doubt a fix will be forthcoming.
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