Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   a little help (https://forums.graalonline.com/forums/showthread.php?t=26441)

neomaximus2k 03-28-2002 08:19 AM

a little help
 
ok i aint sure on how to do this, it is late and i am tired.

i want part of a script that will do the following

it will read all the parts of a string (eg. 1,3,7,12,19)
and then if the value of I is the same as that it will do something.

any ideas cause i am tired

BARGAD 03-28-2002 08:29 AM

Hm..

how about

NPC Code:

if (strequals(#s,Stuff)&&strequals(#v,#)||strequals(# v,#)&&strequals#v=I) {
dostuff;
}



x.o;
Yeah that wont work but prolly somethin to that effect :)
/CaRnIe

neomaximus2k 03-28-2002 08:44 AM

Re: Re: a little help
 
that is good but the array constantly changes,
so how would i do that? or would that do it, i never used sarreylen

Quote:

Originally posted by Kaimetsu


Like this?

NPC Code:

for(j=0;j!=sarraylen(stringarray);j++){
if(strequals(#I(stringarray,j),I)){
//DoSomething
break;
}
}



nyghtGT 03-28-2002 11:42 AM

Quote:

Originally posted by Kaimetsu
That should do it, unless the array changes within the for loop, in which case you'd need to manipulate j a little.
Kai, would you mind explaining on how to use/set and check for string arrays ?

nyghtGT 03-28-2002 12:15 PM

Quote:

Originally posted by Kaimetsu


addstring, lindexof, sarraylen, #I, removestring, deletestring, replacestring. What more do you need?

i know the commands just have no idea how to use them ...

BARGAD 03-28-2002 12:40 PM

Well, I think he means you need'a figure it out for yourself, most commands are kinda obvious anyway..
This is what I think they mean:
addstring-Adds a string thats saved to the server
lindexof-Checks the array index
sarraylen- No idea
#I-The 'strequals' checking of an array
removestring-Removes the string from the player
deletestring-Deletes the string
replacestring-replaces it withsomething else

:) Im probly half wrong tho so oh well lol

/CaRnIe

neomaximus2k 03-28-2002 03:50 PM

Thanks for that monkey scripter :P (j/k)

anyway i tried using yours and it wouldn't work, but i cam up with this, see if this wuld work..
NPC Code:

if (timeout){
if (keydown(1)) {i--;}
if (keydown(3)) {i++;}
for(j=0;j!=sarraylen(testy);j++){ if(strequals(#I(testy,j),I)){
if (j=i){showimg 1,testy#v(i).png,playerx-.06,playery-2;}
if (j!=i){
if (keydown(1)){i--;}
if (keydown(3)){i++;}
break; } }
}
}


neomaximus2k 03-28-2002 04:01 PM

Quote:

Originally posted by Kaimetsu


Liar, that's pretty much exactly the same as what I gave you, except for a few added bits around the code and some altered structuring/variable naming. You even kept the mistake I made - it should be strequals(#I(testy,j),#v(I)).

i never said that i didn't use yours, but it didn't work even when i fixed the error, i was wondering if that would do what i wanted to do that all


All times are GMT +2. The time now is 11:53 PM.

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