Secret Santa 2024
emm i have a question..

i=0

local function press(key)
if key==string.byte("o") then
i=i+1
end

local function tellme()
if i=1 then
echo("you press once")
elseif i=2 then
echo("you press twice")
elseif i=3 then
echo("how about stop clicking it already?")
end

add_hook("press","the key", press)
whats wrong here?..
i need to get different echo depends what time i clicked on "o" key...
but this script dnt work..
tell me about aikido
~referencing Dark Souls in suicidal threads since 13/01/15
Originally Posted by snake View Post
emm i have a question..

i=0

local function press(key)
if key==string.byte("o") then
i=i+1
end

local function tellme()
if i=1 then
echo("you press once")
elseif i=2 then
echo("you press twice")
elseif i=3 then
echo("how about stop clicking it already?")
end

add_hook("press","the key", press)
whats wrong here?..
i need to get different echo depends what time i clicked on "o" key...
but this script dnt work..

Firstly you need to end your ifs, like you do with functions.
Secondly you need to use == (two equals signs) to compare, one equals sign is a set statement, a = b will set a as b where as a == b will return true if a is equal to b.
Thirdly, you never call the tellme function.
Finally there isn't a hook called "press", you'll want "key_down" or "key_up"
i=0

local function press(key)
    if key==string.byte("o") then
        i=i+1
        tellme()
    end
end

local function tellme()
    if i == 1 then
        echo("you press once")
    elseif i == 2 then
        echo("you press twice")
    elseif i == 3 then
        echo("how about stop clicking it already?")
    end
end

add_hook("key_down","the key", press)
:D
You never executed the tellme function, and you need some ends there.
i=0

function mainfunc(key)
if key==string.byte("o") then i=i+1 end
if i==1 then echo("you press once") elseif i== 2 then echo("you press twice") elseif i==3 then echo("how about stop clicking it already?") end
end

add_hook("key_down","",mainfunc)
That should work.


Blam is a ninja, by the way.
multiple texture uploader! updated: multiple texture remover!
updated pretty colorlist!

<BobJoelZ> ok ive just rebooted my pc and ive tried to activate my reflex on yahoo internet explorer :/ no luck

<Aracoon> I do not enjoy having anal sex with multiple men
Could any of you guys tell me if a mod can load a lua script by itself, so the mod's behavior can be affected or automated by this script?

I mean... it would be nice if I could make a mod and a lua script, maybe embedded, or loaded on the fly once the user loads the mod file. Is it possible?
It's possible if you have a "mother" script that executes a script when you load a mod.
I can do that.
multiple texture uploader! updated: multiple texture remover!
updated pretty colorlist!

<BobJoelZ> ok ive just rebooted my pc and ive tried to activate my reflex on yahoo internet explorer :/ no luck

<Aracoon> I do not enjoy having anal sex with multiple men
Do you mean... a Lua script that loads a mod file and another lua script along with it?

But could it be used in online matches, just like current mods?

Sure every player in the mod will have to have a copy of the script. The mod is downloaded by the system just as a player get into room running that mod, but what about the respective Lua script?
DeFransen has planned this in the DeScript for a while now, I don't know where is at.
Concerning online it should not work as the script should be executed by the server itself for it to affect the behavior of the match.
[FROG] - [Toribash-FR] - [OLDA] - \m/
Français, english: Click
Yes.. you are right.. so I think the answer is.. NO.. we can't have a mod automated with a Lua script, at least in online matches... Thank you, guys!