Jump to content


Photo
- - - - -

[Linux Compiling] Compiling NON-CVS on LINUX (like Yurots, Neverland..) UPDATED 30/03


  • Please log in to reply
158 replies to this topic

#1 Proglin

Posted 29 March 2006 - 06:24 AM
Proglin

    An old man

  • Members
  • PipPipPipPipPip
  • Reputation: 39
    Admirable
  • 216 posts
  • Location:Brasil

================================
VERSION 2.0 Last Update: 30/3/2006
================================
Note: This tutorial is only for advanced users

Hi all,

I'm kind of n00b in linux, so I've been trying to run no-cvs otserv on linux for a long time. Finally it works :)
And now i'm gonna give some extras tips ;)

Known problems that you have to deal with:
  • Linux is CASE-SENSITIVE so I suggest to you ONLY use lower case in ALL FILES (include /data/*)
  • Some NPCs use to crash... So remove all NPCs from /data/world/npcs.xml and start the server. If it runs, go adding 1 npc by time to know with npc is bugged. The "function onThink()" used on lua files used to stop working after some hours. Try to not use them.
  • It not works with SQL database

Let's rock ^_^

Linux system used to do this tutorial: Debian

Make sure to have all the libs:
  • apt-get install gcc
  • apt-get install automake
  • apt-get install libilua50
  • apt-get install libilua50-dev
  • apt-get install libilualib50-dev
  • apt-get install libboost-dev
  • apt-get install libboost*
  • apt-get install libxml2-dev
  • apt-get install libxml++2.6-dev

Create a directory and put all the sources in it (I'm using YurOTS_094d sources).

IMPORTANT UPDATE:
Create this two new files (in the same folder of your sources):

mypatch.h, with this content:
/* 
Patch: Make your no-cvs sources from otserv run in linux
by Ulisses - Brasil
Last update: Mar/2006
*/
#if defined(__linux__)

#define _itoa   itoa
#define  ltoa   itoa
#define _i64toa itoa
#define _timeb  timeb
#define _ftime  ftime

char* itoa(int value, char*  str, int radix);
#endif

mypatch.cpp, with this content:
/* 
Patch: Make your no-cvs sources from otserv run in linux
by Ulisses - Brasil
Last update: Mar/2006
*/

#include <stdio.h>
#include <string.h>

#if defined(__linux__)

#define _itoa   itoa
#define  ltoa   itoa
#define _i64toa itoa
#define _timeb  timeb
#define _ftime  ftime

char* itoa(int n, char *buff, int radix)
// convert a positive integer n to char *buff
// for instant, this function work with radix <= 10;
// a little change to run with radix > 10
{
     int q, r;
     int i = 0;
     char tmp[33];  // for radix = 2 and 32 bits computer
     do{
          q = int(n / radix);
          r = n % radix;
          n = q;
          tmp[i++] = 48 + r;
     }while(q > 0);
     int j;
     for(j = 0; j < i; j++){
          buff[j] = tmp[i - j - 1];
     }
     buff[j] = '\0';
     return buff;
}

#endif

Now in commands.cpp
After:
#include "monsters.h"
Add:
#include "mypatch.h"

In game.cpp
After:
#include "monsters.h"
Add:
#include "mypatch.h"

In guilds.cpp
After:
#include "player.h"
Add:
#include "mypatch.h"

In loginqueue.cpp
After:
#include "player.h"
Add:
#include "mypatch.h"

In tools.cpp
After:
#include <sys/timeb.h>
Add:
#include "mypatch.h"


Now is the most important thing: creating a Makefile

I have done this one:
(Create a file named Makefile in your source folder, with this content:)
#
# Make your no-cvs sources from otserv run in linux
# by Ulisses - Brasil
# Last update: Mar/2006
#
CC=g++

CFLAGS=-I. -I/usr/include/libxml2  -I/usr/include/lua50

LIBLINK=-L/usr/lib -lxml2 -lz -lpthread -lm -llualib50 -llua50 -lboost_thread -ldl

ENDFLAGS=-Werror -g -O2

OTSFLAGS=-D__linux__ -DUCB_AUTO_RESTART -DUCB_LVL_EXP -DYUR_LEARN_SPELLS -DCVS_DAY_CYCLE -DTLM_BUY_SELL -DTLM_SERVER_SAVE -DYUR_ROOKGARD -DTLM_HOUSE_SYSTEM -DBDB_UTEVO_LUX -DWOLV_LOAD_NPC -DBD_HOUSE_WINDOW -DTR_ANTI_AFK -DELEM_VIP_LIST -DTR_SUMMONS -DTRS_GM_INVISIBLE -DTLM_SKULLS_PARTY -DBRN_EXIVA -DSD_BURST_ARROW -DBDB_REPLACE_SPEARS -DBD_ITEM_LOOK -DSM_RELOAD_CONFIG -DJD_DEATH_LIST -DCT_EXANI_TERA -DTJ_MONSTER_BLOOD -DJD_WANDS -D__DEBUG_PLAYERS__ -DYUR_CVS_MODS -DYUR_ICE_RAPIER -DYUR_AOL -DYUR_LOGIN_QUEUE -DYUR_MULTIPLIERS -DYUR_BOH -DYUR_NPC_EXT -DYUR_GUILD_SYSTEM -DYUR_CMD_EXT -DYUR_ITEM_EXT -DYUR_ACT_EXT -DYUR_NO_MONSTER_HEAL -DYUR_PVP_ARENA -DYUR_RINGS_AMULETS -DYUR_CONFIG_CAP -DYUR_FIGHT_MODE -DYUR_READABLES -DYUR_HEAL_EXHAUST -DYUR_SHUTDOWN -DYUR_LIGHT_ITEM -DYUR_CLEAN_MAP -DYUR_GM_LOOK -DYUR_PREMIUM_PROMOTION -DYUR_INVISIBLE -DYUR_DRAINS -DEM_HUR_UP_DOWN -DPVTMSG -DJERO_PROTECTION -D__EXCEPTION_TRACER___

OBJ = account.o actions.o allocator.o chat.o commands.o container.o creature.o exception.o fileloader.o game.o guilds.o houses.o ioaccount.o ioaccountxml.o iomapbin.o iomapotbm.o iomapxml.o ioplayer.o ioplayerxml.o item.o itemloader.o items.o logger.o loginqueue.o luascript.o magic.o map.o md5.o monster.o monsters.o networkmessage.o npc.o otserv.o player.o position.o protocol.o protocol76.o pvparena.o readables.o scheduler.o spawn.o spells.o status.o summons.o thing.o tile.o tools.o mypatch.o

all: tibia

tibia: $(OBJ)
	$(CC) $(CFLAGS) $(OTSFLAGS) $(ENDFLAGS) -o otserv $(OBJ) $(LIBLINK)

%.o:%.cpp
	$(CC) $(CFLAGS) $(OTSFLAGS) $(ENDFLAGS) -c $+

Understanding this Makefile
CC= -> g++ is the compiler
CFFLAGS= -> libs include location
LIBLINK= -> libs used to make the executable
ENDFLAGS= -> (self explained)
OTSFLAGS= -> IMPORTANT: Here you should put all the parameters used in dev-c++. Put THE FIRST parameters: -D__linux__ and DO NOT USE THE BUGGED FLAG: -DYUR_HIGH_LEVELS.
OBJS -> Here you should put EVERY *.cpp changing the end to .o BUT DO NOT INCLUDE "database.cpp" IMPORTANTE UPDATE: You should add at the end the of this line: mypatch.o (like: game.cpp goes to: game.o)

After all this you should run: "make" and pray to works. If you have problemns in any file that try to add the code:
#include "mypatch.h"

Some tips:
  • otserv will ask from config.lua located in: /home/"username"/.otserv/config.lua
  • To make more confortable to change config.lua make a symbolic link from from /home/"username"/.otserv/config.lua to your real location.
  • Make sure that all files in ./data/ folder have read and write access.

If you get every thing running allright get this final tip ;) :

