What should I add to be safe for pvp servers?
Printable View
What should I add to be safe for pvp servers?
error in Persistent script NewPersistentScript:
[" if dmg >= minDmgTak..."]:NewPersistentScript:23 attempt to compare number with string
init start
-- local SCRIPT_VERSION = '1.1.1'
local invisCreatures = {'Stalker'}
local stuckTime = 0 -- Set to 0 to always attack
local minDmgTaken = 0 -- Set to 0 to always attack
local spellToUse = 'thunderstorm rune'
-- DO NOT EDIT BELOW THIS LINE --
table.lower(invisCreatures)
local spellToUseInfo, spellType = spellinfo(spellToUse), 'spell'
if spellToUseInfo.castarea == 'None' then
spellToUseInfo, spellType = runeinfo(spellToUse), 'rune'
end
init end
auto(100)
if $standtime >= stuckTime then
foreach newmessage m do
if m.type == MSG_STATUSLOG then
local dmg, _, name = m.content:match(REGEX_DMG_TAKEN)
if dmg >= minDmgTaken and name and table.find(invisCreatures, name:lower()) and maround(7, name:lower()) == 0 then
if spellType == 'spell' and cancastspell(spellToUseInfo) then
cast(spellToUseInfo.words)
waitping()
elseif spellType == 'rune' then
useoncreature(spellToUseInfo.itemid, $self)
waitping()
end
end
end
end
end
How do I make mindmgTaken into a number?
Could you do this:
auto(100)
if $standtime=>3000 && $zpos=15 && maround(7)=>3
useoncreature("thunderstorm rune", $self)
wait(2000)
@Sea take this.
@Raphael didn't conver string to number, nooba!
init start
-- local SCRIPT_VERSION = '1.1.1'
local invisCreatures = {'Stalker'}
local stuckTime = 0 -- Set to 0 to always attack
local minDmgTaken = 0 -- Set to 0 to always attack
local spellToUse = 'thunderstorm rune'
-- DO NOT EDIT BELOW THIS LINE --
table.lower(invisCreatures)
local spellToUseInfo, spellType = spellinfo(spellToUse), 'spell'
if spellToUseInfo.castarea == 'None' then
spellToUseInfo, spellType = runeinfo(spellToUse), 'rune'
end
init end
auto(100)
if $standtime >= stuckTime then
foreach newmessage m do
if m.type == MSG_STATUSLOG then
local dmg, _, name = m.content:match(REGEX_DMG_TAKEN)
if dmg and tonumber(dmg) >= minDmgTaken and name and table.find(invisCreatures, name:lower()) and maround(7, name:lower()) == 0 then
if spellType == 'spell' and cancastspell(spellToUseInfo) then
cast(spellToUseInfo.words)
waitping()
elseif spellType == 'rune' then
useoncreature(spellToUseInfo.itemid, $self)
waitping()
end
end
end
end
end
so dmg is a string and by adding tonumber(dmg) you convert the string to number?\
xd new error: error in Persistent script NewPersistentScript:
[" if tonumber(dmg) >=..."]:NewPersistentScript:27 attempt to compare number with nil
No error when enabling script will see when it works when I deposit.
If it doesnt I will try my own pro scriptauto(200)
if $standtime >= 7000 and $posz==15 and maround(7)>=3 and itemcount('thunderstorm rune')>=0 then
useoncreature("thunderstorm rune", $self)
wait(2000)
end
Q: What difference does 'blabla' make with "blabla"? So between single ' and double "
Hmm ok so u can include people with ' in character names. Completed demon oak on a character today gotta see if script is running good and get next char on the task.
Oh, thanks for letting me know after 2 months.
You can include ' inside strings quoted with ' too, but you gotta escape it with \:
print('Raphael\'s da best') -- Raphael's da best
print("She said: \"Raphael's da best\"") -- She said "Raphael's da best"