Jump to content
  • 0

Teleport menu with option back to last menu


unnamed

Question


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  01/31/16
  • Last Seen:  

Hello everyone, I would like to have the option in the tabs of my npc of: "Back", so if anyone who is looking for the map and ends up clicking wrong, can go back to the previous menu. but I've done everything, and it turns out that I couldn't solve it

I have a main menu, which has " Cities, Fields, Caves "
This one does not need to have a back button, as it is the main menu.

The next menu is, let's say: Fields > Prontera Field, Payon Field... etc, Back (As a last option)
Here, I believe it is easier, because I use this code:

menu	"^3CB371[»]^000000 Campos de Amatsu.",F1, "^3CB371[»]^000000 Campos de Ayothaya",F2, "^3CB371[»]^000000 Campos de Bifrost", F3,
    	"^3CB371[»]^000000 Campos de Brasilis",F4, "^3CB371[»]^000000 Campos de Comodo",F5, "^3CB371[»]^000000 Campos de Dewata",F6,
    	"^3CB371[»]^000000 Campos de Eclage",F7, "^3CB371[»]^000000 Campos de Einbroch",F8, "^3CB371[»]^000000 Campos de El Dicastes",F9,
    	"^3CB371[»]^000000 Campos de Geffen",F10, "^3CB371[»]^000000 Campos de Kunlun",F11, "^3CB371[»]^000000 Campos de Hugel",F12,
		"^3CB371[»]^000000 Campos de Lasagna",F13, "^3CB371[»]^000000 Campos de Lighthalzen",F14, "^3CB371[»]^000000 Campos de Luoyang",F15, 
		"^3CB371[»]^000000 Campos de Lutie",F16, "^3CB371[»]^000000 Campos de Malaya",F17, "^3CB371[»]^000000 Campos de Manuk",F18, 
		"^3CB371[»]^000000 Campos de Mjolnir",F19, "^3CB371[»]^000000 Campos de Moscovia",F20, "^3CB371[»]^000000 Campos de Niflheim",F21, 
		"^3CB371[»]^000000 Floresta de Payon",F22, "^3CB371[»]^000000 Campos de Prontera",F23, "^3CB371[»]^000000 Campos de Rachel",F24, 
		"^3CB371[»]^000000 Deserto de Sograt",F25, "^3CB371[»]^000000 Campos de Splendide",F26, "^3CB371[»]^000000 Campos de Umbala",F27, 
		"^3CB371[»]^000000 Campos de Veins",F28, "^3CB371[»]^000000 Campos de Juno",F29;

F1: setarray @c[2],190,197;
	Disp("^3CB371[»]^000000 Campos de Amatsu",1,1); Pick("ama_fild");
F2: setarray @c[2],173,134,212,150;
	Disp("^3CB371[»]^000000 Campos de Ayothaya",1,2); Pick("ayo_fild");

 

Here, I believe that the Menu, manages to have a ''Back'' button Easily...

But here comes the hard part!

 

F1: setarray @c[2],190,197;
	Disp("^3CB371[»]^000000 Campos de Amatsu",1,1); Pick("ama_fild");

Here, in the "Pick" segment, it makes him create a new menu with the selection ama_fild01,ama_fild02 and here, in this part I would also like him to go back to the "Fields" menu... I will post the Functions of this system and if there is any way to Add "Back" in the Fields menu and in the End menu

 