Final tip:

To make your server run in background (you dont need to stay logged ;) ) follow this steps:
  • apt-get install screen
  • creat a file named loopserver.sh with this content:
    #!/bin/bash
    
    #
    # Make your no-cvs sources from otserv run in linux
    # by Ulisses - Brasil
    # Last update: Mar/2006
    #
    
    i=1
    while [ $i -le 5000 ]
    do
    ./otserv 2>> ./ots-error.txt
    i=`expr $i + 1`
    done
    
  • In a Terminal:
  • Type: ./screen and in the window press "enter"
  • Type: ./loopserver.sh
  • Now to run the process in background (deatach) press: "CTRL+A" and after press "D"
  • You can logoff ;)
  • To reattach ( view the server output screen) type: ./screen -dr

Have fun! Good Luck!

Credits to me ;)
  • Morpheus_BR and OsoSangre like this

#2 Fast Layne

Posted 29 March 2006 - 06:41 AM
Fast Layne

    Fair Play :D

  • Members
  • PipPipPip
  • Reputation: 10
    Good
  • 30 posts
  • Location:Brazil

Its very simple! THX A LOT MAN!!!!!

OBS: IT REALY WORKS!!!!!
Posted Image

#3 Talaturenn

Posted 29 March 2006 - 07:08 PM
Talaturenn

    Banned User

  • Banned
  • PipPipPipPip
  • Reputation: 0
    Neutral
  • 53 posts
  • Location:Sweden

