myddrun Wanderer
Joined: 31 Mar 2005 Posts: 58
|
Posted: Mon Feb 08, 2010 1:34 pm
creating variables in classes with out spamming #var |
Sorry numpty of a post but i'm justing getting back in to messing with zmud. This is all about putting names in to variables in classes wiht out spamming 20-30 lines of #var in a script.
I create the many lists for each race and class of all players on the fly by spamming the mud's player info command.
So if for example there are let say no Fighters or Elves logged in, no Fighter or Elf variable is created.
Now here's the rub:
I dislike the idea of having bucket loads of #var's as I would need to initialise approximately 20-25 lists but as I use #Additem you can't put a variable in to a class with just #Additem alone..... OR CAN YOU?
From the mud's Player info command.
Example output
Name: Player Name
He is an Elven Fighter or
She is a Gnomish Druid Or
It is a Drow Mage etc
and my current code
Code: |
Trigger{Name: (%w)}
{#var tempname %1}
#Cond {[He|She|It] is [a|an] (%w) (%w)}
{
#Additem %2 (@tempname,%2) /Race
#Additem %3 (@tempname,%3) /Guild
#unvar tempname
} |
Would this work if i wanted to put them in to a class?
Code: |
#Cond {[He|She|It] is [a|an] (%w) (%w)}
{
#IF (@%2) /if @race is not null
{#Additem %2 (@tempname,%2)} /true
{#var %2 {} {} classname
#Additem %2 (@tempname,%2)} /false
#IF (@%3) /if @class is not null
{#Additem %3 (@tempname,%3)} /true
{#var %3 {} {} classname
#Additem %3 (@tempname,%3)} /false
#unvar tempname
} |
for example, If @Fighter is not null #additem the player name.
If @fighter is null, create it in the class name, and then #Additem to it.
How would you do it? |
|