Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-28-2002, 08:19 AM
neomaximus2k neomaximus2k is offline
Registered User
Join Date: Feb 2002
Location: UK
Posts: 324
neomaximus2k is on a distinguished road
Send a message via ICQ to neomaximus2k
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
__________________
Beware of thy Inner self
NPC Code:

_.,.__
((o\\o\))
.-. ` \\``
__( )___.o"".,___
=== ~~~~~~~~
==
= Neo

Reply With Quote
  #2  
Old 03-28-2002, 08:29 AM
BARGAD BARGAD is offline
Registered User
Join Date: Aug 2001
Location: Sweden
Posts: 345
BARGAD will become famous soon enough
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
__________________
Gori

Born To Kill
Death Silent Killers

Two little newbies, out in the sun.
Then came Gori and there was only one.

Reply With Quote
  #3  
Old 03-28-2002, 08:44 AM
neomaximus2k neomaximus2k is offline
Registered User
Join Date: Feb 2002
Location: UK
Posts: 324
neomaximus2k is on a distinguished road
Send a message via ICQ to neomaximus2k
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;
}
}

__________________
Beware of thy Inner self
NPC Code:

_.,.__
((o\\o\))
.-. ` \\``
__( )___.o"".,___
=== ~~~~~~~~
==
= Neo

Reply With Quote
  #4  
Old 03-28-2002, 11:42 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
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 ?
Reply With Quote
  #5  
Old 03-28-2002, 12:15 PM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
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 ...
Reply With Quote
  #6  
Old 03-28-2002, 12:40 PM
BARGAD BARGAD is offline
Registered User
Join Date: Aug 2001
Location: Sweden
Posts: 345
BARGAD will become famous soon enough
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
__________________
Gori

Born To Kill
Death Silent Killers

Two little newbies, out in the sun.
Then came Gori and there was only one.

Reply With Quote
  #7  
Old 03-28-2002, 03:50 PM
neomaximus2k neomaximus2k is offline
Registered User
Join Date: Feb 2002
Location: UK
Posts: 324
neomaximus2k is on a distinguished road
Send a message via ICQ to neomaximus2k
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; } }
}
}

__________________
Beware of thy Inner self
NPC Code:

_.,.__
((o\\o\))
.-. ` \\``
__( )___.o"".,___
=== ~~~~~~~~
==
= Neo

Reply With Quote
  #8  
Old 03-28-2002, 04:01 PM
neomaximus2k neomaximus2k is offline
Registered User
Join Date: Feb 2002
Location: UK
Posts: 324
neomaximus2k is on a distinguished road
Send a message via ICQ to neomaximus2k
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
__________________
Beware of thy Inner self
NPC Code:

_.,.__
((o\\o\))
.-. ` \\``
__( )___.o"".,___
=== ~~~~~~~~
==
= Neo

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:38 PM.


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