Is it possible to compile a server for Linux on Windows or do you have to compile it in Linux aswell?

#4 Proglin

Posted 29 March 2006 - 08:51 PM
Proglin

    An old man

  • Members
  • PipPipPipPipPip
  • Reputation: 39
    Admirable
  • 216 posts
  • Location:Brasil

Is it possible to compile a server for Linux on Windows or do you have to compile it in Linux aswell?


You have to compile on linux. (You can emulate linux on windows, but I think that you allways have to compile on linux)

#5 Beebop

Posted 29 March 2006 - 09:09 PM
Beebop

    Louis Vuitton

  • Members
  • PipPipPipPip
  • Reputation: 13
    Good
  • 92 posts
  • Location:Sweden

Here are some pograms that are easy to compile with if you use Linux

Intel C++ compiler
;http://www.intel.com...clin/219856.htm

KDevelop;
http://www.kdevelop.org/

Tiny C++ Compiler;
http://fabrice.bellard.free.fr/tcc/

Beebop
Capu?

#6 Alreth

Posted 29 March 2006 - 10:34 PM
Alreth

    selfSay('Hello world')

  • Members
  • PipPipPipPipPip
  • Reputation: 49
    Admirable
  • 641 posts
  • Location:Sweden

Anyone who has compiled an otserv for linux and wants to publish it?

Popular work by myself:
( [thread=19577][npc] Gambling[/thread] )( [thread=41607][npc] Pay to Broadcast[/thread] )( [thread=380378][npc] Gym owner[/thread] )( [thread=378306]Training Room[/thread] )
(
[thread=19575]Furniture packing rune[/thread] )( [thread=21654]Door of Expertise (Level/Quest door)[/thread] )( [thread=23607]Exhaustion-function[/thread] )( [thread=19760]Rune merger system[/thread] )
(
[thread=19672][html] doSendAnimatedText colour-table[/thread] )( [thread=36989][java] Outfit-chooser[/thread] )( [thread=19574]Advanced mana runes[/thread] )( [thread=23529]Advanced drawbridge[/thread] )


Posted Image Posted Image


#7 Morpheus_BR

Posted 30 March 2006 - 03:02 AM
Morpheus_BR

    Bagualas

  • Members
  • PipPipPipPipPip
  • Reputation: 49
    Admirable
  • 207 posts
  • Location:RS/BR

Great Greatttt tutorial!!

Going to compile right now on slackware!! :D

edit:
@Proglin
We can emule Linux on rWindows using VMware. In the program u can create a virtual partition and install linux/windows on it.

There is a version for rwindows and Linux.

Edit2:

ERROR:

-Werror -g -O2 -c monsters.cpp
monsters.cpp: In member function `MonsterType* Monsters::loadMonster(const
std::string&, const std::string&, bool)':
monsters.cpp:275: error: `_atoi64' undeclared (first use this function)
monsters.cpp:275: error: (Each undeclared identifier is reported only once for
each function it appears in.)
make: *** [monsters.o] Error 1



I put mypatch in monsters.cpp and on monsters.h but still errrrroorrr help pls :D

