Jump to content
  • 0

Hello. A lil help here.


Question

Posted (edited)

I'm trying to create a simple warper npc wherein the player can type the map name and get warped to the desired map.

For some reason, I'm having a hard time trying to get this work. This is the messy version of what I did earlier.

I am currently getting this error:

eathena script:getelementofarray: index out of range (128)

and a debug, variable name='@map$' index = 0

And here is the script:

Sorry but I'm kind of new in eA scripting. I mean I never studied the language.

		
				    setarray @map$[0], prontera, morocc, prontera, alberta, aldebaran, izlude;
					setarray @coordsx[0], 151, 151, 151, 151, 151, 151;
					setarray @coordsy[0], 181, 181, 181, 181, 181, 181;
					set @ii,0;
		mes "[Warp Agent]";
		mes "Please type the name of the map where you want to go:";
		input @warp$;
					while ((@map$[@i] != @warp$) || (@i != 10)) {
						  set @i,@i+1;
						  set @ii,@ii+@i;
						  if(@i == 10) {
								mes "[Warp Agent]";
								mes "Invalid Map!";
								close;
						  }
					}
			 // warp getarg(0),getarg(1),getarg(2);
					// warp .@map$[@i],@coordsx[@i],@coordsy[@i];
					callsub S_DunWarp,@map$[@ii],@coordsx[@ii],@coordsx[@ii];
					close;
					break;
	S_DunWarp:
	warp getarg(0),getarg(1),getarg(2);
	close;
}

Nevermind. Got it working. Thanks!

Edited by Valiente

3 answers to this question

Recommended Posts

Posted

prontera,155,186,5    script    kdfhskdjf    100,{
   setarray .@map$, "prontera", "morocc", "alberta", "aldebaran", "izlude";
   setarray .@x, 156, 156, 192, 140, 128;
   setarray .@y, 191,  93, 147, 143, 146;
   set .@arraysize, getarraysize(.@map$);
   mes "[Warp Agent]";
   mes "Please type the name of the map where you want to go:^0000FF";
   for ( .@i = 0; .@i < .@arraysize; .@i++ )
       mes ( .@i +1 )+". "+ .@map$[.@i];
   next;
   input .@warp$;
   .@i = 0;
   while ( .@warp$ != .@map$[.@i] && .@i < .@arraysize ) .@i++;
   if ( .@i == .@arraysize ) {
       mes "[Warp Agent]";
       mes "invalid map";
       close;
   }
   mes "[Warp Agent]";
   mes "You'll be warping to "+ .@map$[.@i] +" town";
   close2;
   warp .@map$[.@i], .@x[.@i], .@y[.@i];
   end;
}

erm .... you PM me to help but you suddenly got it working x.x

Posted

What Annie posted would fix it, your forgot to put your map names, in " quotation " marks. This must be done when ever you use a string variale (variable ending with $. ex: @map$ ).

@offtopic - Also, it's not in my place to say who you can and shouldn't PM in regards for help, but it seemed like you sent a PM out when your topic was only open for a little under an hour. I understand the urge to get help right away, but try to atleast let your topic sit for a couple hours to see if help is posted before hitting someones PM box.

Posted (edited)

@Annie Ruru.

I'm sorry. I tried fixing it myself due to boredom. Suddently noticed the mistakes and did some cleaning. And yeah, it worked. Just adding maps now and coordinates for each of the map.

I find that script useful too. Made things much clearer for me. And I thank you for that. Never knew about that counter function for array index.

Again sorry!

I will keep this posted up, to show updates of the script I am making.

Edited by Valiente

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