Welcome, Guest. Please login or register.
April 19, 2024, 11:31:12 PM

Login with username, password and session length
* Home Help Arcade Login Register
.
+  Forum
|-+  Homebrew Player Tracking and EFT Systems.
| |-+  NLG Homebrew Player Tracking and EFT Systems.
| | |-+  My Home Brew TITO program
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3 Go Down Print
Author Topic: My Home Brew TITO program  (Read 36551 times)
Foster
The S2000 GURU
Contributing NLG Member
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 345
Offline Offline

Gender: Male
Posts: 2872



« on: December 21, 2011, 09:52:42 AM »

I have been working on my own TITO program

All coded with VS 2010 C#
I get any tilts from machine and can redeem any ticket (right now hard coded for a specific amount) until I figure out how to access my SQL Table that I will use for tickets

Table
VoucherNumber    BigInt (same as Long) primary key
Issue Date            DateTime
Redeem Datge      DateTime
Redeemed            Int          (0 not redeemed) 1 redeemed
  I cant find a Boolean variable in MS SQL Express


I wish the built C# SerialPort Class and underlying code was not buggy.
I thought I found a decent one but it even has issues.
Logged

A Slot Machine and Coca-Cola Addict!!
"If it is not broke do not fix it" I keep forgetting that!
stayouttadabunker
Senior Full time Member.
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 1039
Offline Offline

Gender: Male
Posts: 13447



« Reply #1 on: December 21, 2011, 01:29:52 PM »

Sounds like a great winter project Foster!  applause
Keep it up! K+ to you!
I hope you succeed and if there's anything that the slot community can do to help you - let us know!  yes
Logged
Foster
The S2000 GURU
Contributing NLG Member
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 345
Offline Offline

Gender: Male
Posts: 2872



« Reply #2 on: December 21, 2011, 01:35:08 PM »

Yeah find me a free or very low cost C# Serial Port class library that supports 9 bits!
I hate doing parity flipping to make this work.

Also I can see why AndyP App had timing issues or not working with some serial ports.
Mine wont work with a standard serial port only a USB to Serial Adapter.
« Last Edit: December 21, 2011, 01:40:54 PM by Foster » Logged

A Slot Machine and Coca-Cola Addict!!
"If it is not broke do not fix it" I keep forgetting that!
crgadyk
Contributing NLG Member
NLG Member 101 to 500 Post
*

Total Karma Storms: 35
Offline Offline

Gender: Male
Posts: 350



« Reply #3 on: December 21, 2011, 02:19:35 PM »

It won't make a huge difference but you can use a BIT data type for your boolean instead of storing an INT. A bit is just 0 or 1 (typically people treat 0 as the false and 1 as the true).

You could also use a tinyInt but even that is using more storage space than a Bit would. And depending on which version of SQL server you are using, you have some flexibility with the dates as well. In SQL 2005 or below, you just have a DateTime which is the standard, but with 2008 and above there are several more options. You can do with just Date or Time (which really helps in date comparisons) and you can also use a DateTime2 which goes down to a finer level of granularity in the time. And not that it matters, but it will work for older dates (pre 1700) and for future dates.
Logged
zarobhr
Contributing Gold NLG Member
Sr.NLG Member 501 to 1000 Post
*

Total Karma Storms: 178
Offline Offline

Gender: Male
Posts: 622



« Reply #4 on: December 24, 2011, 08:55:01 AM »

I have been working on my own TITO program

All coded with VS 2010 C#
I get any tilts from machine and can redeem any ticket (right now hard coded for a specific amount) until I figure out how to access my SQL Table that I will use for tickets

Table
VoucherNumber    BigInt (same as Long) primary key
Issue Date            DateTime
Redeem Datge      DateTime
Redeemed            Int          (0 not redeemed) 1 redeemed
  I cant find a Boolean variable in MS SQL Express


I wish the built C# SerialPort Class and underlying code was not buggy.
I thought I found a decent one but it even has issues.
foster you can use Bit in Sql. when writting that filed to the database you can write it using true false
Logged
Foster
The S2000 GURU
Contributing NLG Member
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 345
Offline Offline

