![](templates/Classic/images/spacer.gif) |
charneus Wizard
![](images/avatars/51564989746d852114da6d.jpg)
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Tue Jun 10, 2008 4:43 am
[2.26] @variables being called within variables |
In the past versions, I was able to do a script like this:
#ALIAS welcome {#EXEC {%item(@welcomes, %random(1, %numitems(@welcomes)))}}
#VAR welcomes {newbie *welcome @newplayer|newbie Welcome, @newplayer!|newbie *cheer @newplayer}
Now, before, it would automatically expand the variable @newplayer within the variable @welcomes. With the new version, it no longer does that. Instead, the only workaround for it now is to go into the welcomes variable and change each @newplayer to %expand(@newplayer).
Was this change intentional?
Charneus |
|
|
![](templates/Classic/images/spacer.gif) |
shalimar GURU
![](images/avatars/114658559147aeed8fee539.gif)
Joined: 04 Aug 2002 Posts: 4717 Location: Pensacola, FL, USA
|
Posted: Tue Jun 10, 2008 8:20 am |
@@newplayer?
|
|
_________________ Discord: Shalimarwildcat |
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jun 10, 2008 5:05 pm |
No, don't use @@newplayer. That won't work.
This sounds like a bug. I don't see anything obviously wrong with your script, but I'll try it here and see what I learn.
When you said: "Now, before, it would...", what version are you talking about when you say "before"? |
|
|
![](templates/Classic/images/spacer.gif) |
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Tue Jun 10, 2008 5:18 pm |
The problem I think you were having would be if you were entering the script at the command line when the @newplayer would be resolved to whatever newplayer was.
Try instead entering it like
Code: |
#ALIAS welcome {#EXEC {%item(@welcomes, %random(1, %numitems(@welcomes)))}}
#VAR welcomes {newbie *welcome ~@newplayer|newbie Welcome, ~@newplayer!|newbie *cheer ~@newplayer} |
The ~ will stop it being expanded straight away. |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
![](templates/Classic/images/spacer.gif) |
charneus Wizard
![](images/avatars/51564989746d852114da6d.jpg)
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Tue Jun 10, 2008 6:41 pm |
@Zugg:
I meant the previous version (2.25) I had no problems with it. It worked well in 2.25, but when I installed 2.26, it ceased to work. You can use any text in @newplayer, by the way. It's part of another script that I have confirmed works (and correctly captures the name for the variable) for 2.26. It's just the alias calling the @welcomes with a variable inside.
@Guinn:
The problem is, I shouldn't have to re-enter the alias. It was set before I installed 2.26, and no changes were made to the script. Within the Package Editor, it shows the correct values for @welcomes (as in having newbie *welcome @newplayer and whatnot) but it does not expand to the MUD when called. Example output when using welcome and my script:
In 2.25:
newbie Welcome, Charneus!
In 2.26:
newbie Welcome, !
Charneus |
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jun 10, 2008 11:34 pm |
Either this is already fixed in v2.27 or I cannot reproduce it. Here is what I just tried:
Quote: |
newplayer=Zugg
#ALIAS welcome {#EXEC {%item(@welcomes, %random(1, %numitems(@welcomes)))}}
#VAR welcomes {newbie *welcome @newplayer|newbie Welcome, @newplayer!|newbie *cheer @newplayer} |
then I typed "welcome" a few times and it displayed:
Code: |
newbie Welcome, Zugg!
newbie *welcome Zugg
newbie *cheer Zugg |
This was in a blank default session. So my guess is that there is some option or preference set wrong in your session that has messed this up. I've looked at the stuff that I have fixed in v2.27 and I can't see how any of it would relate to this. |
|
|
![](templates/Classic/images/spacer.gif) |
Tech GURU
![](images/avatars/172896370346230b24779a1.gif)
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Wed Jun 11, 2008 12:17 am |
That worked for me in 2.26 too.
|
|
_________________ Asati di tempari! |
|
|
![](templates/Classic/images/spacer.gif) |
charneus Wizard
![](images/avatars/51564989746d852114da6d.jpg)
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Wed Jun 11, 2008 4:35 am |
Hmmm... I wonder if it's just the script in it's entirety. For some reason (I have no idea what it could be), I'm still not able to completely do the welcomes correctly. Here is what I have, and maybe someone can discern something from it:
#ALIAS welcome {#IF (@newplayer) {#EXEC {%item(@welcomes, %random(1, %numitems(@welcomes)))}};newplayer="";newclass=""}
#VAR welcomes {newbie Welcome to Aardwolf, @newplayer!!|newbie Oo, a @newclass! Welcome to Aardwolf, @newplayer!|newbie Yay! A @newclass! I'd like to welcome you to Aardwolf, @newplayer!|newbie @newclass! Welcome, @newplayer!|newbie Hiya! Welcome to Aard, @newplayer!|newbie Welcome to your new addiction, @newplayer!|newbie *welcome @newplayer|newbie Welcome to Aard! I hope you enjoy your stay here, @newplayer!}
#TRIGGER {^INFO: All please welcome (%w), Aardwolf's newest (*)!} {#VAR newplayer %1;#VAR newclass %2;#ALARM +90 {newplayer="";newclass=""}}
I even posted this exact script in a blank session, and I'm able to repeat it. Again, this worked in 2.25, but no longer works since upgrading to 2.26.
To test this, run:
#SAY All please welcome Charneus, Aardwolf's newest Shadow Evoker!
Charneus
EDIT: What makes this even weirder is that the newclass will expand, but the newplayer will not unless I have it enclosed in %expand()... |
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jun 11, 2008 6:37 pm |
Well, the problem is what Guinn originally mentioned about entering the #VAR command on the command line. Because you have {} around the value, the @newplayer is getting expanded when creating the "welcomes" variable. After entering your above commands, I looked at the "welcomes" variable in the settings editor and it didn't have any of the @newplayer references.
What you need to do is enter this:
#VAR welcomes "newbie Welcome to Aardwolf, @newplayer!!|newbie Oo, a @newclass! Welcome to Aardwolf, @newplayer!|newbie Yay! A @newclass! I'd like to welcome you to Aardwolf, @newplayer!|newbie @newclass! Welcome, @newplayer!|newbie Hiya! Welcome to Aard, @newplayer!|newbie Welcome to your new addiction, @newplayer!|newbie *welcome @newplayer|newbie Welcome to Aard! I hope you enjoy your stay here, @newplayer!"
and then go into the settings editor and change it from a Literal string into a String List. Then your trigger works just fine.
Also, to test this, you need to actually run this:
#SAY INFO: All please welcome Charneus, Aardwolf's newest Shadow Evoker!
(You forgot the INFO: in your example). |
|
|
![](templates/Classic/images/spacer.gif) |
charneus Wizard
![](images/avatars/51564989746d852114da6d.jpg)
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Thu Jun 12, 2008 12:28 am |
Meh. That did work, though I'm still not sure why it would always fire for @newclass but never for @newbie using the old way. Not to mention the old way is what people are used to (as far as putting string lists in {} instead of quotes.
Besides, why should there be an extra step to make the variable within the variables expand? I'm also wondering during the upgrade, if something else was changed?
As a side note: it worked in the blank session. In my main session, the variable was already set to "String List" and even changing it so it can recompile did nothing to fix the problem. I suppose I could re-enter it in again, though I don't know why I should have to.
Charneus |
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jun 12, 2008 12:37 am |
I'm not sure what you mean by "the old way". Putting @vars within {} has *always* caused them to expand immediately, even in zMUD.
For example, in zMUD:
Code: |
#VAR a 123
#VAR b {test|@a|hello}
#VAR |
shows that "test|123|hello" was assigned to the @b variable. So this is how it has always worked. |
|
|
![](templates/Classic/images/spacer.gif) |
|
|
|
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
|
|