Jump to content
  • 0

variable -> label?


Question

Posted

Is it possible to make a label that change.

For example

Prontera,59,50,4 script npcnamewqe 100,{

If(something)goto main menu;

else goto .@varlable$

main menu:

Mes "";

Input .@varlable$

Close;

7 answers to this question

Recommended Posts

Posted

No you can't store a label into a variable, you will save its value (numerical) but not it's type.

But as far I know you can send a label as an argument to a function or return a label from a function.

Well, I think you should re-organize your code to avoid using this structure :)

  • Upvote 2
Posted

Would this not work the same way?

input .@str$;
if (.@str$ == "menu1") {}
else if (.@str$ == "menu2") {}
else {}

I think he want to jump in different labels depending on the input.

Ex: you input "hello", and you jump to hello: label.

There's a nice way to do this, just use functions instead of labels, getd() and callfunc to recall that particular label. Honestly, I did similar things long ago in eAthena and it worked fine, so I believe this can work on rAthena as well.

Posted

There's a nice way to do this, just use functions instead of labels, getd() and callfunc to recall that particular label.

Functions aren't labels either, and I can't see why conditionals wouldn't be a better solution.

Posted
Functions aren't labels either, and I can't see why conditionals wouldn't be a better solution.

He wanted to make it dynamically, that's why if() statements wouldn't be enough I think.

Posted

Or you can use:

input .@label$;
doevent strnpcinfo(3) + "::" + .@label$;
end;

But I still think there is no need to jump to a dynamic label if your code is structured.

Agree.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...