Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Array problem (https://forums.graalonline.com/forums/showthread.php?t=71588)

wild8900 01-20-2007 11:20 PM

Array problem
 
Hey the string wont show up in this script. Whats wrong with it?
Its supposed to return "Town Main" for now but instead I get nothing.
PHP Code:

maparray="Town Main","Cadoan","Melmond","Saronia Village","Shoreville","Snowbound Village";
showimg 498,@Tempus Sans ITC@#s(maparray[0]),playerx-0.1,playery-3; 


Tolnaftate2004 01-20-2007 11:46 PM

Quote:

Originally Posted by wild8900 (Post 1266810)
Hey the string wont show up in this script. Whats wrong with it?
Its supposed to return "Town Main" for now but instead I get nothing.
PHP Code:

maparray="Town Main","Cadoan","Melmond","Saronia Village","Shoreville","Snowbound Village";
showimg 498,@Tempus Sans ITC@#s(maparray[0]),playerx-0.1,playery-3; 


This is a pretty messy mix of attempted GS1 and GS2...
For GS1, use setstring maparray,"Town Main",...; and
PHP Code:

showtext #, #, #, font, style, #I(array,part); 

For GS2, use the array constructor, e.g. maparray = {"Town Main",...}, for an array, and
PHP Code:

showtext(#, #, #, "font", "style", array[part]); 


godofwarares 01-21-2007 02:17 AM

Quote:

Originally Posted by wild8900 (Post 1266810)
Hey the string wont show up in this script. Whats wrong with it?
Its supposed to return "Town Main" for now but instead I get nothing.
PHP Code:

maparray="Town Main","Cadoan","Melmond","Saronia Village","Shoreville","Snowbound Village";
showimg 498,@Tempus Sans ITC@#s(maparray[0]),playerx-0.1,playery-3; 


Well 1.) Thats now how you define an array.

GS1:
PHP Code:

setarray maparray,{"Town Main","Cadoan","Melmond","Saronia Village","Shoreville","Snowbound Village"};
showimg 498,@Tempus Sans ITC@#s(#I(maparray,0)),playerx-0.1,playery-3; 

or GS2:
PHP Code:

maparray = {"Town Main","Cadoan","Melmond","Saronia Village","Shoreville","Snowbound Village"};
showtext(498,player.x-0.1,player.y-3,Tempus Sans ITC,c,maparray[0]); 


Inverness 01-21-2007 02:32 AM

Uh for GS1, setarray name,length; creates a blank array. Same in GS2 also.
And if you want to make array in GS1 you use setstring name,var0,var1,var2,var3,etc.;

Also your little bit of GS2 code is wrong.
PHP Code:

showtext(498,player.x-0.1,player.y-3,"Tempus Sans ITC","c",maparray[0]); 

That is correct.

godofwarares 01-24-2007 02:47 AM

Quote:

Originally Posted by Inverness (Post 1266951)
Uh for GS1, setarray name,length; creates a blank array. Same in GS2 also.
And if you want to make array in GS1 you use setstring name,var0,var1,var2,var3,etc.;

Also your little bit of GS2 code is wrong.
PHP Code:

showtext(498,player.x-0.1,player.y-3,"Tempus Sans ITC","c",maparray[0]); 

That is correct.

Oy, I'm just a bit tired from a long day, Cut me some slack -_-
You don't need setarray in GS2, All you need to do is array = {whatever}. . .
I do that all the time.


All times are GMT +2. The time now is 01:06 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.