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
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4671
Location: Pensacola, FL, USA

PostPosted: Wed Dec 20, 2006 5:28 am   

Am i missing something here?
 
Im trying to make a script to automatically assign the value of professional variables.

Code:
#ALIAS prof {
prof=%1
#T+ ProfSet
who prof @prof
}

#CLASS ProfSet
#TR {^Brave Adventurers Questing:$} {#T+ ProfCapture}
#TR {^Total: %d$} {
#T- ProfCapture
#T- ProfSet
}
#TR "ProfCapture" {^} {#LOOP %numwords(%line) {#IF (!%ismember(%word(%line, %i), @@prof)) {#VAR @prof {%additem(%word(%line, %i), @@Prof)}}}}
#CLASS 0


Instead of making a variable array named for the value of @prof, it makes a bunch of variables, each named '|Brave' and with a value of '@|Brave|NameForArrayHere'

Also, the value of @prof seems to change other then just in the 'prof' alias.

Also, how do i get the ProfCapture trigger not to fire on the same line that turns it on?
_________________
Discord: Shalimarwildcat
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Wed Dec 20, 2006 6:18 am   
 
The @@ is no longer supported. That's the first thing that jumps out at me.

If you want to do an indirect variable reference I think you need @{@prof}.

However it's late and my brain may done for tonight. It was definitely discussed in the Beta forum so try searching there. This may be a good start.
_________________
Asati di tempari!
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4671
Location: Pensacola, FL, USA

PostPosted: Wed Dec 20, 2006 6:34 am   
 
Well.. I had tried @{@prof} and gotton no results earlier, but trying again i see that it does do something, although not what it should.

i call the alias 'prof empath'
it sets @prof to empath and then spits out 'who prof empath' like it should
for some reason ProfCapture is now resetting the value of @prof to be each of the names in turn, and doesnt even try to add to @empath

i went on to try @{prof} to see if the second @ was unneeded with indirect variable assignment, but no go, all that did is assign all the values to @prof, but at least it did make it an array instead of a single word value

i even tried @{%eval(@Prof)} but got nothing

As far as i can see, indirect variable calls arent working properly.
_________________
Discord: Shalimarwildcat
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4671
Location: Pensacola, FL, USA

PostPosted: Wed Dec 20, 2006 6:48 am   
 
i have found the culpret

#VAR @prof {blah}

is the same as

prof=blah

the variable does not expand the variable name and ignores the @ symbol
_________________
Discord: Shalimarwildcat
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Wed Dec 20, 2006 10:38 am   
 
So is there a bug, or do you just have to change
Code:
#VAR @prof {blah}
to some other syntax?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4671
Location: Pensacola, FL, USA

PostPosted: Wed Dec 20, 2006 8:03 pm   
 
I changed it to:

#VAR %eval(@prof) {%additem(%word(%line, %i), @{@Prof})}

and that seems to work, guess i just needed to be more awake
_________________
Discord: Shalimarwildcat
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Wed Dec 20, 2006 8:38 pm   
 
Or...
#EXEC {#VAR @prof {blah}}
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Thu Dec 21, 2006 10:22 am   
 
Does %expand work too? It feels like it should...
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