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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Thu May 27, 2004 4:57 am   

#if statement question
 

I am using a multiple if statements on a button to trigger my movement scripts

the problem i am having is that in the #if statement I am needing to sometimes add a white space between the second arguement and the ), other wise it will not fire the alaias . And putting a generic white space in all causes some of the statements not to fire.

would putting the second arguement in brackets solve this @direction = "x" ?

eg

#T+ traveldisable
#if (%gsl( p) = "Ta'Illistim, City Gate") {
@direction = tolanding
Illistim_zul
}
#if (%gsl( p) = "Whistler's Pass, Creek" and @direction = tolanding) {blackforest_glacia}
#if (%gsl( p) = "Whistler's Pass, Creek" and @direction = toillistim) {blackforest_illistim}
#if (%gsl( p) = "Whistler's Pass, Grassy Field" and @direction = tolanding) {glacia_zul}
#if (%gsl( p) = "Whistler's Pass, Grassy Field" and @direction = toillistim) {glacia_blackforest}
#if (%gsl( p) = "Cavern exit" and @direction = toillistim) {zul_Illistim}
#if (%gsl( p) = "Kharag 'doth Dzulthu, Tunnels" and @direction = tolanding) {zuleast_zulwest}
#if (%gsl( p) = "Kharag 'doth Dzulthu, Tunnels" and @direction = toillistim) {zulwest_zuleast}
#if (%gsl( p) = "DragonSpine Mountains, Crevasse" and @direction = tolanding ) {zul_ladder_a}
#if (%gsl( p) = "Glo'antern Moor, Rope Ladder" and @direction = tolanding ) {ladder_ropebridge_a}
#if (%gsl( p) = "Dead Plateau, Rope Ladder" and @direction = tolanding ) {ladder_ropebridge_b}
#if (%gsl( p) = "Locksmehr River Trail" and @direction = tolanding ) {ropebridge_river}
#if (%gsl( p) = "Locksmehr River, North Dock" and @direction = tolanding ) {
pay ferryman 10 silver
go ferry
}
#if (%gsl( p) = "Locksmehr River, North Dock" and @direction = toillistim ) {ropebridge_ladder}
#if (%gsl( p) = "Locksmehr River, South Dock" and @direction = tolanding ) {river_tree}
#if (%gsl( p) = "Vipershroud, Locksmehr River" and @direction = tolanding ) {river_tree_b}
#if (%gsl( p) = "Vipershroud, Inside the Tree" and @direction = tolanding ) {tree_village}
#if (%gsl( p) = "Vipershroud, Inside the Tree" and @direction = tolanding) {tree_river}
#if (%gsl( p) = "A Dark Forest Path" and @direction = tolanding ) {hiddenvillage_landing}
#if (%gsl( p) = "A Dark Forest Path" and @direction = toillistim ) {hiddenvillage_tree}
#if (%gsl( p) = "Wehnimer's, Outside Gate" ) {
@direction = toillistim
landing_illistim
}
look
Reply with quote
Cbisazza
Wanderer


Joined: 27 Feb 2003
Posts: 69
Location: Australia

PostPosted: Thu May 27, 2004 9:00 am   
 
Yes, the #IF statement is a little quirky, although I've never noticed this particular one. You might want to try quoting all the strings used. I find that it helps.

I generally notice the same thing with the operators used. Sometimes you *NEED* to put spaces before and after them.
i.e. #IF (@{VARIABLE}>0) will not work, but #IF (@{VARIABLE} > 0) will work fine.
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Fri May 28, 2004 5:01 am   
 
Your if statements are wrong.
If you're going to use the logic operators in an if statement, each statement needs to be incased in parentheses:
#IF ((@variable>0) AND/OR ((%gsl( p) = "Locksmehr River, South Dock")) {DO TRUE} {DO FALSE}

This will change all your trigger to:

#T+ traveldisable
#if (%gsl( p) = "Ta'Illistim, City Gate") {
@direction = tolanding
Illistim_zul
}
#if ((%gsl( p) = "Whistler's Pass, Creek") AND (@direction = "tolanding")) {blackforest_glacia}
#if ((%gsl( p) = "Whistler's Pass, Creek") AND (@direction = "toillistim")) {blackforest_illistim}
#if ((%gsl( p) = "Whistler's Pass, Grassy Field") AND (@direction = "tolanding")) {glacia_zul}
#if ((%gsl( p) = "Whistler's Pass, Grassy Field") AND (@direction = toillistim)) {glacia_blackforest}
#if ((%gsl( p) = "Cavern exit") AND (@direction = "toillistim")) {zul_Illistim}
#if ((%gsl( p) = "Kharag 'doth Dzulthu, Tunnels") AND (@direction = "tolanding")) {zuleast_zulwest}
#if ((%gsl( p) = "Kharag 'doth Dzulthu, Tunnels") AND (@direction = "toillistim")) {zulwest_zuleast}
#if ((%gsl( p) = "DragonSpine Mountains, Crevasse") AND (@direction = "tolanding")) {zul_ladder_a}
#if ((%gsl( p) = "Glo'antern Moor, Rope Ladder") AND (@direction = "tolanding")) {ladder_ropebridge_a}
#if ((%gsl( p) = "Dead Plateau, Rope Ladder") AND (@direction = "tolanding")) {ladder_ropebridge_b}
#if ((%gsl( p) = "Locksmehr River Trail") AND (@direction = "tolanding")) {ropebridge_river}
#if ((%gsl( p) = "Locksmehr River, North Dock") AND (@direction = "tolanding")) {
pay ferryman 10 silver
go ferry
}
#if ((%gsl( p) = "Locksmehr River, North Dock") AND (@direction = "toillistim")) {ropebridge_ladder}
#if ((%gsl( p) = "Locksmehr River, South Dock") AND (@direction = "tolanding")) {river_tree}
#if ((%gsl( p) = "Vipershroud, Locksmehr River") AND (@direction = "tolanding")) {river_tree_b}
#if ((%gsl( p) = "Vipershroud, Inside the Tree") AND (@direction = "tolanding")) {tree_village}
#if ((%gsl( p) = "Vipershroud, Inside the Tree") AND (@direction = "tolanding")) {tree_river}
#if ((%gsl( p) = "A Dark Forest Path") AND (@direction = "tolanding")) {hiddenvillage_landing}
#if ((%gsl( p) = "A Dark Forest Path") AND (@direction = "toillistim")) {hiddenvillage_tree}
#if (%gsl( p) = "Wehnimer's, Outside Gate") {
@direction = toillistim
landing_illistim
}
look
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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