Gender: Male
Posts: 2872



« Reply #5 on: December 24, 2011, 11:29:40 PM »

I have added reset hand pay button to the App.
Logged

A Slot Machine and Coca-Cola Addict!!
"If it is not broke do not fix it" I keep forgetting that!
Foster
The S2000 GURU
Contributing NLG Member
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 345
Offline Offline

Gender: Male
Posts: 2872



« Reply #6 on: December 27, 2011, 09:43:57 PM »

Why is this code not reading every row/record in the database?
Only returns the first row/record!

Code:

 SqlCommand VoucherCommand = VoucherCon.CreateCommand();
            VoucherCon.Open();
            VoucherCommand.CommandText = "SELECT * FROM Voucher";
            SqlDataReader VoucherReader = VoucherCommand.ExecuteReader();
            
            while (VoucherReader.Read())
            {
                textBox1.Text+=Convert.ToString(VoucherReader["VoucherNumber"]);
                textBox1.Text+=" ";
                textBox1.Text+=Convert.ToString(VoucherReader["Amount"]);
                textBox1.Text+="\r\n";
            }
« Last Edit: December 27, 2011, 09:49:56 PM by Foster » Logged

A Slot Machine and Coca-Cola Addict!!
"If it is not broke do not fix it" I keep forgetting that!
zarobhr
Contributing Gold NLG Member
Sr.NLG Member 501 to 1000 Post
*

Total Karma Storms: 178
Offline Offline

Gender: Male
Posts: 622



« Reply #7 on: December 27, 2011, 09:49:19 PM »

Why is this code not reading every row/record in the database?

Code:

 SqlCommand VoucherCommand = VoucherCon.CreateCommand();
            VoucherCon.Open();
            VoucherCommand.CommandText = "SELECT * FROM Voucher";
            SqlDataReader VoucherReader = VoucherCommand.ExecuteReader();
            
            while (VoucherReader.Read())
            {
                textBox1.Text+=Convert.ToString(VoucherReader["VoucherNumber"]);
                textBox1.Text+=" ";
                textBox1.Text+=Convert.ToString(VoucherReader["Amount"]);
                textBox1.Text+="\r\n";
            }
here is how mine read
Code:
 While myReader.Read()

                Dim dbval As Long = myReader.GetInt64(0)
                Console.WriteLine(dbval)
                Dim dbamount As Long = myReader.GetInt32(3)
                Console.WriteLine(myReader("amount").ToString())
                If sqlval = CLng(dbval) Then
                    SAS_RedeemTicket(currport, address, sqlval, dbamount)
                Else
                    SAS_RedeemTicket(currport, address, sqlval, 0)
                End If
            End While

how many records is it reading
Logged
Foster
The S2000 GURU
Contributing NLG Member
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 345
Offline Offline

Gender: Male
Posts: 2872



« Reply #8 on: December 27, 2011, 10:05:35 PM »

That code I posted is test code to see if I am accessing the database
which I am but it is not cycling through all records.


all I am trying to do test that I am reading each record through my loop
Then I can modify it to use the value from the database instead of a default value.

here is my voucher redeem code (data base only )

