Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Repeat Loop Doesn't Seem to work

Status
Not open for further replies.

tonywilliamson

Technical User
Joined
Jun 8, 2005
Messages
1
Location
US
HI, i am trying to create a script for a game which sets some items as a key item and then doesn't go into your inventory. My problem is although i have set the items which should be key items everything seems to be considered as one.

Thanks in advance for any help

----------------------------------------

set keyitemslist = ["Oraku's Orb", "Herb", "Portal"]

repeat with i = 1 to keyitemslist.count
if nitem = keyitemslist then set keyitem = TRUE
end repeat

if KeyItem = TRUE then
set kifile = "c:\fsoserver\DAT\Kitem\" & user.name & ".txt"
set mykitemlist = list(string(file(kifile).read))
repeat with i = 1 to mykitemlist.count
if nitem = mykitemlist(i) then
set thetext = "You have already aqquired this key item"
user.sendmessage("sqa", TheText, 0, FALSE, user.name)
file("C:\FSOServer\DAT\ITEMS\" & FilName).write(ItemList)
exit
end if
end repeat
add(mykitemlist, nItem)
set thetext = "You have just aqquired a key item"
user.sendmessage("sqa", TheText, 0, FALSE, user.name)
set mykitemlist = string(mykitemlist)
file(kifile).write(mykitemlist)
file("C:\FSOServer\DAT\ITEMS\" & FilName).write(ItemList)
exit
end if

-----------------------------
 
From your script fragment I can see that once your "keyitem" is set to TRUE, it is always TRUE from that point on, because you do not reset it to FALSE or VOID.

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top