Compiling on slackware 10.2
"Se os senhores da guerra mateassem ao pé do fogo,
deixando o ódio prá traz;
Mateando a alma se eleva, e, antes de lavar a erva.
O mundo estaria em paz!"

Posted Image

#8 Proglin

Posted 30 March 2006 - 11:43 PM
Proglin

    An old man

  • Members
  • PipPipPipPipPip
  • Reputation: 39
    Admirable
  • 216 posts
  • Location:Brasil

Do NOT use the option:
-DYUR_HIGH_LEVELS

I don't know how to implement the functions atoi64.


@ Morpheus_BR -> Plz, allways post a new reply. This way I can know . If you edit a post i don't receive notification

#9 Morpheus_BR

Posted 31 March 2006 - 11:45 AM
Morpheus_BR

    Bagualas

  • Members
  • PipPipPipPipPip
  • Reputation: 49
    Admirable
  • 207 posts
  • Location:RS/BR

@Proglin

Ths a lot brother, but what this do? :S

HIGHT_LEVELS ? :(

Using yurots 094d worked but using like neverland or mine sources get that error.. strange hun?

btw ths alot for this tuto :)
"Se os senhores da guerra mateassem ao pé do fogo,
deixando o ódio prá traz;
Mateando a alma se eleva, e, antes de lavar a erva.
O mundo estaria em paz!"

Posted Image

#10 Alreth

Posted 31 March 2006 - 02:46 PM
Alreth

    selfSay('Hello world')

  • Members
  • PipPipPipPipPip
  • Reputation: 49
    Admirable
  • 641 posts
  • Location:Sweden

Do you think you could upload your compiled Yurots 049d so I can download?

Popular work by myself:
( [thread=19577][npc] Gambling[/thread] )( [thread=41607][npc] Pay to Broadcast[/thread] )( [thread=380378][npc] Gym owner[/thread] )( [thread=378306]Training Room[/thread] )
(
[thread=19575]Furniture packing rune[/thread] )( [thread=21654]Door of Expertise (Level/Quest door)[/thread] )( [thread=23607]Exhaustion-function[/thread] )( [thread=19760]Rune merger system[/thread] )
(
[thread=19672][html] doSendAnimatedText colour-table[/thread] )( [thread=36989][java] Outfit-chooser[/thread] )( [thread=19574]Advanced mana runes[/thread] )( [thread=23529]Advanced drawbridge[/thread] )


Posted Image Posted Image


#11 Proglin

Posted 01 April 2006 - 12:41 AM
Proglin

    An old man

  • Members
  • PipPipPipPipPip
  • Reputation: 39
    Admirable
  • 216 posts
  • Location:Brasil

@Proglin

Ths a lot brother, but what this do? :S

HIGHT_LEVELS ? :(

Using yurots 094d worked but using like neverland or mine sources get that error.. strange hun?

btw ths alot for this tuto :)


This option allows you work with 64 bits integer in windows.

#12 Morpheus_BR

Posted 01 April 2006 - 03:16 AM
Morpheus_BR

    Bagualas

  • Members
  • PipPipPipPipPip
  • Reputation: 49
    Admirable
  • 207 posts
  • Location:RS/BR

@Proglin =**

@Alreth

I'm having problems with lua lib... i can't found it for slackware. :S

When i resolv that problem i post some versions compiled :D


Can someone post the libs on tgz or rpm? That he post for download are for debian .deb

Or convert the deb for rpm/tgz
"Se os senhores da guerra mateassem ao pé do fogo,
deixando o ódio prá traz;
Mateando a alma se eleva, e, antes de lavar a erva.
O mundo estaria em paz!"

Posted Image

#13 Alreth

Posted 01 April 2006 - 03:18 AM
Alreth

    selfSay('Hello world')

  • Members
  • PipPipPipPipPip
  • Reputation: 49
    Admirable
  • 641 posts
  • Location:Sweden

ooh great, thanks! :D

Popular work by myself:
( [thread=19577][npc] Gambling[/thread] )( [thread=41607][npc] Pay to Broadcast[/thread] )( [thread=380378][npc] Gym owner[/thread] )( [thread=378306]Training Room[/thread] )
(
[thread=19575]Furniture packing rune[/thread] )( [thread=21654]Door of Expertise (Level/Quest door)[/thread] )( [thread=23607]Exhaustion-function[/thread] )( [thread=19760]Rune merger system[/thread] )
(
[thread=19672][html] doSendAnimatedText colour-table[/thread] )( [thread=36989][java] Outfit-chooser[/thread] )( [thread=19574]Advanced mana runes[/thread] )( [thread=23529]Advanced drawbridge[/thread] )