Code:
      {
            SqlCommand VoucherCommand = VoucherCon.CreateCommand();
            VoucherCon.Open();
            VoucherCommand.CommandText = "SELECT * FROM Voucher";
            SqlDataReader VoucherReader = VoucherCommand.ExecuteReader();
            Array.Copy(InTicketData, 11, InsertedVoucherNumber, 0, 8);
            InsertedVoucherNum = BCDtoLong(InsertedVoucherNumber);
      
            while (VoucherReader.Read())
            {
                DBVoucherNum = Convert.ToInt64(VoucherReader["VoucherNumber"]);
                DBVoucherAmt = Convert.ToInt64(VoucherReader["Amount"]);
                textBox1.Text += DBVoucherNum; //debugging code
                textBox1.Text += " ";
                textBox1.Text += DBVoucherAmt;
                textBox1.Text += "\r\n";              //end

                if (InsertedVoucherNum == DBVoucherNum)
                {
                   Long2BCD(DBVoucherAmt, VoucherAmount);                    
                }

            }
            VoucherReader.Close();
            VoucherCon.Close();


« Last Edit: December 27, 2011, 10:17:25 PM by Foster » Logged

A Slot Machine and Coca-Cola Addict!!
"If it is not broke do not fix it" I keep forgetting that!
zarobhr
Contributing Gold NLG Member
Sr.NLG Member 501 to 1000 Post
*

Total Karma Storms: 178
Offline Offline

Gender: Male
Posts: 622



« Reply #9 on: December 27, 2011, 10:11:55 PM »

how many records is it missing, or is it random you might try adding a counter to the while loop and see if it counts up to the same number of records you have

Logged
zarobhr
Contributing Gold NLG Member
Sr.NLG Member 501 to 1000 Post
*

Total Karma Storms: 178
Offline Offline

Gender: Male
Posts: 622



« Reply #10 on: December 27, 2011, 10:16:06 PM »

also it would probable be more effeciant to to a select * from vouchers where vouchernumber = yourinsertedticketnumbervouchernumber

then it should only pull one voucher from data base (the matching one)

if it doesnt exist then in the followup poll put amount of 0
Logged
Foster
The S2000 GURU
Contributing NLG Member
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 345
Offline Offline

Gender: Male
Posts: 2872



« Reply #11 on: December 27, 2011, 10:18:13 PM »

it only reads first record
I can do the comparison but both code segments reads only the first record.
I can tell by the textbox output

3061316887909496 300000

First number is voucher number, second number amount in cents.

VoucherReader.Read(() is supposed to advance to next record if it exists.
While loop is exited if no more records.
 

I do know if I can get it to advance to each record my code will work.
I just tried it (used the ticket that matched the first record) and it loaded the amount in the DB.
« Last Edit: December 27, 2011, 10:51:16 PM by Foster » Logged

A Slot Machine and Coca-Cola Addict!!
"If it is not broke do not fix it" I keep forgetting that!
zarobhr
Contributing Gold NLG Member
Sr.NLG Member 501 to 1000 Post
*

Total Karma Storms: 178
Offline Offline

Gender: Male
Posts: 622



« Reply #12 on: December 27, 2011, 10:52:28 PM »

it only reads first record
I can do the comparison but both code segments reads only the first record.
I can tell by the textbox output

3061316887909496 300000

First number is voucher number, second number amount in cents.

VoucherReader.Read(() is supposed to advance to next record if it exists, otherwise go to next statement after loop.

I do know if I can get it to advance to each record my code will work.
I just tried it (used the ticket that matched the first record) and it loaded the amount in the DB.
add
 Console.WriteLine(dbvouchernum )
right aftr you textbox commands

and be sure to add Output window to your IDE view and see what you get
Logged
Foster
The S2000 GURU
Contributing NLG Member
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 345
Offline Offline

Gender: Male
Posts: 2872



« Reply #13 on: December 27, 2011, 11:27:26 PM »

I found the problem

I wish when I tell VS 2010 to add a SQL Sever MDF file it would not copy it to the solution directory and use the one where I placed it after using another project to create it.
I was viewing and editing one data base, my program was using the wrong one.

its working now

Just finished the add ticket to DB code
« Last Edit: December 28, 2011, 05:31:53 AM by Foster » Logged

A Slot Machine and Coca-Cola Addict!!
"If it is not broke do not fix it" I keep forgetting that!
knagl
Global NLG Site Moderator
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 642
Offline Offline

Gender: Male
Posts: 5489


Kevin


« Reply #14 on: December 30, 2011, 10:17:11 PM »

I just wanted to chime in and give a K+ to everyone here -- nice work on getting this stuff working!  Hopefully someday I'll have enough time to tinker with my machines and try to get it working in my house...
Logged

If you find this site helpful, please consider making a small donation to help defray the cost of hosting and bandwidth.

Please do not PM me for support or "how to" requests -- please post your request in the forum so that everyone may assist you and everyone can benefit from the answer to your question!  Thanks! Smiley
Foster
The S2000 GURU
Contributing NLG Member
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 345
Offline Offline

Gender: Male
Posts: 2872



« Reply #15 on: January 10, 2012, 11:25:07 PM »

I decided to help some one have a TITO program with Database for the tickets (member of NLG)
He has 2 machines.

Here is the issue I came across:
When I modified my code for use with 2 machines the second machine would not redeem tickets right.

Since am not well versed on threading, and a few other things I duplicated the routines for first machine as  second set of routines
I modified variable names so the code wont use wrong variables.
I know that using different variable names may not be necessary when they are inside a function but doing so to be safe.

The only time the ticket redemption worked for the second machine is when my program was not in the foreground.
IF I was watching the program it would not work, if I was looking at another application it worked.


Why would being in the foreground (program window on top)or in the background (program window behind another application) matter?
All I know is it is strange.

This is how I fixed it for now:
I copied the whole single machine project folder
Then I modified com port name, form title
Both run just fine and work fully.

Why?
« Last Edit: January 10, 2012, 11:47:58 PM by Foster » Logged

A Slot Machine and Coca-Cola Addict!!
"If it is not broke do not fix it" I keep forgetting that!
zarobhr
Contributing Gold NLG Member
Sr.NLG Member 501 to 1000 Post
*

Total Karma Storms: 178
Offline Offline

Gender: Male
Posts: 622



« Reply #16 on: January 10, 2012, 11:29:14 PM »

this is where on mine i actually run each machine in a thread of its own. then you can start a thread for each com port and they dont interfere with each other

i have 2 NLG users plus myself running right now one with 9 machines one with 5 and i have had up to 13 machines running
Logged
Foster
The S2000 GURU
Contributing NLG Member
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 345
Offline Offline

Gender: Male
Posts: 2872



« Reply #17 on: January 11, 2012, 01:43:47 AM »

I know nothing about threading or how to create thread usable code
plus I would still want each machine to have its own Form
Logged

A Slot Machine and Coca-Cola Addict!!
"If it is not broke do not fix it" I keep forgetting that!
FORDSBS
Contributing NLG Member
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 363
Offline Offline

Gender: Male
Posts: 4162


PET


« Reply #18 on: January 11, 2012, 01:52:28 AM »

this is where on mine i actually run each machine in a thread of its own. then you can start a thread for each com port and they dont interfere with each other

i have 2 NLG users plus myself running right now one with 9 machines one with 5 and i have had up to 13 machines running


COOOOOOOOOOOOOOL
Logged
zarobhr
Contributing Gold NLG Member
Sr.NLG Member 501 to 1000 Post
*

Total Karma Storms: 178
Offline Offline

Gender: Male
Posts: 622



« Reply #19 on: January 11, 2012, 08:24:01 AM »

Code:
Public Shared Sub startMachine(ByVal CommPort As String)
        'newThread = New Thread(AddressOf w.DoMoreWork)

        Dim newThread = New Thread(AddressOf myInit)
        newThread.Start(CommPort)

    End Sub
myinit is the code the runs each machine
this is the VB way of thread
for each thread (each machine i want running)
i do

startmachine("com3")
startmachine("com4")
etc
no need to worry about thread safe since in reality the threads are dependent upon each other
Logged
Foster
The S2000 GURU
Contributing NLG Member
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 345
Offline Offline

Gender: Male
Posts: 2872



« Reply #20 on: January 11, 2012, 10:48:16 AM »

I doubt that will work for a  Windows form application
Since I want each machine on its own form.
I have to figure out how to start a copy of my main form for each serial port passing it a string for the com port name (like you do)

Example may not be correct but how I would like it to work

FosterSASForm FosterSASFrom1 = new FosterSASFoirm();
FosterSASForm FosterSASForm2 = new FosterSASForm();
FosterSASForm1.ComPortName =  "COM!";
FosterSASForm2.ComPortName = "COM2";
FosterSASForm1.Show();
FosterSASForm2.Show();

I know it cant be that simple
« Last Edit: January 11, 2012, 10:53:37 AM by Foster » Logged

A Slot Machine and Coca-Cola Addict!!
"If it is not broke do not fix it" I keep forgetting that!
Foster
The S2000 GURU
Contributing NLG Member
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 345
Offline Offline

Gender: Male
Posts: 2872



« Reply #21 on: January 12, 2012, 04:31:39 AM »

In part of my form class I had to add the following code
Code:
public partial class FosterSASForm : Form
    {
        // had to add the following 2 lines
        private string p;
        private string p_2;
        public SerialPort SerialPort1 = new SerialPort(); // had to move serial port declaration here
       
        public FosterSASForm(string p, string p_2) // added the parameter strings to the class definition
        {
           
           
            this.p = p;
            this.p_2 = p_2;
           

code in program.cs normally looks like this

Code:
static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);           
     Application.Run( new FosterSASForm);
}

Had to change it to this
 
Code:
static void Main()
{
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    FosterSASForm FosterSASForm1 = new FosterSASForm("Foster;s S2000 on COM3", "COM3");
    Application.Run();
}
   

All I have to do is add a new line for each machine using a new line like FosterSASForm FosterSASForm2 - new FosterSASForm("Fosters AVP on COM4", "COM4");
I wish I had an AVP
« Last Edit: January 12, 2012, 06:50:45 AM by Foster » Logged

A Slot Machine and Coca-Cola Addict!!
"If it is not broke do not fix it" I keep forgetting that!
FORDSBS
Contributing NLG Member
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 363
Offline Offline

Gender: Male
Posts: 4162


PET


« Reply #22 on: January 12, 2012, 11:05:39 AM »

With the TITO I learned something new last night. Your bill acceptor
can take money but not read ticket bar code.
I had that problem & thought since it took bills it was OK.
a guy on NLG told me about it taking bills but not reading bar code. That was problem.
 +1 (Karma, or whatever) to the guy that helped me. You know who you are.
Ford
Logged
stayouttadabunker
Senior Full time Member.
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 1039
Offline Offline

Gender: Male
Posts: 13447



« Reply #23 on: January 12, 2012, 03:13:35 PM »

In part of my form class I had to add the following code... I wish I had an AVP



This is a classic "quote taken out of context".... rotflmao
Logged
IFFV68
Contributing NLG Member
Sr.NLG Member 501 to 1000 Post
*

Total Karma Storms: 32
Offline Offline

Gender: Male
Posts: 784



« Reply #24 on: January 13, 2012, 12:00:19 AM »

I don't believe it reads the Bar Code. The Dollar & cents amount is stored in a computer.
I don't know anything about computers, I just know that I can cash out of one machine & the other machine will take the ticket with the correct  amount. The amount has to be less than $3000.00.

My Slot tech..  is the best.
Logged
Pages: [1] 2 3 Go Up Print 
« previous next »
Jump to:  


If you find this site helpful, Please Consider Making a small donation to help defray the cost of hosting and bandwidth.



Newlifegames.com    Newlifegames.net    Newlifegames.org
   New Life Games    NewLifeGames  NLG  We Bring new Life to old Games    1-888-NLG-SLOTS
Are all Copyright and Trademarks of New Life Games LLC 1992 - 2021


FAIR USE NOTICE:

This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner.
We make such material available in an effort to advance awareness and understanding of the issues involved.
We believe this constitutes a fair use of any such copyrighted material as provided for in section 107 of the US Copyright Law.
In accordance with Title 17 U.S.C. Section 107, the material on this site is distributed without profit to those
who have expressed a prior interest in receiving the included information for research and educational purposes.

For more information please visit: http://www.law.cornell.edu/uscode/17/107.shtml.

If you wish to use copyrighted material from this site for purposes of your own that go beyond fair use,
you must obtain permission directly from the copyright owner.

NewLifeGames.net Web-Site is optimized for use with Fire-Fox and a minimum screen resolution of 1280x768 pixels.


Powered by SMF 1.1.20 | SMF © 2013, Simple Machines
Loon Designed by Mystica
Updated by Runic Warrior
Page created in 0.139 seconds with 19 queries.