Language system

Fermé
djib7 - 10 août 2019 à 14:55
 djib7 - 11 août 2019 à 16:49
Bonjour,
Je travail sur un SI de type Century Software, je dois faire un petit rapport d'expertise et j'ai au cours de mes recherches des macro script. Je voulais savoir quel type language sagit-il. Le voilà:

///////////////////////////////////////////////////////////////////////////////
// File: jackpot.cs
//
// Contents:
// A sample script that acts as a simple slot machine.
// It also demonstrates capture of command return codes.
//
// It will look its best if the TinyTERM window is maximized first.
//
// Originated by P. Clark, Century Software Inc. 3/11/99
///////////////////////////////////////////////////////////////////////////////

// intro text
te.cls();
te.displaynl(" Welcome to the JACKPOT! game.");
te.displaynl("");
te.display(" Slots cost ");
te.display(_chr(36));
te.display("1 per pull. Two of a kind wins ");
te.display(_chr(36));
te.display("1 to ");
te.display(_chr(36));
te.displaynl("10.");
te.display(" Three of a kind wins ");
te.display(_chr(36));
te.display("10 to ");
te.display(_chr(36));
te.displaynl("100!");
te.displaynl("");

// check for usable emulation
if (te.emulation > 20) {
te.displaynl("JACKPOT! cannot be run on TN3270, TN5250 or TTY emulation.");
return(0);
}

// initialize variables
global done = false;
global tries = 0;
global wins = 0;
global finished = false;
global fruit = dimstr(10);

global w_temp = _val(right(_str(time()),5));
global n_temp = w_temp * w_temp;

// initialize the fruit array
fruit[0] = "LEMON ";
fruit[1] = "LIME ";
fruit[2] = "ORANGE ";
fruit[3] = "CHERRY ";
fruit[4] = "APPLE ";
fruit[5] = "GUAVA ";
fruit[6] = "PLUM ";
fruit[7] = "PEACH ";
fruit[8] = "BELL ";
fruit[9] = "KEY ";

// get permission to proceed
if ( msgbox("Do you want to play?","Jackpot!",2) == 1 )
{
te.displaynl("");
te.displaynl(" OK. Come back some other time.");
return(0);
}

SetFocus(GetObjectHWND(TEObj));
global start = _val(te.read("How much money did you bring? ", true));
global cash = start;

// start the slots
do
{
winnings = 0;
tries = tries + 1;
cash = cash - 1;
ShowCash();
Spin();
if (winnings > 0)
Count();
else
loseDisplay();
ShowCash();

// check to see if the game is over
if ( cash == 0 )
{
finished = true;
te.cls();
te.displaynl(" You're out of money.");
te.displaynl("");
}
else
{
if ( MsgBox("Would you like to spin again?","Jackpot!",2) == 1)
finished = true;
}
} while (finished == false);

// set a final message based on winnings or loss
if ( cash < start )
{
finalmsg = "Come back and lose more money anytime.";
}
else
{
if ( cash == start )
finalmsg = "Come back again.";
else
finalmsg = "Enjoy your winnings. Come back soon.";
}

te.displaynl("");
te.displaynl(finalmsg);

// functions follow

function ShowCash()
{
te.cls();
te.display("You have ");
te.display(_chr(36));
te.display(_str(cash));
te.displaynl(" now.");
}

function Spin()
{
// generate a pseudorandom number
w_temp = _val(left(_str(n_temp),5));
n_temp = w_temp * w_temp;

// set the individual wheels
wheels = right(_str(n_temp),3);
wfirst = _val(left(wheels,1));
wsecond = _val(midstr(wheels,2,1));
wthird = _val(right(wheels,1));

// count winnings, if any
if ( wfirst == wsecond )
winnings = wfirst + 1;
if ( wfirst == wthird )
winnings = wthird + 1;
if ( wsecond == wthird )
winnings = wsecond + 1;
if (( wfirst == wsecond) && (wsecond == wthird))
winnings = 10 * (wfirst + 1);
if (winnings > 0)
wins = wins + 1;

// display the spin results
results = fruit[wfirst] + fruit[wsecond] + fruit[wthird];
MsgBox(results,"Jackpot",0);
}

function Count()
{
// add up the winning money and display it
cash = cash + winnings;
line1 = "You just won " + _chr(36) + _str(winnings) + ".";
line2 = "You have " + _chr(36) + _str(cash) + " now.";
line3 = "You've hit " + _str(wins) + " in " + _str(tries) + " spins.";
fullline = line1 + "\r\n" + line2 + "\r\n" + line3;
MsgBox(fullline,"Jackpot!",0);
}

function loseDisplay()
{
// add up the losing money and display it
line1 = "You just lost $1.";
line2 = "You have " + _chr(36) + _str(cash) + " now.";
line3 = "You've hit " + _str(wins) + " in " + _str(tries) + " spins.";
fullline = line1 + "\r\n" + line2 + "\r\n" + line3;
MsgBox(fullline,"Jackpot!",0);
}

1 réponse

yg_be Messages postés 22720 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 23 avril 2024 1 476
11 août 2019 à 11:36
bonjour, je pense qu'il s'agit du langage CScript de Century Software, Inc..
que veux-tu dire par "type de langage"?
0
Merci pour la réponse, en fait c'est ça c'est du CScript. Enfet je n'ai aucune notion sur ce dernier. Et les informations sur Tinyterm Century sont rares et pas claire. Bref j'ai découvert un avantage dans Tinyterm qui est d'enregistrer les actions clavier et d'obtenir le script correspondant puis de le modifier à sa guise. Ce qui permet d'automatiser certaines taches répétitives. Ma question est : Dans un processus d'automatisation est-ce qu'il sera possible de planifier ces taches de façon à ce qu'elle s’exécutent automatiquement selon des heures précises. Si on prévoit une interface utilisateur développé en java ou autre qui va gérer les échanges avec le SI, il n'aurait il pas un problème de compatibilité.... Je ne sais si je pause les bonnes questions ou si je me fait comprendre. Si quelqu'un maîtrise le CSCRIPT ou l’émulateur Tinyterm merci de m'aiguiller!
0