π
<-
Chat plein-écran
[^]

problem with # command

:32ti89: :32ti892: :32ti89t: :32ti89tn: :32ti92: :32tiv200:

problem with # command

Message non lude compsystems » 06 Fév 2015, 16:44

Hello, for the following program does not save the contents of variable id1. is a tibasic problema?, there is a ASM program that solves the problem.

Thanks

Code: Tout sélectionner
test(cpyname,val)
Prgm
  Local temp
  ClrIO
  Disp "cpyname="&string(cpyname) © cpyname->id1
  Disp "val="&string(val) © val->50
  Disp "cpyname="&string(#(string(cpyname))) © cpyname->id1
  Pause

  Disp ""

  val→#(string(cpyname)) © cpyname->50 => id1->50
  Disp "cpyname="&string(#(string(cpyname))) © cpyname->val ???
  Disp "id1="&string(id1) © id1->50 ?????????
  Disp ""

  temp→#(string(cpyname)) © cpyname->temp
  val→temp

  Disp "cpyname="&string(#(string(cpyname)))
  Disp "id1="&string(id1)
  Disp ""

  Pause
  DispHome

EndPrgm


Entry Line steps

DelVar id1 [ENTER]
id1 [ENTER]
test(id1,"50") © 50→id1 [ENTER]
id1 [ENTER]
Avatar de l’utilisateur
compsystems
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Prochain niv.: 40.2%
 
Messages: 256
Inscription: 30 Mai 2011, 13:44
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: problem with # command

Message non lude Bisam » 17 Fév 2015, 08:03

If I understand your comments, it seems that at line :
Code: Tout sélectionner
  val→#(string(cpyname)) © cpyname->50 => id1->50
the simplification before assignation is incomplete... which is common in a program.
Apparently, global variables remain unassigned when used in a program, unless you explicitly ask to use their value... the problem being HOW ?

You may solve (part of) the problem by using "expr" :
Code: Tout sélectionner
expr(val & "→#(" & cpyname & ")")
Avatar de l’utilisateur
BisamAdmin
Niveau 15: CC (Chevalier des Calculatrices)
Niveau 15: CC (Chevalier des Calculatrices)
Prochain niv.: 69.6%
 
Messages: 5665
Inscription: 11 Mar 2008, 00:00
Localisation: Lyon
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: problem with # command

Message non lude compsystems » 22 Fév 2015, 01:18

solved, is required to enter the variable name as a string

Code: Tout sélectionner
chekid(varstr,type,content)
Prgm
  © Check the argument variable identifier
  Local vartype
  getType(#varstr)→vartype
  If vartype≠type or vartype="NONE" Then
    content → #varstr
  EndIf
EndPrgm


sample

delvar id1 [ENTER]

chekid("id1","NUM",85) [ENTER]

How the identifier id1 no contains a value, is assigned 85 to id1.

id1 = 85

now

chekid("id1","STR","hello") [ENTER]

How the identifier id1 contains a incorrect data type, reassigned a new value.

id1 = "hello"
Avatar de l’utilisateur
compsystems
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Prochain niv.: 40.2%
 
Messages: 256
Inscription: 30 Mai 2011, 13:44
Genre: Homme
Calculatrice(s):
MyCalcs profile


Retourner vers Problèmes divers / Aide débutants

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 49 invités

-
Rechercher
-
Social TI-Planet
-
Sujets à la une
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Faire un don / Premium
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...
Faire un don
Découvrez les avantages d'un compte donateur !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partenaires et pub
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1516 utilisateurs:
>1464 invités
>47 membres
>5 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Autres sites intéressants
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)