Posted Image Posted Image


#14 Guest_Tutaum_*

Posted 01 April 2006 - 10:10 AM
Guest_Tutaum_*
  • Guests
  • Reputation: 0

don't worked here =(

#15 Ruly

Posted 01 April 2006 - 10:55 AM
Ruly

    Bye Bye Neverland

  • Members
  • PipPipPipPipPip
  • Reputation: 406
    Fantastic
  • 1,158 posts
  • Location:Venezuela

Nice Tutorial, i go try in the pc of a friend that use Linux :P
Visit It!BlogHogwarts
Posted Image

#16 Morpheus_BR

Posted 01 April 2006 - 05:20 PM
Morpheus_BR

    Bagualas

  • Members
  • PipPipPipPipPip
  • Reputation: 49
    Admirable
  • 207 posts
  • Location:RS/BR

If u are trying to built it in other distros and u canot find the libs... like boost headers (too much time to compile all boost)

Or devel libs.

Download the deb files and convert it on tar.gz files. Using this script

#!/bin/bash

###########################################################################
#
#	Shell program to Convert rpm and debian files to tar.gz format.
#
#	Copyright 2001, USM Bish <bish@nde.vsnl.net.in>.
#
#	This program is free software;  you can redistribute it and / or
#	modify it under the terms of the  GNU General Public License  as
#	published by the F ree Software Foundation;  either version 2 of 
#	the License, or (at your option) any later version. 
#
#	This program is  distributed in the hope that it will be useful, 
#	but  WITHOUT  ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#	General Public License for more details.
#
#
#	Usage:
#
#	2tgz.sh [ -h | --help ] [-d filename.deb] [-r filename.rpm]
#
#	Options:
#
#	-h, --help	      Display this help message and exit.
#	-d  filename.deb      Convert .deb file to tar.gz
#	-r  filename.rpm      Convert .rpm file to tar.gz
#
#
#	Revisions:
#
#	Aug/02/2001	File created   .......... Ver 0.1
#       Aug/02/2001     deb converter created ... Ver 0.2
#       Aug/03/2001     rpm converter added  .... Ver 0.3   
#
#       Dependencies on other utils:
#
#       o less      In case not installed, change value of
#                   MY_PAGER to your pager (viz view/ more etc.)
#       o ar        Needed for debian file conversion
#       o rpm2cpio  Needed for rpm conversion
#       o cpio      - do -
#
###########################################################################


###########################################################################
#	Constants
###########################################################################

PROGNAME=$(basename $0)
VERSION="0.3"
TEMP_FILE=/tmp/${PROGNAME}.$$

MY_PAGER=/usr/bin/less

###########################################################################
#	Functions
###########################################################################

function get_prefix
{
    echo $PACKAGE > $PROGNAME.1
    rev $PROGNAME.1 > $PROGNAME.2
    cat $PROGNAME.2 | cut -b 5- > $PROGNAME.1
    rev $PROGNAME.1 > $PROGNAME.2
    PREFIX=`cat $PROGNAME.2`
}

function view_tgz
{
   tar -tvvz < $PREFIX.tar.gz > $HOME/$PROGNAME.1
   cat $HOME/$PROGNAME.1 | awk '{print $1"\t"$3"\t"$6}' > $HOME/$PROGNAME.2
   echo -en "\nConstituents of tarball : $PREFIX.tar.gz\n\n" > $HOME/$PROGNAME.1
   echo -en "Permissions     Size    Contents\n\n" >> $HOME/$PROGNAME.1
   cat $HOME/$PROGNAME.2 >> $HOME/$PROGNAME.1
   cat $HOME/$PROGNAME.1 | $MY_PAGER
   clean_up
}

function done_message
{
   echo ""
   echo "Done .... Please unpack in a temporary directory"
   echo "Check that there are no filename conflicts ....."
   echo "You may like to do an *ldd* of binaries to check"
   echo "dependencies before installing."
   echo ""
   ls $PREFIX.*
   echo -en "\nView contents of "$PREFIX.tar.gz" [y/ n] .. "
   read YN
   if [ "$YN" = "y" ]; then
       view_tgz
   fi
   echo "Bye ... "  
}
    
