Quantcast Broken script - LoTROInterface
VGInterface.com
Search Downloads


Go Back   LoTROInterface > LotRO > Developer Discussions > Lua Programming Help (L)

Reply
Thread Tools Display Modes
  #1  
Unread 10-11-2013, 10:21 PM
griste griste is offline
The Wary
 
Join Date: Oct 2013
Posts: 1
Broken script

run if sourceGUID == UnitName("target") then
if spellname==("Blind") then
CastSpellByName("Vanish(Rank 3)")
end
end
end

whats wrong with this
Reply With Quote
  #2  
Unread 10-12-2013, 06:00 AM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 269
Well, in terms of Lua as implemented in LotRO there's a lot wrong with that. I will try to explain line by line:

Quote:
Originally Posted by griste
run if sourceGUID == UnitName("target") then
There is no "run" key word in the Lua language and no "run" feature in LotRO Lua.
It may be that another game's Lua implementation has a "UnitName" function but no such function exists in LotRO's implementation.
EDIT: There is a UnitName function in WoW's implementation but that is specific to WoW and does not exist in LotRO.
Quote:
if spellname==("Blind") then
while not technically wrong, the parentheses are unneccessary as ("Blind") evaluates to "Blind" so this statement could be written as
if spellname=="Blind" then
Quote:
CastSpellByName("Vanish(Rank 3)")
As with "UnitName" above, there is no function "CastSpellByName" in LotRO's implementation of Lua - in fact, in LotRO, there is no way to programatically perform an action. The only way to perform an action in LotRO's Lua is to assign it to quickslot so that the end user can activate it by clicking. There is a CastSpellByName function in WoW's implementation but that is specific to WoW and does not exist in LotRO.
Quote:
end
end
end
You have three block "end" statements but you only have two code blocks. It is possible that in another implementation of Lua with a "run" statement that an "end" is needed to close the "run" but since there is no such statement in LotRO's Lua, the last "end" is also an error.
Quote:
whats wrong with this
So, to sum it up, it looks like you are asking for help with a Lua script that was not written for the LotRO implementation of Lua but rather for a different game's implementation, specifically WoW's implementation. Hopefully that answers your question. Is there something particular you are trying to implement for LotRO or were you just trying to test a code sample that you found somewhere and did not know why it doesn't work in LotRO's Lua?

If you are looking for help with a WoW script, you should probably try wowinterface.com which supports WoW and would be able to provide a better answer. I'm not sure but I believe in WoW that "run" is a macro command, "/run", in which case it should be followed by a single block of Lua code so you would need a "do" statement which would encapsulate the rest of the script and then the third "end" would be ok since it would be closing the block explicitly opened with a "do". That is, change the first line to:
/run do if sourceGUID == UnitName("target") then
but that is just a guess as I haven't written any scripts for WoW in many years so I really don't remember if that is correct for their implementation.

Last edited by Garan : 10-12-2013 at 06:36 AM.
Reply With Quote
Reply


Thread Tools
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Broken UI skins Alevyr Interface Help (L) 2 02-14-2011 04:51 AM


All times are GMT -5. The time now is 11:10 PM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | VGInterface | LoTROInterface | MMOInterface | Swtorui