|
SBG Novice
Joined: 05 Mar 2003 Posts: 44 Location: Australia
|
Posted: Sat Apr 25, 2015 11:39 pm
colouring rooms via a script |
So basically I'm trying to colour all rooms in a area in offline mode via a script, this is what I've got to compile but it doesn't seem to be doing anything
this is a cut down version for the sake of sanity of course :-)
Code: |
#LOCAL $colour
#SWITCH (%roomname( "Stark Plains of the Sannad Tundra")) {$color="green"}
(%roomname( "Sparse Bushes on the Sannad Tundra")) {$colour="brown"}
(%roomname( "Snowy Fields of the Sannad Tundra")) {$colour="white"}
#LOOP %numrooms {#CALL %roomcol(%roomnum(%i), $colour)}
#CALL %maplocked( 1) |
Anyone got any idea's where I'm going wrong ?
am I missing an If statement here somewhere ?
Thanks, Mark.
Edit: Revised but still not working |
|
_________________ Windows 7U x64 SP1
AMD Phenom X4 9650
8 Gig mem
CMUD Pro v3.34
Zmapper v1.30 |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Mon Apr 27, 2015 7:50 am |
The parameter to %roomname is the room number. I assume you also want to set $colour in the loop, so it gets reset for every room. Right now you're only setting it once at the start, then setting all rooms to that same colour in the loop. Something like this?
Code: |
#LOCAL $colour
#LOOP %numrooms {
#SWITCH (%roomname( %roomnum(%i)) == "Stark Plains of the Sannad Tundra") {$color="green"}
(%roomname( %roomnum(%i)) == "Sparse Bushes on the Sannad Tundra") {$colour="brown"}
(%roomname( %roomnum(%i)) == "Snowy Fields of the Sannad Tundra") {$colour="white"}
#CALL %roomcol(%roomnum(%i), $colour)
}
#CALL %maplocked( 1) |
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Mon Apr 27, 2015 10:04 am |
Code: |
$rm=%roommode()
#CALL %roommode(1) %maplocked(0)
#FORALL %mapquery("[Name]='Stark Plains of the Sannad Tundra'") {#CALL %roomcol(%i,green)}
#FORALL %mapquery("[Name]='Sparse Bushes on the Sannad Tundra'") {#CALL %roomcol(%i,brown)}
#FORALL %mapquery("[Name]='Snowy Fields of the Sannad Tundra'") {#CALL %roomcol(%i,white)}
#CALL %roommode($rm) %maplocked(1) |
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
SBG Novice
Joined: 05 Mar 2003 Posts: 44 Location: Australia
|
Posted: Mon Apr 27, 2015 2:48 pm |
Thanks Guys,
While Daern's example didn't work, it still gives me some information that I was missing and helps in my understanding on future ideas,
Vijilante's example worked though, so that too helps in furthering my understanding on #FORALL, which I had tried at first on this but failed to get right,
which is why I was hoping the #SWITCH was going to be the work around I was looking for.
as always your help is greatly appreciated. |
|
|
|
|
|