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
scripts using mysql (any kind of script)
Author Message
ChaveS
Journeyman
*

Posts: 69
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Oct 2012
Reputation: 0



Post: #1
scripts using mysql (any kind of script)
My shard is going crazy, using many logs, vars, tag, etc...

So no ill try to use mysql to store some infos. Already installed and connected mysql on local host.

I remember on last forum we got many script samples using mysql...
But on new forum we dont got so much...

Someone has the old scripts so i can take a look..
Thats the way i learn!

thanks!
(This post was last modified: 12-05-2012 12:28 PM by ChaveS.)
12-05-2012 12:25 PM
Find all posts by this user Like Post Quote this message in a reply
Barnabus
Journeyman
*

Posts: 124
Likes Given: 0
Likes Received: 3 in 2 posts
Joined: Apr 2012
Reputation: 1



Post: #2
RE: scripts using mysql (any kind of script)
I believe you will suffer more reading and writing to an external database because you have said "My Shard is going crazy"..... (Juts to note on LOGS (These are not variables and don't use up memory)......

I would suggest removing the VARS in many cases you dont need to use variables as you have return and arguments with functions. If you already know the following forgive me and consider others browsing may find it useful to know how to reduce the VARLIST by removing some elsewhere

Lets take a real life example to demonstrate how you can turn any situation into variables arguements and functions as well as just for fun:
You just met a new girl and would like to have intimate relations with her in your own house. Though the whole event is dependant of 4 major factors.

1. You must remeber her name.
2. You must select a time when your wife isnt home.
3. You must phone and invite the the new girl around.
4. The girl must accept your invite.

To relate this to your problem, you currently have the following VARS
Code:
// Stuff we dont know
VAR.ChicksName=Unknown
VAR.AmIGettingLaid=0
//Stuff we do know
VAR.ChicksMobileNumber=12345678911
VAR.WhenShesOutDay=19
VAR.WhenShesGoesOutHour=15
VAR.WhenSheComesBackHour=24

The stuff we do know can be either tagged to an ITEMdef in game or added to a DEFNAME
Adding to a DEFNAME may use the same memory as a VAR but it is still a method for tidying up .VARLIST

Code:
[DEFNAME ExtraCurricularActivities]
ChicksMobileNumber=12345678911
WhenWifesOutDay=19
WhenWifesGoesOutHour=15
WhenWifeComesBackHour=24
That only leaves 2 Vars to render un-needed, now lets invent some functions for this scenario
Code:
[FUNCTION GetHerNameScam]
[FUNCTION PhoneChick]
[FUNCTION InviteChickAround]
[FUNCTION AmIGettingLaid]

//Lets rearrange this list into a sensible order of function.
[FUNCTION PhoneChick]
[FUNCTION GetHerNameScam]
[FUNCTION InviteChickAround]
[FUNCTION AmIGettingLaid]

//And again
[FUNCTION AmIGettingLaid]
[FUNCTION PhoneChick][FUNCTION GetHerNameScam][FUNCTION InviteChickAround]
You can almost read that now as;
"I am getting laid if I phone, get her name, invite her around when wife is out and she accepts".

Lets pretend this Chicks morality lies somewhere similiar to your own, and she will accept if you use her name to invite her. InviteChickAround Depends on GetHerNameScam which is fired when you PhoneChick. As there is no sphere commands for phoning DialConnect Hangup and Reply we will just make up as would be functions

So the whole thing will start with the command .PhoneChick and VAR.ChicksName and VAR.AmIGettingLaid will be completely gone.
Code:
[FUNCTION PhoneChick]
IF <DialConnect <EVAL ChicksMobileNumber>>
    GetHerNameScam
ELSE
    HangUp
ENDIF

[FUNCTION GetHerNameScam]
SAY Hello, hey ! how do you spell your name
DORAND 3
    SAY I was going to send you an email
    SAY I got you a card
    SAY I have you a little present
ENDDO
IF !(STRMATCH(*<Reply>*, "remeber"))
    
    // And Below is how you can elimate  variables by stacking functions in arguements.
    AmIGettingLaid <InviteChickAround <Reply>, <EVAL WhenWifesGoesOutDay>, <EVAL WhenWifesGoesOutHour>>

ENDIF
HangUp

[FUNCTION InviteChickAround]
SAY Hi <ARGV[0], would you like to come around on the <ARGV[1]>th at <EVAL <ARGV[2] + 1> hundred hours ?
IF !(STRMATCH(*<Reply>*, "no")) || !(STRMATCH(*<Reply>*, "cant")) || !(STRMATCH(*<Reply>*, "sorry"))
    RETURN 0
ELSE
    RETURN 1
ENDIF

[FUNCTION AmIGettingLaid]
IF <ARGS>
    SAY Yes you are getting laid
ELSE
    SAY No not this time
ENDIF
(This post was last modified: 12-11-2012 09:17 AM by Barnabus.)
12-11-2012 09:13 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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