About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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
hadar
Apprentice


Joined: 30 Aug 2009
Posts: 198
Location: my apt, in california

PostPosted: Thu Jun 24, 2010 6:53 pm   

variable help
 
in one of my scripts i have to verify if there are variables made already, but some of my variables have _ where there are spaces, i tried

Code:
#if (@{%replace(%trim(%2)," ","_")}) {} {#alias %replace(%trim(%2)," ","_") {newareanow} "areaalias"}


and this code seems to replace anything that has a space in the name with the new alias, instead of leaving it alone like i want it to ... i dont know if there is a better way to do this though ...
_________________
if you build it they will come, assuming that they have not already come to build it
Aardwolf Bootcamp
My youtube channel
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Jun 25, 2010 12:32 am   
 
I'm afraid you aren't making yourself very clear. You should state what exactly it is you are trying to do.

From what you have given, I surmise that you are trying to create variables and aliases based on text from the mud. The text contains spaces, and the corresponding variable and alias names replace the spaces with underscores. I assume from what you have _not_ said that the variable and alias names are being correctly transformed to use underscores?

My next question is, how is the variable being made? You have not shown us that. Are you certain that the variable actually exists in the cases where you think aliases are being overwritten?

Third, does the variable in question actually have a value? If it does not have a value, or the value is 0, your statement will evaluate as false, and the alias will be overwritten.

As an aside, if you are only worried about the case where the variable does not exist or has a 0 value, you could use an ! to negate your query. "!@variable" will evaluate as true if the variable does not exist or is zero.
Reply with quote
hadar
Apprentice


Joined: 30 Aug 2009
Posts: 198
Location: my apt, in california

PostPosted: Fri Jun 25, 2010 2:49 pm   
 
actually i just noticed im making it wrong, im wanting to check to see if i have an alias before i make a new one, right now im looking for a variable but i was crazy ... i was asleep when i was writing this script, i just dont want to overwrite the alias' when i make the new ones ... but the script works even that code works, i just dont have a variable for every area, i keep the alias made, and i have paths made for them, i just need this to make the alias with newareanow so i can search for that and see what areas im missing my speedwalks for ...
_________________
if you build it they will come, assuming that they have not already come to build it
Aardwolf Bootcamp
My youtube channel
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Sun Jun 27, 2010 6:23 pm   
 
Ah! If you haven't figured it out already, a way to test whether a setting exists is the %class() function. It will return 1 if it exists and is enabled, 0 if it exists and is disabled, and -1 if it doesn't exist.
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