PenUltima Online

It is currently Sun Oct 12, 2008 4:35 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: stupid question about set props
PostPosted: Thu Mar 23, 2006 6:40 pm 
i was try to make function to remove particular thing from the prop
for example

Code:
lets say nnn := {John, Ultima, Online, etc };
setglobalproperty("Names", nnn);
i wanna erase just john from "Names"
take in consideration names will be random that was just example


thanks alot


Top
  
 
 Post subject:
PostPosted: Thu Mar 23, 2006 7:12 pm 
Offline
POL Developer
User avatar

Joined: Wed Jan 25, 2006 2:30 am
Posts: 421
Location: San Diego, California
Code:
function RemoveFromArray(byref x_array, match)
    foreach index in (x_array)
            if ( index == match )
                   x_array.Erase(_index_iter);
                   return 1;
            endif
            sleepms(2);
    endforeach
    return 0;
endfunction

_________________
-Austin


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 28, 2006 7:58 am 
Offline

Joined: Fri Feb 17, 2006 5:34 pm
Posts: 12
Code:
var nnn := {John, Ultima, Online, etc };
var new_array := RemoveElement(nnn, [position 4 example 1]);
setglobalproperty("Names", new_array);


Code:
function RemoveElement(byref arry, position)
  var newarray := { };
  foreach thing in arry
    if(thing != arry[position])
      newarray.append(thing);
    endif
  endforeach
  return newarray;
endfunction

_________________
Master of dis(ass)ter


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 29, 2006 4:37 am 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 772
Location: Chicago, IL USA
Althalus are you trying to erase a specific index passed to RemoveElement?

Whats wrong with what Austin used in array.erase(position number) ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 29, 2006 10:41 am 
Offline
User avatar

Joined: Sat Feb 04, 2006 8:17 am
Posts: 146
Location: Illinois, USA
Can you use the .Erase function in POL95? I was not aware of this and it would make some of my scripts alot easier to handle if it is possible.

_________________
2nd place is the 1st loser.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 31, 2006 6:10 am 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 772
Location: Chicago, IL USA
Its existant in 095 I definitely know that. And I'm pretty sure I used it then too.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl