ID:160896
![]() Jul 12 2008, 4:06 pm
|
|
Ok, I want to make it so, When someone enters their name, I can make the name variable null, and save the name they enter to another variable, so they cant be right clicked to see the name, but when they talk you can see their name. Anyone know the exact way to do that?
|
![]() Jul 12 2008, 4:06 pm
|
|
You just explained exactly how to do that.
|
I get what your saying but, I dont know how to make it so the other variable, will stick with the original input, so the other goes null and it stays, I would try to make one equal t the other but when it goes null the other will go null too.
|
mob I really don't understand what you mean. |
The mouse_opacity var may or may not be suitable for you for this purpose, depending on your game.
Anyway, if the above is unsuitable for you, you can use a workaround for this, although presently there is no very good way to do this. The approach is simple: set the players' names to null (actually, I think setting to a string like " " (space) works better, it has less bad implications), and use a different variable to present their name in dialog and other stuff in the game. Quick example: mob/player Of course, you could naturally just do this if you account for your character creation method changes rname instead of name: mob/player And the rest of your game such as Say() verbs will use rname, of course (this means you also can't embed object (player mobs') references directly in text, eg you can't do "you hit [src]", it won't work). mob/player/verb/Say(msg as text) |
Relleke wrote:
I would try to make one equal t the other but when it goes null the other will go null too. No, it wouldn't, so that works. Setting a variable to another variable doesn't create a constant "relationship" between them or anything like that - they're not effected by eachother. Setting a var to another var does just that - setting a var's value to the current value of a different var. No more, no less. |
So, If I made that var equal to the other, then the first thing that is entered into it will stay? so that would work?
|
Relleke wrote:
So, If I made that var equal to the other, then the first thing that is entered into it will stay? Yes, like I said. That's how it works. Just 'set X to the [current] value of Y'. |
I tried to do what you said to, but every time I use the name variable, the normal one, I keep gettin the duplicate definition error
|
Well, you must have done this wrong. Have you written var/name? That is unneeded, because the 'var' keyword is used to declare new vars, but name is already a built-in variable, and you cannot define a new var that is named the same (neither do you need to). If this is the case, just override the name var's value instead of declaring it (as seen in my example code above).
If this does not fix your problem, then post your code so I am not just guessing. |