Jump to content
  • 0

Custom Warper Help


Question

Posted

Help The first warp is working fine but the 2nd and 3rd warp is not working.. I can click it but it won't let me warp to the place Donation Area and Luneta Vend Room

philtown,170,195,5 script Main Town Warper 965,{
setarray .@MapList$,
  "turbo_room","Luneta Mall","100","68",
  "turbo_room","Donation Area","115","94",
  "pron_mall","Luneta Vend Room","98","42",
  "Payon","Payon","162","133";
for( set .@i,0; .@i < getarraysize( .@MapList$ ) - 4; set .@i,.@i + 4 )
set .@Menu$,.@Menu$ + .@MapList$[.@i+1]+":";
set .@i,( select( .@Menu$ ) - 1 );
warp .@MapList$[.@i],atoi( .@MapList$[.@i+2] ),atoi( .@MapList$[.@i+3] );
end;
OnInit:
waitingroom "Main town Warper",0;
end;
}
//-------------------MAP FLAG-----
turbo_room mapflag nogo

7 answers to this question

Recommended Posts

Posted

I suck at looping and all but from my first few at this I gotta question the -4 on getarraysize.. and the .@i+1 on the menu one.. I mean the .@i changes by itself so why's it need a +1?

but then again like I said I suck a looping and never find the time to actually improve upon it.. love how emistry uses it for like every single problem, I suppose it's kind of like practice makes perfect..

Posted (edited)

Hmm..

I'm kinda confuse with your script

What cause error to your script is that during

set .@i,( select( .@Menu$ ) - 1 );

Of course the output would be like this

Luneta Mall
Donation Area
Luneta Vend Room
Payon

When the user select Donation Area for example select function would return '2'

Lets take a look back at your setarray

setarray .@MapList$,
"turbo_room","Luneta Mall","100","68",
"turbo_room","Donation Area","115","94",
"pron_mall","Luneta Vend Room","98","42",
"Payon","Payon","162","133";

during this line

warp .@MapList$[.@i],atoi( .@MapList$[.@i+2] ),atoi( .@MapList$[.@i+3] );

.@i = 2 - 1. right?

therefore since .@i = 1, I'll replace .@i with 1

warp .@MapList$[1],atoi( .@MapList$[3] ),atoi( .@MapList$[4] );

Therefore your 2nd warp and above wouldn't work because

your index 1 is "Luneta Mall" which will cause an unknown map when used on warp function.

How about instead of having this

setarray .@MapList$,
"turbo_room","Luneta Mall","100","68",
"turbo_room","Donation Area","115","94",
"pron_mall","Luneta Vend Room","98","42",
"Payon","Payon","162","133";

What if you change it to this?

setarray .@Map$, "turbo_room", "turbo_room", "pron_mall", "Payon";
setarray .@MapName$, "Luneta Mall", "Donation Area", "Luneta Vend Room", "Payon";
setarray .@MapX,100,115,98,162;
setarray .@MapY, 68,94,42,133;

So that during selection when the user selects an option your warp function would be like

warp .@Map$[.@i],.@MapX[.@i],.@MapY[.@i];

Uh. just a suggestion for this part. :)

Edited by Kaito_Kid
Posted

thx for the suggestion kaito...but i already fixed that ...

i just dont want to use multiple array xP

jus a simply calculation is needed to make sure it warp to the correct location

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