Log in

View Full Version : Function gotoLabel



L!p3
06-07-2012, 02:36 PM
Hello,

Ive been trying to do a function like this:


function cPosZ(posz, toback) --posz = Your z Position, toback = Label to go back.
if (Self.Position().z ~= posz) then
gotoLabel(tostring(toback))
end
end

But is not working, if I type the Label name instead of 'toback' it works but I want to set is a variable.
Could some1 help me to do that?

Thanks,
L!p3.

Infernal Bolt
06-07-2012, 03:26 PM
removing the tostring() thingy and adding your label with " around it will probably work.

L!p3
06-07-2012, 03:29 PM
removing the tostring() thingy and adding your label with " around it will probably work.

I can't try that cause the label name has a limited number of characters, I can't let it as: cPosZ(6, "Pos01").
Anyway I ddnt tryed that, Ill check and Edit the post asap.

Edit:
Can't even try, no way to write so many caracters..
But If its like cPosZ(toback) and toback = "Pos01" it worked.

Thanks =)

Infernal Bolt
06-07-2012, 03:36 PM
Yes you can, just change the label name in notepad, it works.

L!p3
06-07-2012, 03:49 PM
Yes you can, just change the label name in notepad, it works.

I did it, but if the label name contain " it wont load, no matter how many characters.
And with tostring() didn't worked.

<item text="cPosZ("Pos01"):" tag="255"/>
I think It read as: "cPosZ(" and later "Pos01" and ):"..

Got it?

XtrmJosh
06-07-2012, 04:55 PM
function cPosZ(posz, toback) --posz = Your z Position, toback = Label to go back.
if (Self.Position().z ~= posz) then
gotoLabel("toback")
end
end

Fixed?

L!p3
06-07-2012, 05:42 PM
function cPosZ(posz, toback) --posz = Your z Position, toback = Label to go back.
if (Self.Position().z ~= posz) then
gotoLabel("toback")
end
end

Fixed?

No, It will gotoLabel named as toback, not exectued as a variable so If u don't have this label it gonna just skip.

Infernal Bolt
06-07-2012, 06:05 PM
try it with ' then

L!p3
06-07-2012, 06:15 PM
try it with ' then

With ' worked! Thanks a lot guys!