THANKS i will go learn from there but i want someone to go step by step like ask him is that right i know its hard to find someone and do it for free cuz its a waste of time with him
Nobody will always have time for you. You gotta learn by yourself and the link provides you with just what you might need as a beginner. If you get stuck somewhere just open a thread in the support forumsTHANKS i will go learn from there but i want someone to go step by step like ask him is that right i know its hard to find someone and do it for free cuz its a waste of time with him
@Evan @Ninja and @Limos teached me.Nobody will always have time for you. You gotta learn by yourself and the link provides you with just what you might need as a beginner. If you get stuck somewhere just open a thread in the support forums![]()
ok thxif u need nice teacher so u must call limos "best one here and best teacher im coming here noob 0 idea about anything now i can do alot of things and there alot ppl i helped him and you one from them " again best teacher here limos
that's 2nd step imo.My tip is to skip tutorials on otland, there is pretty much nothing good in them except what you can do with the functions.
Search for lua on google, there you will find better ways and alot more things about lua itself.
Once you can write simple programs in ex: www.lua.org/cgi-bin/demo
Then you can start looking into luascript.cpp, you will find all of your source listed functions there.
After that you have your global.lua / library files to read aswell to see functions that are not listed in your source code.
that's 2nd step imo.
But yeah good thing too.
After you learn the luascript.cpp You can start doing PERFECT functions to Global.lua
And ALL your things what you wana add to game are 1 liners(OP !! makes making ot very easy to config)
i know but i said after you learn the. because that what exactly happens with your scripting if you start learn all these luascripts.cpp functionsWell not really, the thing I wanted to get out(as I suppose you have no experience with) is that the functions are listed in the luascript.cpp file.
https://github.com/otland/forgottenserver/blob/master/src/luascript.cpp#L2172
If ex. you read that you would know there is a function with the class Creature named getHealth, if you then go to:
https://github.com/otland/forgottenserver/blob/master/src/luascript.cpp#L7725
We can now see it does not require any parameters.
And I said "looking into" not "After you learn the".
i know but i said after you learn the. because that what exactly happens with your scripting if you start learn all these luascripts.cpp functions
function onSmth() local player = Player(cid) if(not player) then return false end print(player:getName(), player:getHealth()) end
yeah, but custom functions constructed from lua meta functions![]()
So if I read the luascript.cpp file I will automatically write scripts like this?
Code:function onSmth() local player = Player(cid) if(not player) then return false end print(player:getName(), player:getHealth()) end
And I also told him to read up on lua first, he will notice things like indentation aswell as things about statments, boolean, nil, etc etc
yeah, but custom functions constructed from lua meta functions
function getThing(player)
return player:thing()
end
Example:Could you explain abit more?
Not really understanding you.
Are you talking about using old functions on 1.1?
Code:function getThing(player) return player:thing() end
Or that he would over write functions with global.lua?
---------- SYSTEMS
if msgcontains(msg, 'trade') then
shopSystem(cid, getTable(Player(cid)))
end
if msgcontains(msg, 'mission') then
noMissions = exploreMissionsSystem(cid, exploreMissions, noMissions)
noMissions = collectingMissionsSystem(cid, collectingMissions, noMissions)
noMissions = dailyExploreMissionsSystem(cid, dailyExploreMissions, daily, noMissions)
missionBoolean(cid, noMissions)
end
if msgcontains(msg, "report") then
noReport = reportExploreMissions(cid, exploreMissions, dailyExploreMissions, noReport)
noReport = reportExploreDailyMissions(cid, dailyExploreMissions, noReport)
noReport = reportCollectingMissions(cid, collectingMissions, noReport)
findNewMission(cid, collectingMissions)
for k,v in pairs(collectingMissions) do
if getPlayerStorageValue(cid, collectingMissions[k].storageId) ~= -2 then
daily = false
end
end
if daily then
findNewMission(cid, dailyExploreMissions, daily)
end
reportBoolean(cid, noReport)
end
Example:
Whenever want mission type for him i just add 1 new line of one of these custom scripts.Code:---------- SYSTEMS if msgcontains(msg, 'trade') then shopSystem(cid, getTable(Player(cid))) end if msgcontains(msg, 'mission') then noMissions = exploreMissionsSystem(cid, exploreMissions, noMissions) noMissions = collectingMissionsSystem(cid, collectingMissions, noMissions) noMissions = dailyExploreMissionsSystem(cid, dailyExploreMissions, daily, noMissions) missionBoolean(cid, noMissions) end if msgcontains(msg, "report") then noReport = reportExploreMissions(cid, exploreMissions, dailyExploreMissions, noReport) noReport = reportExploreDailyMissions(cid, dailyExploreMissions, noReport) noReport = reportCollectingMissions(cid, collectingMissions, noReport) findNewMission(cid, collectingMissions) for k,v in pairs(collectingMissions) do if getPlayerStorageValue(cid, collectingMissions[k].storageId) ~= -2 then daily = false end end if daily then findNewMission(cid, dailyExploreMissions, daily) end reportBoolean(cid, noReport) end
Since the luascript.cpp are going deep into basic its easy to make these functions to work.
This used to be ~300-400 lines long scripts now its ~30-40 lines
If you look the luascript.cpp choose a method and find the function. You will same thing.
if(thing) {
x
} else if(anotherThing) {
y
} else {
z
}
if(thing) then
x
elseif(anotherThing) then
y
else
z
end
because i dont want to?No offence but you did not do as I explain in that case.
While you are learning about lua you will learn things like if statments, the if, elseif, else etc.
And I still don't get how and why you not nest your statments if you read the luascript.cpp file?
They also nest the statments if it is needed, diffrence is how they are written out:
Code:if(thing) { x } else if(anotherThing) { y } else { z }
Code:if(thing) then x elseif(anotherThing) then y else z end