TWLan Forum
[v1.3] new class->function($arg) problem. - Printable Version

+- TWLan Forum (https://twlan.org)
+-- Forum: Legacy (https://twlan.org/forumdisplay.php?fid=61)
+--- Forum: TWLan 1.x (DSLan) (https://twlan.org/forumdisplay.php?fid=62)
+---- Forum: Deutsche Community (https://twlan.org/forumdisplay.php?fid=65)
+----- Forum: Fragen & Probleme (https://twlan.org/forumdisplay.php?fid=7)
+----- Thread: [v1.3] new class->function($arg) problem. (/showthread.php?tid=3813)



new class->function($arg) problem. - eduvs - 31.12.2010

Hi there, after reading the Classes and Functions thread from Tools and member projects, i seen a function named get_description() in a class named builds();

So here i am, trying to get the description of the "main" building.

I have something like this so far:
PHP Code:
<?php
  $build 
= new builds();
  echo 
$build->get_description("main"); // trried with get_description_bydbname("main") but it doesnt return a thing.
?>

Which prints out exactly nothing... anyone has any opinions about what I am doing wrong ?


RE: new class->function($arg) problem. - k3v95 - 31.12.2010

falscher bereich, ein mod bitte verschieben


RE: new class->function($arg) problem. - eduvs - 31.12.2010

Can you use english please ?


RE: new class->function($arg) problem. - k3v95 - 31.12.2010

oh sorry, that wasn't to you, you only open this thread in a wrong place. i asked a mod to move it.


to your problem, i'm sorry, i can't help you


RE: new class->function($arg) problem. - Bettdecke1 - 31.12.2010

#moved


RE: new class->function($arg) problem. - Molt - 31.12.2010

Your mistake is, that you create a new builds object, so all variables are deleted.
Use this:
PHP Code:
require_once("include.inc.php");
// $cl_builds is defined in include/configs/buildings.php
$cl_builds->get_description("main"); 

btw: I know who you are! eddu, edduvs, eduvs, all same IP...
As I see, this is your 8. account... m1cro!
@Admins: At least 3 accounts of him are banned, I'd think about an IP ban...

Greetings
Molt


RE: new class->function($arg) problem. - eduvs - 31.12.2010

Thanks for the help, i`ll check it right away.

EDIT: Umm, or i`m newb or its wrong.

I am in /actions/storage.php i want to rewrite the file because it gaves me errors like Error by division with 0 on /actions/storage.php line 31,32,33,34 and so on.

if i require the include.inc.php it will redeclare the functions, so this can't be possible.


RE: new class->function($arg) problem. - Steffen - 31.12.2010

The actions/storage.php file is already included BY the game.php.
That means that you don't have to include the include.inc.php.
Try to access the $cl_builds variable without something, use $cl_builds->function(ARGS);

If you simply want to make this error invisible , write at the top of actions/storage.php "error_reporting(0);" (without " ")

Argumentreference:
Class builds
-get_description( $idofbuild )
-get_description_bydbname( $dbname )