The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
While check Function
Author Message
Staff_Stanic
Journeyman
*

Posts: 96
Likes Given: 25
Likes Received: 14 in 8 posts
Joined: Nov 2012
Reputation: 1

Dimension Shard

Post: #1
While check Function
Guys... I'm trying to make a function that check if a random number is on the tag, if is, then change the number and check again.
I made this but when coming the seventy number the sphere crash because the big loop.

Code:
TAG.LAST=<R1,75>
While (STRMATCH(*<TAG.LAST>*,<TAG.CHAMADAS>))
TAG.LAST=<R1,75>
ENDWHILE
TAG.CHAMADAS=<TAG.CHAMADAS> <TAG.LAST>
(This post was last modified: 11-29-2012 11:42 AM by Staff_Stanic.)
11-29-2012 11:40 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: While check Function
Sphere does that when you make endless loops.
Which is pretty much all you are making here

[Image: 2nis46r.jpg]
11-29-2012 11:44 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Staff_Stanic
Journeyman
*

Posts: 96
Likes Given: 25
Likes Received: 14 in 8 posts
Joined: Nov 2012
Reputation: 1

Dimension Shard

Post: #3
RE: While check Function
But is not a endless loop, the loop is until find a number that aren't in the tag...
You have any idea to work?,

This is the memory of NPC that call the numbers of a Bingo
Code:
[ITEMDEF i_Memory_Locutando]
ID=i_memory
TYPE=t_eq_script
NAME=Chamador de numeros

ON=@Create
ATTR attr_decay

ON=@Timer
REF1=<TAG.NPC>
If (<REF1.TAG0.CHAMANDO>)
  TAG.LAST=<R1,75>
   If (<EVAL <TAG0.CHAMADASTOTAL>> == 75)
    REF1.SAY @,1,1 Finish!
    REF1.TAG.CHAMANDO=0
    REMOVE
    Return 1
   Endif
   While (STRMATCH(*<TAG.LAST>*,<TAG.CHAMADAS>))
    TAG.LAST=<R1,75>
   ENDWHILE
  TAG.CHAMADAS=<TAG.CHAMADAS> <TAG.LAST>
  TAG.CHAMADASTOTAL +=1
  REF1.SAY @,1,1 Ball: <EVAL <TAG.LAST>>
Else
  REMOVE
  RETURN 1
ENDIF
TIMER=1
RETURN 1
(This post was last modified: 11-29-2012 12:00 PM by Staff_Stanic.)
11-29-2012 11:51 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #4
RE: While check Function
If it were me, I would redo the system using the global LIST structure rather than implementing your own LIST in TAGs.
11-30-2012 06:05 AM
Find all posts by this user Like Post Quote this message in a reply
Staff_Stanic
Journeyman
*

Posts: 96
Likes Given: 25
Likes Received: 14 in 8 posts
Joined: Nov 2012
Reputation: 1

Dimension Shard

Post: #5
RE: While check Function
You can give an example?
12-01-2012 12:14 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #6
RE: While check Function
Quote:01-02-2009, Shadow Dragon
- Added: Basic LIST support.
LIST.xxx to show elements in list. Also, can be used like LIST.xxx=value to clear list and add a value
LIST.xxx.ADD to add new element to list, can be number or string
LIST.xxx.CLEAR to clear list
LIST.xxx.index to read/write value on element in list
LIST.xxx.COUNT to get count of elements in list
LIST.xxx.index.REMOVE to remove element at specified index in list
LIST.xxx.index.INSERT to insert element at specified index in list
LIST.xxx.FINDELEM search_value returns index of first found element in list. Search starting from begin
LIST.xxx.index.FINDELEM search_value returns index of first found element in list. Search starting from index
SERV.PRINTLISTS to print all lists and their elements
SERV.CLEARLISTS to clear all lists. If used with mask parameter, then clear all lists, which name countains specified mask
- Added: SERV.Map.x.AllSectors some_verb_to_use

you can add all numbers to a list.


PHP Code:
for 1 75
    
list.cham.add <dlocal._for>
endfor 

then when you select a random number you can remove it from the index:

PHP Code:
local.num=<R1,75>
local.index=<list.cham.findelem <eval <local.num>>>
if <
local.index> > //index will be -1 if the element not in the list
    
list.cham.remove <local.index>
endif 

this is just example about lists i don't understand what are you trying to do actually Smile
12-01-2012 12:37 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #7
RE: While check Function
Thanks for the example Shaklaban
12-01-2012 03:35 AM
Find all posts by this user Like Post Quote this message in a reply
Staff_Stanic
Journeyman
*

Posts: 96
Likes Given: 25
Likes Received: 14 in 8 posts
Joined: Nov 2012
Reputation: 1

Dimension Shard

Post: #8
RE: While check Function
Thank you very much!!
12-01-2012 08:01 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Staff_Stanic
Journeyman
*

Posts: 96
Likes Given: 25
Likes Received: 14 in 8 posts
Joined: Nov 2012
Reputation: 1

Dimension Shard

Post: #9
RE: While check Function
Guys... I tried to use LIST but the Sphere is giving theses erros:
Code:
12:11:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 024'
12:11:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 036'
12:11:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 016'
12:11:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 01b'
12:11:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 01f'
12:11:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 03b'
12:11:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 01d'
12:11:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 03'
12:11:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 0d'
12:11:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 02e'
12:12:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 0b'
12:12:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 02e'
12:12:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 01a'
12:12:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 027'
12:12:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 021'
12:12:ERROR:(sistema_bingo.scp,841)Unable to proceed command 'list.cham 01c'

this line:

Code:
if <local.index> > 0 //index will be -1 if the element not in the list
LIST.cham.REMOVE <local.index>
endif
12-15-2012 12:18 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #10
RE: While check Function
I think correct sintax for removing is

LIST.cham.<dlocal.index>.remove
12-15-2012 12:36 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)