This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 18 Nov 2003 05:43:43 pm    Post subject:

I want to make a Basic program that can link two calcs, but I am not sure how to use Get( and Send( (and GetCalc( ?). Could someone please explain how to use them, or, even better, give an example?
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 18 Nov 2003 05:51:26 pm    Post subject:

Get( and Send( work with the CBL/CBR external thingies only...

read the manual either online, or your book to find out how to use them... unless you dont have either a manual, or Adobe Whatever...
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 18 Nov 2003 05:53:29 pm    Post subject:

So is there anything that I can use to link two calcs? And what does GetCalc( do?
Back to top
AlienCC
Creative Receptacle!


Know-It-All


Joined: 24 May 2003
Posts: 1927

Posted: 18 Nov 2003 07:37:18 pm    Post subject:

If you want to learn how link programs work between 2 calcs you may want to check out this program I wrote way back when.
http://www.ticalc.org/archives/files/fileinfo/135/13571.html

It is for the TI-85, but you can still learn how it works for your Ti-83 or other just by viewing it. The commands are similar between the two.

Then if thats not enough motivation for you, I did make a game (Battleship) some time ago that supports multiplayer over 2 Ti's.
http://www.ticalc.org/archives/files/fileinfo/135/13570.html

Good luck, and make something cool.

--AlienCC
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 18 Nov 2003 08:31:12 pm    Post subject:

Thanks AlienCC. BTW, if anybody has the same question, the TI-83 Plus manual says:

Quote:
GetCalc(variable) Gets contents of variable on another TI-83 Plus and stores it to variable on the receiving TI-83 Plus. Keys: [PRGM] I/O 0:GetCalc(


I think this is what I need.
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 19 Nov 2003 12:39:49 am    Post subject:

yes, but minor detail:
the sending calc (not the one doing the getcalc()) must be in wait mode for it to work (Pause command or homescreen, nothing running) Sad
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 19 Nov 2003 05:38:19 pm    Post subject:

I guess that means all two-player games have to be turn based... Sad Sad Sad AlienCC - I don't think your Battleship program works right for 2-player mode (It didn't do anything when I tried it out with mine and a friend's calculator).
Back to top
AlienCC
Creative Receptacle!


Know-It-All


Joined: 24 May 2003
Posts: 1927

Posted: 20 Nov 2003 03:17:21 am    Post subject:

Feel free to fix it then.

--AlienCC
Back to top
Babyboy


Advanced Member


Joined: 11 Jun 2003
Posts: 499

Posted: 20 Nov 2003 07:55:08 pm    Post subject:

i think that pushed a very bad a button sir robin.....

in order to get this back on track i pose a question.

0üáSTAT(39)
0üáSTAT(40)
ClrHome
ClrDraw
Asm(prgmCBATTLE
0üB
0üA
Menu("WHO IS PLAYER 1?","YOU",P0,"OTHER PLAYER",P1

[CODE]Lbl P0
áSTAT(1)üA
For(Z,5,9
While Z
Output(4,5,"ENEMY'S TURN"
GetCalc(áSTAT(40)
GetCalc(áSTAT(39)
If áSTAT(40)ø0 and áSTAT(39ø0
Goto P2
End

Lbl P2
Output(1,1,"STATS:"
Output(1,7,A
Output(1,8,"/"
Output(1,9,áSTAT(1)
Output(1,12,"HP"
Output(3,1,"ENEMY:"
Output(3,7,áSTAT(40)
Output(3,11,"/"
Output(3,12,áSTAT(39)[CODE]

What is next?, am i doing this right??
Back to top
JacobdeHaan


Member


Joined: 10 Jul 2003
Posts: 165

Posted: 20 Nov 2003 08:36:49 pm    Post subject:

Actually, I read somewhere that is it possible to get the getcalc( thing to work. What the guy said to do was set a random number in the variable you're going to store to, then inside a repeat loop, keep "pinging" the calculator for the variable until it is different from the randum number.
It makes enough sense, I just haven't had a chance to do it right.
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 20 Nov 2003 09:23:50 pm    Post subject:

yes, that would work, but the calc that you are pinging must be in a wait mode (again, run indecator not moving or in pause status)
Back to top
Babyboy


Advanced Member


Joined: 11 Jun 2003
Posts: 499

Posted: 20 Nov 2003 09:42:34 pm    Post subject:

What this is just the player 1 code, i think that it wouldnt work without 2 sets of code, one for each player, then its more individualized. the Getcalc( loop waits for the other calc to put in his\her command, then when it pauses it gets the new HP var from the target calc, looks at it, stres and displays it, then it gets the var that doesn't equal 0 and looks at it, if it is 1 for example, it will get the ATTACK variable and subtract it from your defence variable, subtract that from your hp variable, display it, and send it to your turn.


at your turn you choose the action, like attack, magic, item, and stores it to LSTAT 39, then if it is a potion or other passive movement it does it and pauses, starting the loop again.


does this make sense or am i loosing it? also i should take out the retreval of Lstat(40) it is redundant
Back to top
AlienCC
Creative Receptacle!


Know-It-All


Joined: 24 May 2003
Posts: 1927

Posted: 21 Nov 2003 03:39:01 pm    Post subject:

Babyboy wrote:
i think that pushed a very bad a button sir robin.....

Sorry if I came accross that way.

The thing is I did extensive testing on the development of the Ti-85 version, the Ti-86, Ti-82, and Ti-83/83p versions did not get tested as well as I only had one of each of those during development. So it is very real possibility that the Ti-83 version of the multiplayer code doesn't quite work correctly.

So to rephrase that. Anyone who wishes may correct the problems in my code if any exist.

--AlienCC
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 21 Nov 2003 04:58:00 pm    Post subject:

I think the error was that you used Get( and Send(. I can understand that - I made the same error myself when I first tried it.

Also, for most games, turn-based linking would be pointless - you could just take turns using the same calculator. The only games it would actually make sense to use linking for are guessing games like Battleship and Hangman.

Omnicalc has two linking functions: linkGet( and linkSend(.

Omnicalc Version 1.10 wrote:
linkGet(n)

Gets byte from link port. n=0 or (n=1 to wait forever for byte). -1 if failed.

linkSend(byte)
Sends byte (0-255) through link port. Returns 0 on work, -1 on failure.


I'd think these can be used the following way:


Code:
Calc 1                               Calc 2
:getKey -> K                     :linkGet(1->K
:Repeat not(Ans                  :Disp "Other calc's key","press
                                   was",Ans
:linkSend(K
:End


This can potentially be very useful, but you would have a hell of a time transferring strings (one letter each time). So maybe you should stick to numbers that are from 0 to 255.


Last edited by Guest on 21 Nov 2003 05:00:18 pm; edited 1 time in total
Back to top
Spyderbyte


Advanced Member


Joined: 29 May 2003
Posts: 372

Posted: 23 Nov 2003 06:18:15 pm    Post subject:

JacobdeHaan wrote:
Actually, I read somewhere that is it possible to get the getcalc( thing to work. What the guy said to do was set a random number in the variable you're going to store to, then inside a repeat loop, keep "pinging" the calculator for the variable until it is different from the randum number.
It makes enough sense, I just haven't had a chance to do it right.

Yup, you probably read that either in the archives here or back at Cirrus Programming. Maarten was helping me out, and I managed to get his code working with the help of an assembly program someone wrote for me. (I can't remember who at the moment, but if you're reading this, thanks again!) It uses the same program on each calc, and then the called assembly program gets the other calc out of pause.

I used in my Battleship game (Apparently I came up with the idea after our Alien friend, but I didn't find out about his until after I had finished or come close).

Heres the multiplayer part:

Code:
rand->X
X->Y
GetCalc(Y)
Asm(prgmZENTER
Pause
If X=Y
Then
GetCalc(X)
(X>=Y->T
Else
Asm(prgmZENTER
(X<Y->T
End
Pause "Press Enter..."
ClrHome
If T
Then
Player 1 stuff....
Else
Player 2 stuff....
End


You would have to add a few more lines of code in order to get it to alternate between players as it does in my program, but I thought I'd give you the basics and answer any questions you may have.

Oh, and you can find ZENTER along with the complete Battleship game here: http://www.ticalc.org/archives/files/fileinfo/296/29699.html

Hope this helps!

Spyderbyte


Last edited by Guest on 23 Nov 2003 06:22:52 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 24 Nov 2003 04:52:41 pm    Post subject:

what does prgmZENTER do?
Back to top
Spyderbyte


Advanced Member


Joined: 29 May 2003
Posts: 372

Posted: 24 Nov 2003 07:18:24 pm    Post subject:

It gets the other calc out of pause. (It sends the enter key over the link)

Spyderbyte
Back to top
AlienCC
Creative Receptacle!


Know-It-All


Joined: 24 May 2003
Posts: 1927

Posted: 24 Nov 2003 10:11:38 pm    Post subject:

Man I feel really old all of a sudden...like 969 years old Smile
Its been so long since I've programmed anything for a TI its crazy, don't really remember much.

--AlienCC
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement