Thread Tools Display Modes
01-07-11, 10:58 AM   #1
goodstuff
A Murloc Raider
Join Date: Jan 2011
Posts: 5
New Mod help

Hello, I am trying to make a new mod and am running into problems everywhere. I found a mod named "Hadouken" and was trying to convert it to have the user to play different meow sounds to assigned spells on successful spellcast.

When I changed the code enough I got it to play the one sound fine and I tried multiple different ways to get it to work for different sounds. Right now i have a separate lua file for each sounds code but I'm running into some problem (i can't pinpoint what). I tried having one file with the same code repeated for each sound and changing the savedvariable list names slightly for each one but that did not work either. I was wondering if someone could be of some assistance. Attached is 2 examples of the lua's for each different sound, the toc and the xml. I'd greatly appreciate any help.

looks like toc didn't attached >.< , tell me if you need it.
Attached Files
File Type: lua Meow.lua (3.2 KB, 709 views)
File Type: xml Meow.xml (489 Bytes, 1616 views)
File Type: lua Meowthree.lua (3.2 KB, 694 views)

Last edited by goodstuff : 01-07-11 at 11:01 AM. Reason: toc didnt attach
  Reply With Quote
01-07-11, 11:51 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
The savedvariables are defined in the toc-file so its not enough to just change them in the lua.

Your biggest problem i think is having global functions where locals should be used.

A function or any variable should be local when possible.
Espescially if you use common names for them. Else they will be overriden by
your other script-files or worse overwrite code of other addons.

Edit:

Code:
SLASH_HADOUKEN1 = "/meowone"
Code:
SLASH_HADOUKEN1 = "/meowthree"
Those two lines you use the "namespace" of hadouken where you should create your own and you set the same variable twice so that the first is useless.
__________________
The cataclysm broke the world ... and the pandas could not fix it!

Last edited by Rilgamon : 01-07-11 at 11:57 AM.
  Reply With Quote
01-07-11, 01:15 PM   #3
goodstuff
A Murloc Raider
Join Date: Jan 2011
Posts: 5
fixes

Thanks for the response. I understand what you meant but I am still having some troubles.

I changed the hadoukens for each
Code:
SLASH_MEOW1 = "/meowone"
Code:
SLASH_MEOWTHREE1 = "/meow three"
and then also changing the hadouken in the slashcommand function further down to the proper one.

But am still having the problem where any "/meownumber help" ingame is showing the meowfour help list and using the meowfour sound for every spell. I think this has to do with the use of global functions where locals should be things you said, like having the savedvariable sounds/spell list and stuff the same for each lua. Im not sure how to go about fixing this.

In the toc do i just change to SavedVariablesPerCharacter: savedVariables, savedVariablestwo, savedVariablesthree... and then changing each thing in the respective luas everywhere in the code here and within the functions that write to them:
Code:
savedVariables = {};
savedVariables.spells = {};
savedVariables.sound = "meowone";
savedVariables.personal = true;
Here is my toc btw

Code:
## Interface: 40000
## Title: Meow |cffff7d0aby Me
## Author: Me
## Version: 1.00
## Notes: Meow sound effect for spells.
## SavedVariablesPerCharacter: savedVariables
## DefaultState: Enabled
Meow.lua
Meowtwo.lua
Meowthree.lua
Meowfour.lua
Meow.xml

Last edited by goodstuff : 01-07-11 at 02:26 PM.
  Reply With Quote
01-07-11, 02:06 PM   #4
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
http://www.wowpedia.org/SlashCmdList_AddSlashCommand

I'm not that good with the slashcommands ... but I think they're supposed to share one single namepart and a counting part.
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
01-07-11, 02:32 PM   #5
goodstuff
A Murloc Raider
Join Date: Jan 2011
Posts: 5
Isn't that for within one function? Im trying to do four different slash commands
/meowone
/meowtwo
/meowthree
/meowfour
that each do a different thing. So for each I just renamed the name of the slash aka MEOW to MEOWTWO and then start from 1 again (SLASH_MEOW1 and SLASH_MEOWTWO1) Isnt adding a 2 and so on after the same name just supplying a different option for what to write after the slash for the same function?
Like I thought it was like anything with MEOW1 or MEOW2 and then both of those will use
function SlashCmdLis*****OW(spell)