function clean_up
{
        rm -f ${TEMP_FILE}
        rm -f $PROGNAME.1
        rm -f $PROGNAME.2
}


function graceful_exit
{
	clean_up
	exit
}


function error_exit 
{
	echo "${PROGNAME}: ${1:-"Unknown Error"}" >&2
	clean_up
	exit 1
}


function term_exit
{
	echo "${PROGNAME}: Terminated"
	clean_up
	exit
}


function int_exit
{
	echo "${PROGNAME}: Aborted by user"
	clean_up
	exit
}


function usage
{
	echo "Usage: ${PROGNAME} [-h | --help] [-d filename.deb] [-r filename.rpm]"
}

function helptext
{
	#####
	#	Function to display help message for program
	#	No arguments
	#####
	
	local tab=$(echo -en "\t\t")
		
	cat <<- -EOF-

        ${PROGNAME} ver. ${VERSION}	

        This is a program to Convert rpm and debian files to tar.gz format.
	
        $(usage)
	
        Options:
	
        -h, --help	      Display this help message and exit.
        -d  filename.deb      Convert .deb file to tar.gz
        -r  filename.rpm      Convert .rpm file to tar.gz

        Example: ${PROGNAME} -d package.deb  (to convert a .deb file)
        		
	-EOF-
}	


###########################################################################
#	Program starts here
###########################################################################

# Trap TERM, HUP, and INT signals and properly exit

trap term_exit TERM HUP
trap int_exit INT

# Process command line arguments

if [ "$1" = "--help" ]; then
    helptext
    graceful_exit
fi

if [ "$1" = "" ]; then
   if [ "$2" = "" ]; then
      helptext
      graceful_exit
   fi
fi

# Process arguments - edit to taste

while getopts ":hd:r:" opt; do

    case $opt in
    
    d ) echo $PROGNAME"  Debian .deb conversion" 

        PACKAGE="$2"
        get_prefix

        if [ -e $PACKAGE ]; then
            ar -x $PACKAGE
            rm -f control.tar.gz
            rm -f debian-binary
            mv data.tar.gz $PREFIX.tar.gz
            done_message
        else              # parm entered but incorrect
            echo "Debian package [$PACKAGE] not found" 
            echo "Quitting ... "
            clean_up
            exit 1  
        fi
        ;;
    
    r ) echo $PROGNAME"  RedHat .rpm conversion"

        PACKAGE="$2"
        get_prefix

        if [ -e $PACKAGE ]; then
            PD=`pwd`
            mkdir /tmp/2tgz
            rpm2cpio $PACKAGE > /tmp/2tgz/$PREFIX.cpio
            cd /tmp/2tgz
            cpio --extract --preserve-modification-time --make-directories < $PREFIX.cpio 1> /dev/null 2> /dev/null
            TARGET=`ls -d */`
            tar -cvvzf $PREFIX.tar.gz $TARGET 1> /dev/null 2> /dev/null
            cp $PREFIX.tar.gz $PD
            cd /tmp
            rm -rf 2tgz/
            cd $PD
            done_message
        else              # parm entered but incorrect
            echo "RedHat package [$PACKAGE] not found" 
            echo "Quitting ... "
            clean_up
            exit 1  
        fi
        ;;

    h ) helptext
        graceful_exit ;;
        
    * ) usage
	exit 1

    esac

done

graceful_exit

#############################################################

Save this code on a file call the deb2tgz

do this with root
chmod +x deb2tgz

Than u should convert the deb pakage in tar.gz
deb2tgz nameofLib.deb
Than make a dir with the name of the lib
mkdir nameofLib
before move the tar.gz into that folder
mv nameofLib.tar.gz folderwiththename

Enter in the folder and untar that

tar -xvzf file.tar.gz

Than u should copy the files into the /

cp -rf src /


I think that should work... for it worked fine.

Just use this if u could not find some libs of the required post.
Merged post:
I'm having that problems with onthink()

There is another way to NPC gives bye when u leave or stop talking?

becouse if there is not, we can't use none npcs :(


