Jump to content
  • 0

Hello. A lil help here.


Valiente

Question


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  132
  • Reputation:   8
  • Joined:  07/19/12
  • Last Seen:  

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

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  132
  • Reputation:   8
  • Joined:  07/19/12
  • Last Seen:  

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