• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Skill Scroll problem

SoCzek

New Member
Joined
Apr 9, 2017
Messages
14
Reaction score
0
Maybe you will help me with the message like I'm losing server. This is a SkillScrolls script

[Warning - Event::checkScript] Can not load script: scripts/skillscroll.lua
data/actions/scripts/skillscroll.lua:3: '=' expected near 'function'
[Warning - Event::checkScript] Can not load script: scripts/scrollwindow.lua
data/creaturescripts/scripts/scrollwindow.lua:5: '=' expected near 'local'
[Warning - Event::checkScript] Can not load script: scripts/scrollwindow.lua
data/creaturescripts/scripts/scrollwindow.lua:5: '=' expected near 'local'

Action - [TFS 1.2] Skill scroll (uses stamina)
 
Show us the table you edited in both scripts skillscroll & scrollwindow

This is line 3 of skillscroll
Lua:
function Player:sendSkillVoucherWindow()

This is line 5 of scrollwindow
Lua:
local staminaCost = 6 * 60

But above both these lines is this table
Lua:
local skills = {"Magic Level", "Fist Fighting", "Club Fighting", "Sword Fighting", "Axe Fighting", "Distance Fighting", "Shielding", "Fishing"}
 
SCROLLWINDOW:


local rate = configManager.getNumber(configKeys.RATE_SKILL)
local magic = configManager.getNumber(configKeys.RATE_MAGIC)
local skills = {"Magic Level", "Fist Fighting", "Club Fighting", "Sword Fighting", "Axe Fighting", "Distance Fighting", "Shielding", "Fishing"}
local staminaCost = 6 * 60
local voucherTries = math.floor((staminaCost * 1000) / 2)
local voucherId = 23672
function onModalWindow(player, modalWindowId, buttonId, choiceId)
if modalWindowId ~= 7092 then
return false
end

if buttonId ~= 1 then
return false
end

local voucher = player:getItemById(voucherId, true)
if not voucher then
-- avoids using scroll without removing one
player:sendTextMessage(MESSAGE_INFO_DESCR, "Put the scroll in your backpack first.")
return false
end

if not skills[choiceId] then
return false
end

local stamina = player:getStamina()
if stamina < staminaCost then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You need at least " .. math.floor(staminaCost/60) .. " hours of stamina to do that.")
return false
end

local gain = 0
local maxskill = false



if choiceId == 1 then
-- database limit
if player:getManaSpent() > 4294967295 then
maxskill = true
else
gain = voucherTries * magic * 75
player:addManaSpent(gain)
end
else
-- beyond certain point player won't receive skill tries anymore
-- probably something in sources
gain = voucherTries * rate
local tries = player:getSkillTries(choiceId - 2)
player:addSkillTries(choiceId - 2, gain)
if tries == player:getSkillTries(choiceId - 2) then
maxskill = true
end
end

if maxskill then
player:sendTextMessage(MESSAGE_INFO_DESCR, "Final skill state reached. You cannot improve any further.")
return true
end

player:setStamina(stamina - staminaCost)
player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_RED)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You earned " .. gain .. " points on " .. skills[choiceId] .. ". " .. staminaCost .. " minutes of stamina used.")
voucher:remove(1)
return true
end
function onLogin(player)
player:registerEvent("skillScrollWindow")
return true
end


SKILL SCROLL

local skills = {"Magic Level", "Fist Fighting", "Club Fighting", "Sword Fighting", "Axe Fighting", "Distance Fighting", "Shielding", "Fishing"}
function Player:sendSkillVoucherWindow()
local modaltext = "Select skill you would like to improve:"
local modal = ModalWindow(7092, "Use voucher", modaltext)
for i = 1, #skills do
modal:addChoice(i, skills)
end

modal:addButton(1, "Select")
modal:setDefaultEnterButton(1)
modal:addButton(2, "Cancel")
modal:setDefaultEscapeButton(2)
return modal:sendToPlayer(self)
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
player:sendSkillVoucherWindow()
return true
end
 
Off hand I don't really know what to make of the issue, so lets start with a series of question and possibly find a solution.

1. Are you using tfs 1.2?
2. Did you make any changes to the script or did you just copy and paste it into its appropriate files/directories.
3. Are you using a clean 1.2 build (no source edits)?
 
Back
Top