Jump to content
  • 0

variable -> label?


Hell

Question


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  25
  • Reputation:   0
  • Joined:  10/21/12
  • Last Seen:  

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;

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Would this not work the same way?

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

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.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

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.
Link to comment
Share on other sites

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.

×
×
  • Create New...