Graal Forums  

Go Back   Graal Forums > Development Forums > Tech Support
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-06-2007, 10:48 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Printf() in loops

Using printf() in loops seems to break the loop.
PHP Code:
function onCreated()
{
  
this.array ={"I","really","really","like","pie"};
  for (
temp.this.array)
    
printf("[Blah?]: %s",temp.t);
  echo(
"--");
  for (
temp.this.array)
    echo(
format("[Blah?]: %s",temp.t));  

echos
PHP Code:
[Blah?]: I
--
[
Blah?]: I
[Blah?]: really
[Blah?]: really
[Blah?]: like
[Blah?]: pie 
Any idea why printf is breaking the loop? This was tested on Zodiac.
Reply With Quote
  #2  
Old 05-06-2007, 11:49 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Weird
HTML Code:
function onCreated()
{
  temp.myARRAY = {"hey", "hi", "test"};
  for (temp.currentWord: temp.myARRAY)
  {
    printf(temp.currentWord);
    printf("Called");
  }
  printf("Done");
}
It displays each one that is called.

Also, why're you using printf?
Reply With Quote
  #3  
Old 05-06-2007, 11:57 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Printf is a combination of echo() and format(): It is quite handy. P.s. did you actually test that code?
Reply With Quote
  #4  
Old 05-06-2007, 12:00 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
I tested mine, why?
Reply With Quote
  #5  
Old 05-06-2007, 12:04 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
I tested your code on two seperate servers and the results were:
PHP Code:
hey
Called
Done 
Signifying that there is a problem with printf() and loops. Well, I went straight to the source.
Quote:
Originally Posted by Stefan on Zodiac RC
Weapon/GUI-script Twinny/Testing added/updated by Stefan
*Stefan: hmmm weird
*Stefan: will need to check it
Reply With Quote
  #6  
Old 05-06-2007, 12:06 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Twinny View Post
I tested your code on two seperate servers and the results were:
PHP Code:
hey
Called
Done 
Signifying that there is a problem with printf() and loops.
Oh, I didn't word it right.
I got the same as you, however it doesn't break the current loop. [It carries on...]
Reply With Quote
  #7  
Old 05-06-2007, 12:08 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by Chandler View Post
Oh, I didn't word it right.
I got the same as you, however it doesn't break the loop. [It carries on...]
Yes, it breaks the loop and carries on with the rest of the script . It only echos "Called" once after all.
Reply With Quote
  #8  
Old 05-12-2007, 10:38 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
*coughhackcough*

Reply With Quote
  #9  
Old 05-21-2007, 10:53 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Ok fixed it, will upload new npcservers soon.
Reply With Quote
  #10  
Old 05-21-2007, 02:38 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
When will the next client be released? (It happens both clientside and serverside)
Reply With Quote
  #11  
Old 05-21-2007, 06:28 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Client - probably in a few weeks
Server - already uploaded to all machines
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 05:48 AM.


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