Error in console command 'help' - 'array(xxx)'

Wrote new code? Fixed a bug? Want to discuss technical stuff? Feel free to post it here.

Moderator: Moderators

Message
Author
piroJOKE
Noob
Noob
Posts: 7
Joined: 04 Apr 2008, 19:07
Noob?: Yes
Location: RUSSIA
Contact:

Error in console command 'help' - 'array(xxx)'

#1 Post by piroJOKE »

Example:
help warp
------------ Help for 'warp' ------------
Open warp portal.
warp list lists available warp portals to open
warp <warp portal #|map name> opens a warp portal to a map
--------------------------------------------------

help warp
------------ Help for 'warp' ------------
ARRAY(0x277e92c)
warp <warp portal #|map name> opens a warp portal to a map
--------------------------------------------------

help warp
------------ Help for 'warp' ------------
ARRAY(0x277e950)
--------------------------------------------------

help warp
------------ Help for 'warp' ------------

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

help warp
------------ Help for 'warp' ------------

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

...
Details: http://rofan.ru/viewtopic.php?t=5218 [rus]

* * *

Solution:

Code: Select all

diff -u openkore.orig/src/Commands.pm openkore/src/Commands.pm 
--- openkore.orig/src/Commands.pm       2008-04-06 13:26:39.000000000 +0400 
+++ openkore/src/Commands.pm      2008-04-16 06:31:33.000000000 +0400 
@@ -2330,22 +2330,23 @@ 
 sub helpIndent { 
        my $cmd = shift; 
        my $desc = shift; 
+       my @tmp = @{$desc}; 
        my $message; 
        my $messageTmp; 
        my @words; 
        my $length = 0; 

        $message = TF("------------ Help for '%s' ------------\n", $cmd); 
-       $message .= shift(@{$desc}) . "\n"; 
+       $message .= shift(@tmp) . "\n"; 

-       foreach (@{$desc}) { 
+       foreach (@tmp) { 
                $length = length($_->[0]) if length($_->[0]) > $length; 
        } 
        my $pattern = "$cmd %-${length}s    %s\n"; 
        my $padsize = length($cmd) + $length + 5; 
        my $pad = sprintf("%-${padsize}s", ''); 

-       foreach (@{$desc}) { 
+       foreach (@tmp) { 
                if ($padsize + length($_->[1]) > 79) { 
                        @words = split(/ /, $_->[1]); 
                        $message .= sprintf("$cmd %-${length}s    ", $_->[0]);
help warp
------------ Help for 'warp' ------------
Open warp portal.
warp list lists available warp portals to open
warp <warp portal #|map name> opens a warp portal to a map
--------------------------------------------------

help warp
------------ Help for 'warp' ------------
Open warp portal.
warp list lists available warp portals to open
warp <warp portal #|map name> opens a warp portal to a map
--------------------------------------------------

...
Bug found and solution found by l00zEr.
Is it needed to add these changes in SVN?

freegoods
Perl Monk
Perl Monk
Posts: 8
Joined: 05 Apr 2008, 02:39
Noob?: Yes
Location: Russia

Re: Error in console command 'help' - 'array(xxx)'

#2 Post by freegoods »

piroJOKE, of course yes. Please add.

You are to write a request to Bibian to return the writing permission on the sourceforge >_< all the settings there were erased.

---
tested and commited with the reference to the author!

Post Reply