Page 1 of 2

Text output

Posted: Sat Dec 29, 2012 10:02 pm
by stochastic
Since, as far as I can understand, you cannot use any "wait" function in your scripting, I have decided to do something else.

Is it possible to show wall text to the player in a script?

for instance, he/she touches a lever, it doesn't work (message pops up, saying: "bla bla")?

Thanks,
-Stochastic

Re: Text output

Posted: Sat Dec 29, 2012 10:05 pm
by Hariolor
in your script you'd use something like

Code: Select all

function notworking()
hudPrint("It didn't work!")
end
To create literal wall script when the lever's pulled, you'd have to spawn a wall_text entity which gets a little more involved.

*edit: made it a separate function to be more explicit - could also be buried in an existing function...not sure how you wanted to use it

Re: Text output

Posted: Sat Dec 29, 2012 10:08 pm
by stochastic
Yeah it is nice enough, and I am using that atm. - however I was wondering if you could get the same output as when you read/click a wall-txt :)

Re: Text output

Posted: Sat Dec 29, 2012 10:16 pm
by stochastic
--Resets lever if riddle is not complete
function resetlever1()
if tsl1:getLeverState() == "activated" and
tst1:hasTorch() == true then
tsl1:setLeverState("deactivated")
hudPrint("It seems stuck! ...")
else
tsl1:setLeverState("activated")
end
end

The problem with this script is, that if I remove the torch and place back in... the lever will automaticly drop down (activate) - how do I make it work only when players interact with it?

Re: Text output

Posted: Sat Dec 29, 2012 11:01 pm
by msyblade
I would try seeing how it acts without the "tsl1:setLeverState("activated")" line.

Re: Text output

Posted: Sun Dec 30, 2012 1:08 am
by Hariolor
it looks like what you're trying to do is make the lever only work if the torch is removed first...

consider something like this - have the lever trigger it only when activated?

Code: Select all


function resetlever1()
  if tst1:hasTorch() == true 
    then
    hudPrint("It seems stuck! ...")
    tsl1:setLeverState("deactivated")
    else
    [do whatever you want it to do- door:open() etc]
  end
end


Re: Text output

Posted: Sun Dec 30, 2012 5:55 pm
by stochastic
He keeps saying "it is stuck" if I just keep removing and adding the torch :(

Re: Text output

Posted: Sun Dec 30, 2012 6:02 pm
by stochastic
Else I should make the torch activate LUA script if it is activated itself - and deactivate Lua script if it is deactivated (removed)

Re: Text output

Posted: Sun Dec 30, 2012 6:04 pm
by stochastic
NEVERMIND... couldn't do that :'(

Re: Text output

Posted: Sun Dec 30, 2012 6:25 pm
by stochastic
The problem was that my torch was "activating" the Lua script ... It now works -.-