function Go {
	set lastwarp$, getarg(0);
	set lastwarpx, getarg(1,0);
	set lastwarpy, getarg(2,0);
	warp getarg(0),getarg(1,0),getarg(2,0);
	end;
}
function Disp {
	if (getargcount() < 3)
		set @menu$, getarg(0);
	else {
		set @menu$,"";
		for (set .@i,getarg(1); .@i<=getarg(2); set .@i,.@i+1)
			set @menu$, @menu$+getarg(0)+" "+.@i+":";
	}
	return;
}
function Pick {
	set .@warp_block,@warp_block;
	set @warp_block,0;
	if((@f && .OnlyFirstFld) || (@d && .OnlyFirstDun)){
		set .@select,1;
		if(.@warp_block){
			while(.@warp_block & (1<<.@select)){
				.@select += 1;
			}
		}
	}else{
		set .@select, select(@menu$);
	}
	if (getarg(0) == "") {
		set .@i, .@select;
		set .@map$, getarg(.@i);
	} else {
		set .@i, .@select-getarg(1,0);
		set .@map$, getarg(0)+((.@i<10)?"0":"")+.@i;
	}
	if (.@warp_block & (1<<.@select)) {
		message strcharinfo(0),"Este mapa não está habilitado no modo "+((checkre(0))?"":"Pre-")+"Renewal.";
		end;
	}
	set .@x, @c[.@i*2];
	set .@y, @c[.@i*2+1];
	deletearray @c[0],getarraysize(@c);
	@f = false; @d = false;
	Go(.@map$,.@x,.@y);
}
function Restrict {
	if ((getarg(0) == "RE" && !checkre(0)) || (getarg(0) == "Pre-RE" && checkre(0))) {
		if (getarg(1,0)) {
			set @warp_block,0;
			for (set .@i,1; .@i<getargcount(); set .@i,.@i+1)
				set @warp_block, @warp_block | (1<<getarg(.@i));
		} else {
			message strcharinfo(0),"Este mapa não está habilitado no modo "+((checkre(0))?"":"Pre-")+"Renewal.";
			end;
		}
	}
	return;
}
function Ret {

}

 

return.png

Return1.png

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  292
  • Reputation:   46
  • Joined:  10/30/12
  • Last Seen:  

You need to use loop/looping for make it return to the back menu.

Link to comment
Share on other sites

  • 1

  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  177
  • Reputation:   25
  • Joined:  12/24/14
  • Last Seen:  

menu	"^3CB371[»]^000000 Campos de Amatsu.",F1, "^3CB371[»]^000000 Campos de Ayothaya",F2, "^3CB371[»]^000000 Campos de Bifrost", F3,
    	"^3CB371[»]^000000 Campos de Brasilis",F4, "^3CB371[»]^000000 Campos de Comodo",F5, "^3CB371[»]^000000 Campos de Dewata",F6,
    	"^3CB371[»]^000000 Campos de Eclage",F7, "^3CB371[»]^000000 Campos de Einbroch",F8, "^3CB371[»]^000000 Campos de El Dicastes",F9,
    	"^3CB371[»]^000000 Campos de Geffen",F10, "^3CB371[»]^000000 Campos de Kunlun",F11, "^3CB371[»]^000000 Campos de Hugel",F12,
	"^3CB371[»]^000000 Campos de Lasagna",F13, "^3CB371[»]^000000 Campos de Lighthalzen",F14, "^3CB371[»]^000000 Campos de Luoyang",F15, 
	"^3CB371[»]^000000 Campos de Lutie",F16, "^3CB371[»]^000000 Campos de Malaya",F17, "^3CB371[»]^000000 Campos de Manuk",F18, 
	"^3CB371[»]^000000 Campos de Mjolnir",F19, "^3CB371[»]^000000 Campos de Moscovia",F20, "^3CB371[»]^000000 Campos de Niflheim",F21, 
	"^3CB371[»]^000000 Floresta de Payon",F22, "^3CB371[»]^000000 Campos de Prontera",F23, "^3CB371[»]^000000 Campos de Rachel",F24, 
	"^3CB371[»]^000000 Deserto de Sograt",F25, "^3CB371[»]^000000 Campos de Splendide",F26, "^3CB371[»]^000000 Campos de Umbala",F27, 
	"^3CB371[»]^000000 Campos de Veins",F28, "^3CB371[»]^000000 Campos de Juno",F29,"   Return",L_Menu;

 

and add this

// --------------------------------------------------
//    Main Menu:
// --------------------------------------------------