And about that u told about case sensitive.. i'm having aproblem with the chars.. i have in acc accounts/1.xml with player GOD Test

and on players/GOD Test also in file GOD Test

But when i try to enter in ots he put my nick all low case. Can someone tell me when i change to sources interprete case-sensitive???


Pls helpppp :)
"Se os senhores da guerra mateassem ao pé do fogo,
deixando o ódio prá traz;
Mateando a alma se eleva, e, antes de lavar a erva.
O mundo estaria em paz!"

Posted Image

#17 Proglin

Posted 02 April 2006 - 02:15 PM
Proglin

    An old man

  • Members
  • PipPipPipPipPip
  • Reputation: 39
    Admirable
  • 216 posts
  • Location:Brasil

Morpheus_BR, I use this function "onthink()" :

aol.lua script:
focus = 0
talk_start = 0
target = 0
following = false
attacking = false

 function onThink()
	if focus ~= 0 then
		if getDistanceToCreature(focus) > 3 then
			selfSay('Good bye then.')
			focus = 0
		end
	end
 end


function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
  	if focus == cid then
          selfSay('Good bye then.')
          focus = 0
          talk_start = 0
  	end
end


function onCreatureTurn(creature)

end

function msgcontains(txt, str)
  	return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
  	msg = string.lower(msg)

  	if (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 3 then
  		selfSay('Hello ' .. creatureGetName(cid) .. '! I sell scarfs (1k) and aols (10k).')
  		
		focus = cid
  		talk_start = os.clock()

  	elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 3 then
  		selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

  	elseif focus == cid then
		talk_start = os.clock()

		if msgcontains(msg, 'aol') then
			buy(cid,2173,1,10000)
		elseif msgcontains(msg, 'scarf') then
			buy(cid,2661,1,1000)

		elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 3 then
			selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
			focus = 0
			talk_start = 0
		end
  	end
end


#18 Alreth

Posted 02 April 2006 - 04:37 PM
Alreth

    selfSay('Hello world')

  • Members
  • PipPipPipPipPip
  • Reputation: 49
    Admirable
  • 641 posts
  • Location:Sweden

I think what he mean is that the onThing() function is crashing the server. I believe someone mentioned this earlier in the thread, no?

Popular work by myself:
( [thread=19577][npc] Gambling[/thread] )( [thread=41607][npc] Pay to Broadcast[/thread] )( [thread=380378][npc] Gym owner[/thread] )( [thread=378306]Training Room[/thread] )
(
[thread=19575]Furniture packing rune[/thread] )( [thread=21654]Door of Expertise (Level/Quest door)[/thread] )( [thread=23607]Exhaustion-function[/thread] )( [thread=19760]Rune merger system[/thread] )
(
[thread=19672][html] doSendAnimatedText colour-table[/thread] )( [thread=36989][java] Outfit-chooser[/thread] )( [thread=19574]Advanced mana runes[/thread] )( [thread=23529]Advanced drawbridge[/thread] )


Posted Image Posted Image


#19 Morpheus_BR

Posted 02 April 2006 - 06:06 PM
Morpheus_BR

    Bagualas

  • Members
  • PipPipPipPipPip
  • Reputation: 49
    Admirable
  • 207 posts
  • Location:RS/BR

Isn't crashing the server.. just don't work

I say hi to the NPC and he anwser me ok

I leave that room... I come back 15 minutes later and NPC still talking to me?


@Proglin

Is that working perfectly?



I'm having other problems with the case-sensitive. Becouse my player save on data/players/NiCk Of PlAyer


And otserv search on data/players/nick of player


All low-case

How can i fix it? To otserv search CASE SENSITIVE.. not only low-case ?


Ths a lot guys
"Se os senhores da guerra mateassem ao pé do fogo,
deixando o ódio prá traz;
Mateando a alma se eleva, e, antes de lavar a erva.
O mundo estaria em paz!"

Posted Image

#20 ronaldomon

Posted 02 April 2006 - 08:02 PM
ronaldomon

    Full Member

  • Members
  • PipPipPipPipPip
  • Reputation: 0
    Neutral
  • 166 posts
  • Location:Slovakia

Please Link To Compiled Linux Yurots> Thx
I'm RETURNED!!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users