Wavoz
Oldschooler
- Joined
- Jul 10, 2011
- Messages
- 1,009
- Reaction score
- 81
Hello
I have been surfing on lua.org but finding answers to your questions is difficult when you are not native English speaker, so i need to understand few things. I pretty much understand what some functions do and i know how to fix some problems and i can modify scripts for my own need but i can't make script from scratch. I just realized i've been using this same style for a while and i don't quite understand it.
Ive made this script: (Summons Assassin if you use sleeping body on a bed)
What does ~= 1 means? I understand that ==1is like "yes", so ~=1 is like no? Can i use ==0 as no? Are these numbers like conditions because sometimes they go over 1, 2, 3?
I would appreciate if someone could explain me.
I have been surfing on lua.org but finding answers to your questions is difficult when you are not native English speaker, so i need to understand few things. I pretty much understand what some functions do and i know how to fix some problems and i can modify scripts for my own need but i can't make script from scratch. I just realized i've been using this same style for a while and i don't quite understand it.
Ive made this script: (Summons Assassin if you use sleeping body on a bed)
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local storageValue = 26000
if(getPlayerStorageValue(cid, storageValue) ~= 1) then
doSummonCreature("Assassin", getClosestFreeTile(cid, getThingPos(cid)))
doSendMagicEffect(toPosition,12)
doPlayerSendTextMessage(cid, 22, 'You have woken the Assassin!')
setPlayerStorageValue(cid, 26000, 1)
return true
end
if(getPlayerStorageValue(cid, storageValue) == 1) then
doPlayerSendTextMessage(cid, 22, 'Assassin is in a deep sleep, do not push your luck again!')
end
return TRUE
end
What does ~= 1 means? I understand that ==1is like "yes", so ~=1 is like no? Can i use ==0 as no? Are these numbers like conditions because sometimes they go over 1, 2, 3?
I would appreciate if someone could explain me.