L_Menu:
menu    "Last Warp [ ^777777"+lastwarp$+"^000000 ]",-,
        " ~ Towns",Towns,
        " ~ Fields",Fields,
        " ~ Dungeons",Dungeons,
        " ~ Guild Castles",Castles,
        " ~ Guild Dungeons",Guild_Dungeons,
        " ~ Instances",Instances;

 

Edited by Emistry
fix formating
Link to comment
Share on other sites

  • 1

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  898
  • Reputation:   119
  • Joined:  05/23/12
  • Last Seen:  

Try this:

Warper changed.txt

 

And maybe attach ur crash log.

 

Rynbef~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  01/31/16
  • Last Seen:  

and could you tell me where I would put this @loop? 

 

I tried to use it inside the Function Pick, but I was not successful!

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  898
  • Reputation:   119
  • Joined:  05/23/12
  • Last Seen:  

I've added a Back Menu to all Maps. If there is a dungeon u can go back to main menu. If u select a dungeon as ex. amatsu dungeon it will show ama_dun01 etc and u can go back to dungeons. Sometimes there are fields like mjolnir which don't contains (fild) then u can go back to main menu. Cuz I use compare to differences between fild and dun.

//not tested

Warper changed.txt

 

 

Rynbef~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  01/31/16
  • Last Seen:  

So, referring to the first Menu, L_menu was perfect

But what didn't work was still the Function Pick back

Rynbef: 

this command, addon didn't work, stopped the emulator, I'm trying to see something that might work

function Pick {
	set .@warp_block,@warp_block;
	set @warp_block,0;
	if((@f && .OnlyFirstFld) || (@d && .OnlyFirstDun)){
		set .@select,1;
		if(.@warp_block){
			while(.@warp_block & (1<<.@select)){
				.@select += 1;
			}
		}
	}else{
	    set .@menu$,.@menu$+"~Back";
		set .@select, select(@menu$);
	}
	if(.@select == getarraysize(.@select){
	    if(compare(.@menu$,"fild"))goto Fields;
	    else if(compare(.@menu$,"dun"))goto Dungeons;
	    else goto MainMenu;
	}
	if (getarg(0) == "") {
		set .@i, .@select;
		set .@map$, getarg(.@i);
	} else {
		set .@i, .@select-getarg(1,0);
		set .@map$, getarg(0)+((.@i<10)?"0":"")+.@i;
	}
	if (.@warp_block & (1<<.@select)) {
		message strcharinfo(0),"This map is not enabled in "+((checkre(0))?"":"Pre-")+"Renewal.";
		end;
	}
	set .@x, @c[.@i*2];
	set .@y, @c[.@i*2+1];
	deletearray @c[0],getarraysize(@c);
	@f = false; @d = false;
	Go(.@map$,.@x,.@y);
}

this is the command that you passed, it must be with some failure, because it only asked to add a ')' and I added it, but the emulator crashed.

 

else{
	    set .@menu$,.@menu$+"~Back";
		set .@select, select(@menu$);
	}
	if(.@select == getarraysize(.@select)){
	    if(compare(.@menu$,"fild"))goto Fields;
	    else if(compare(.@menu$,"dun"))goto Dungeons;
	    else goto MainMenu;
	}

So, at first, it only remains to find out how to make it return, being in this part:

 

Return1.png

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  01/31/16
  • Last Seen:  

So, the Command worked just fine, however, it was the same, there was no change,

	}else{
	    set .@menu$,.@menu$+":~Back";
		set .@select, select(@menu$);
	}
	if(.@select == getarraysize(.@select)){
	    if(compare(.@menu$,"fild"))goto Fields;
	    else if(compare(.@menu$,"dun"))goto Dungeons;
	    else goto MainMenu;
	}

If anyone knows how to solve this code, I'm breaking my head already.

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  898
  • Reputation:   119
  • Joined:  05/23/12
  • Last Seen:  

We write at Discord. I fix this small issue if I've setted up my server.

 

Rynbef~

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...