Blockland Forums > Suggestions & Requests

Smoking

Pages: << < (5/14) > >>

Lugnut:


--- Quote from: ¥ola on June 18, 2012, 12:45:35 AM ---How do I call one function through another function is basicly what I'm trying to ask.

--- End quote ---
did you read my post
or even elms uncommented post


or maybe
--- Quote from: heedicalking on June 18, 2012, 12:49:40 AM ---or you could just mount emitter to image and loop through states >_>

--- End quote ---
maybe you could do it this way, like it's supposed to

¥ola:

Well I ran into a problem.

First off, when I use /smoke it does toggle between the messages
Problem #1: It shows %name SPC you are now smoking.
Not
Yola you are now smoking.

Problem #2: Smoking never happens.

I'm off to bed for now, maybe you'll leave me some helpful info in the morning.

Script as of now:


--- Code: ---function serverCmdSmoke(%client)
{
switch($smoketoggle)
{
case true:
$smoketoggle = false;
SmokeLoop(1);
%name = $Pref::Player::NetName;
messageClient(%client,'',"\c6%name SPC you are now smoking");

case false:
$smoketoggle = true;
SmokeLoop(0);
%name = $Pref::Player::NetName;
messageClient(%client,'',"\c6%name SPC you are done smoking");
}
}

function Smoke(%client)
{
serverplay3d(Smokingsound,%client.player.getHackPosition() SPC "0 0 1 0");
echo(%client.name @ " smoke");
%client.player.setWhiteout(0.5);
%client.player.emote(DrugsmokeImage);
}

function SmokeLoop(%on)
{
cancel($SmokeSchedule);
if(!%on)
return;
Smoke(1);
%time = getrandom(1000,2000);
$SmokeSchedule = schedule(%time, 0, SmokeLoop, 1);
}
--- End code ---


Lugnut:

what the forget is that formatting holy stuff

found your problem

messageClient(%client,'',"\c6%name SPC you are now smoking");

lets blow this up so it's easier to read

"\c6%name SPC you are now smoking"

observe

"\c6" @ %name SPC "you are now smoking"

also your word choice is abysmal, not to mention various other errors that will crop up.
let me do this:


--- Code: ---function serverCmdSmoke(%this)
{
SmokeLoop(%this.isSmoking);
messageClient(%this, '', "\c6" @ %this.getPlayerName() SPC "is no((%this.isSmoking) ? "w" : " longer") SPC "smoking."
%this.isSmoking = !%this.isSmoking;
}

function GameConnection::Smoke(%this)
{
// echo(%client.name @ " smokes"); //debug
// %client.player.setWhiteout(0.5); //why
if(isObject(%this.player))
%this.player.emote(DrugsmokeImage);
}

function GameConnection::SmokeLoop(%this, %on)
{
cancel(%this.SmokeSchedule);
if(!%on)
return;
%this.Smoke();
%this.SmokeSchedule = %this.schedule(getrandom(1000, 2000), SmokeLoop, 1);
}
--- End code ---
Where is drugSmokeImage defined?

Electrk:

^puffs his cigar

Lugnut:


--- Quote from: Electrk on June 18, 2012, 01:15:36 AM ---^puffs his cigar

--- End quote ---
late noob is late
--- Quote from: Lugnut1206 on June 17, 2012, 11:59:15 PM ---Abram Terger puffs his cigar.

--- End quote ---


Pages: << < (5/14) > >>

Go to full version