And if I wanted a second slash command to do something else I rename it and then follow the name into the function start aka what assign MEOWTWO1 and MEOWTWO2 will both activate the
function SlashCmdLis*****OWTWO(spell)

Its just when I actually do like /meowtwo even tho its assigned to the function SlashCmdLis*****OWTWO(spell), I see it activating function SlashCmdLis*****OWFOUR(spell) even tho thats in a completely different lua file then what /meowtwo is even used in
I could be going about it all wrong or even focusing on the wrong thing. I just want to get this working >.<

Last edited by goodstuff : 01-07-11 at 02:34 PM.
  Reply With Quote
01-07-11, 03:47 PM   #6
Soulofsin_007
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 125
Code:
SLASH_MEOWONE1 = '/meowone';
function SlashCmdLis*****OWONE(msg)
    if msg == "" then
       print("TESTDTRE")
    end
end

SLASH_MEOWTWO1 = '/meowtwo';
function SlashCmdLis*****OWTWO(msg)
    if msg == "t" then
       print("TESTDTREd")
    end
end
This is how I do all my slash commands.
  Reply With Quote
01-07-11, 04:08 PM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Or rather...

Code:
SLASH_MEOW1 = "/meowbyme"
SLASH_MEOW2 = "/meow"
SLASH_MEOW3 = "/mbm"
function SlashCmdLis*****OWONE(msg)
    if msg == "one" then
        --do something
    elseif msg == "two" then
        --do something else
    end
end
/meowbyme, /meow, and /mbm are all aliases for the same slash command. Whatever you type afterwards is passed to the msg variable. (ex: /meow two)
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh


Last edited by Seerah : 01-07-11 at 04:10 PM.
  Reply With Quote
01-08-11, 11:14 AM   #8
goodstuff
A Murloc Raider
Join Date: Jan 2011
Posts: 5
Still broken

So I tried condensing into one lua to make it easier and I read everyone's how to on the slash commands but it still doesn't work. If someone could read my code and tell me what the problem is, I would greatly appreciate it. The latest one is attached below. When I do any of my slash commands wow says /help for a listing of commands like my addon isn't even there, I followed the correct syntax perfectly and I am still having problems. I have lua errors on and I get no errors popping up anywhere along the line.
Attached Files
File Type: lua Meow.lua (10.3 KB, 685 views)

Last edited by goodstuff : 01-08-11 at 11:19 AM.
  Reply With Quote
01-08-11, 01:06 PM   #9
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
I hope this gives the idea what I meant with local where possible.
And you should take another look when/how savedvariables are loaded

Meow.lua

Toc

Code:
## Interface:40000
## Title: Meow
## SavedVariablesPerCharacter: MeowDB

Meow.lua
I have changed the order of some functions so that they are found by the calling functions.

Edit: After uploading I see that validateSpell and the other stuff down there should be higher in the code ...
__________________
The cataclysm broke the world ... and the pandas could not fix it!

Last edited by Rilgamon : 01-08-11 at 01:11 PM.
  Reply With Quote
01-08-11, 03:33 PM   #10
goodstuff
A Murloc Raider
Join Date: Jan 2011
Posts: 5
So it seems to work a little better now with what you posted, thanks for all the help. I raised up all the verify spell and other stuff to higher. All of the /meownumber help are all showing up all their helps but when I do /meownumber Spell.. it prints "spell has been added" as it should but only spells set under /meowone play a meow. Spells added under any number other than one do not play a spell but they still print that it has been added. Moreover if i do say /meowfour meowfour (sets the meowfour meow to meowfour sound) it changes the /meowone spells sounds to meowfour or sometimes 2 of the meowsounds are played at once and meowfour spells still play no sound.

Ok I found some typos, works good now! Thanks for everyone's help.

Last edited by goodstuff : 01-08-11 at 05:07 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » New Mod help


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off