-
Posted by xp46290 on Wed, 07 Apr 2010 20:41:59
hey everyone need a little advice. Just bought the second edition of the book and need a little bit of advice already. I am brand new to programming. I've seen it but i've never typed or written any code. I've been playing wow for a few months after it came out. I use alot of addons and picked up the book because i was interested in how they were developed and written and such.
Anyhow on to the question. In the first addon the text talks about writing is the HeyThere one. Now in the book its in like paragraph form, however, i downloaded the addon off the site and its all smashed together. Are you supposed to type it this way? Also i have tried typing it exactly like the one off the website and it still does not work. Its word for word, space for space, capital letters and all. Still nothing. When i copy the addon files off the site and just use those it works as depicted. So, how do you determine the spaces and such when reading code? They look like its just tabbed between strings but i counted it and its 4 spaces then 8 spaces for the If then else statements.
Like i said i have zero knowledge about coding but am trying to learn. I will post better examples if need be.
-
Posted by jnwhiteh on Sat, 10 Apr 2010 10:55:53
hey everyone need a little advice. Just bought the second edition of the book and need a little bit of advice already. I am brand new to programming. I've seen it but i've never typed or written any code. I've been playing wow for a few months after it came out. I use alot of addons and picked up the book because i was interested in how they were developed and written and such.
Anyhow on to the question. In the first addon the text talks about writing is the HeyThere one. Now in the book its in like paragraph form, however, i downloaded the addon off the site and its all smashed together. Are you supposed to type it this way? Also i have tried typing it exactly like the one off the website and it still does not work. Its word for word, space for space, capital letters and all. Still nothing. When i copy the addon files off the site and just use those it works as depicted. So, how do you determine the spaces and such when reading code? They look like its just tabbed between strings but i counted it and its 4 spaces then 8 spaces for the If then else statements.
I suspect that you're using Windows, and that is actually the primary problem. All development I do is on Mac/Unix and the files are formatted thus. Windows 'Notepad' application doesn't know how to properly read non-windows linefeeds and so things come up all smashed together. If you open it with Wordpad instead of Notepad you'll see the difference. When actually writing code on Windows, I tend to use SCiTe, which is a text editor that takes care of all of this for you.
Whitespace in addons normally doesn't make a difference because Lua (the programming language) doesn't necessarily require any spaces or line feeds in order to function properly (in most cases). I'd suggest downloading SCiTE or another 'real' editor and trying to type the code in as it's listed in the book. Then we can work out any issues you might run into.
Like i said i have zero knowledge about coding but am trying to learn. I will post better examples if need be.
We're all learning to some degree or another!
-
Posted by xp46290 on Sun, 11 Apr 2010 01:22:34
Excellent! I never even thought that windows would be the problem lol. Thanks so much now time to go on to the next chapter and so on. I was thinking about getting a mac anyhow, but thanks to that suggested program i won't have to now! Thanks again.
-
Posted by scarface12321 on Sun, 13 Jun 2010 21:39:41
I have run into this problem too. I've downloaded SCiTe and used it, but I get his same problem for HeyThere!: When I try /hey or /heythere, it won't allow the chatbox to accept it. Any other slash command works except the /hey and /heythere. I disabled the addon and /hey now does "Locknëss (my toon) greets everyone with a hearty hello."
Help me. Please.
-
Posted by jnwhiteh on Sun, 13 Jun 2010 22:36:01
You need to go through the same steps that we've already done with the original poster. I can't help you unless you provide more information.
- Is the addon listed in the addon selection screen?
- Are Lua errors enabled?
- Are you getting an error?
Failing that, post the code on http://pastebin.ca or http://pastey.net so I can look at them.. but I can't do much on my own here.
-
Posted by scarface12321 on Mon, 14 Jun 2010 08:28:05
nope no lua errors or anything. when the addon is enabled, doing /hey and /heythere, hitting enter or return will not close the chatbox, not accepting the slash command. Thats all there is. I guess It's just because i'm using windows. MAKE A BOOK FOR THE 90% OF US WHO USE PC!!!
-
Posted by jnwhiteh on Mon, 14 Jun 2010 09:56:02
nope no lua errors or anything. when the addon is enabled, doing /hey and /heythere, hitting enter or return will not close the chatbox, not accepting the slash command.
This indicates that an error is occurring, quite clearly. Why the error is not being display is not something I can help you with without the code, which I've asked you to post.
Thats all there is. I guess It's just because i'm using windows. MAKE A BOOK FOR THE 90% OF US WHO USE PC!!!
I really don't like your tone. There is no need to get snatchy or bitchy in an online forum. I have over 10,000 readers, and many or most of them use Windows machines quite successfully to write addons. There is nothing that is non-windows specific in the book, so please calm yourself down.
If you'd like to answer the questions I've asked and provide me with the information I've requested I will do my best to help you. But you need to check your attitude first. I am not here to be, and I will not be abused.
You're also missing the point of my response to the original post. The issue was not that he was writing code using windows.. there's no issue with that at all. The issue was he was downloading the files from the website and then using an incapable text editor to open them. In particular he was using Notepad which is incapable of handling sane newline characters. This caused all of the code to run together and be completely unreadable. If you read that post again, you'll see I suggested he use 'WordPad' which is included on all Windows machines by default, and is capable of handling newline characters properly.
That's it. There's nothing else that even remotely has anything to do with Microsoft Windows.
Please answer my questions, and post the code as I have already requested.
-
Posted by scarface12321 on Mon, 14 Jun 2010 10:53:23
my bad. no harm intended. I just hope the problem isn't something i can't change.
SLASH_HEYTHERE1 = "/hey" SLASH_HEYTHERE2 = "/heythere" SlashCmdList["HEYTHERE"] = function(self, txt) if UntitExists("target") then SendChatMessage("Hello " ..UnitName("target"), "SAY") else SendChatMessage("Hey there everybody!") end end
Also, i'm not sure why I cannot access the files on the website like the book is asking. It says "Sorry, you are not allowed to do this."
-
Posted by jnwhiteh on Mon, 14 Jun 2010 11:42:25
my bad. no harm intended. I just hope the problem isn't something i can't change.
SLASH_HEYTHERE1 = "/hey" SLASH_HEYTHERE2 = "/heythere" SlashCmdList["HEYTHERE"] = function(self, txt) if UntitExists("target") then SendChatMessage("Hello " ..UnitName("target"), "SAY") else SendChatMessage("Hey there everybody!") end end
You've misspelled
UnitExists
asUntitExists
. That is likely the case of the issue.Also, i'm not sure why I cannot access the files on the website like the book is asking. It says "Sorry, you are not allowed to do this."
What file are you trying to download and from where? Please post the link.
-
Posted by scarface12321 on Mon, 14 Jun 2010 17:22:56
wow...how did I miss that... It works now thanks =)
and the link in the book is http://wowprogramming.com/chapters/first-edition/01
I was trying to get to the example files, thinking maybe if i compare them side by side I would find out.
But the site map takes me to http://wowprogramming.com/profile/book_edition.edit&prototype= when I go to Chapter => Basics
-
Posted by jnwhiteh on Mon, 14 Jun 2010 17:36:13
Just go here:
http://wowprogramming.com/profile/book_edition
Then select which edition of the book you own, and it'll direct you to the right chapter section.
-
Posted by scarface12321 on Mon, 14 Jun 2010 19:16:31
thank you very much =) once again sorry for the caps lock.
-
Posted by jnwhiteh on Mon, 14 Jun 2010 19:19:03
No worries at all.