Author Topic: string - duplicate symbol  (Read 6605 times)

0 Members and 1 Guest are viewing this topic.

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
string - duplicate symbol
« on: August 24, 2011, 09:49:49 am »
I'm trying to write a "chat-program" for the TI, but I have a problem:
If I want to write something, I'll have to edit the string!
But how can I save something in a String if ther's alreadsy saved something in it?
Code: [Select]
:DelVar Str00
:"abc" -> Str00
Isn't working

but sometimes, I deed olly to add one letter to String00! How to do that???
It allways tells me DUPLICATE SYMBOL
« Last Edit: August 24, 2011, 11:40:02 am by p2 »
*insert supercool signature*

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: string - duplivate symbol
« Reply #1 on: August 24, 2011, 09:59:59 am »
Str, Pic and GDB in Axe can only be set to a value when you're creating a program - you can't change the value of them while running the program. You'll need to use a free piece of RAM instead.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: string - duplivate symbol
« Reply #2 on: August 24, 2011, 10:42:47 am »
I'm trying to write a "chat-program" for the TI, but I have a problem:
If I want to write something, I'll have to edit the string!
But how can I save something in a String if ther's alreadsy saved something in it?
Code: [Select]
:DelVar Str00
:"abc" -> Str00
Isn't working

but sometimes, I deed olly to add one letter to String00! How to do that???
It allways tells me DUPLICATE SYMBOL

You need to do something like
Code: [Select]
:Zeros(Str1,3)
:"abc"->Str1
To get that to work (Assuming you can store a string to memory in axe). Most Axe variables are *not* like TI-BASIC variables. They're created at compile time, which means that if you were to store more information to them than was originally placed there, you'd either corrupt RAM or overwrite part of your program.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: string - duplivate symbol
« Reply #3 on: August 24, 2011, 10:50:06 am »
Code: [Select]
:Zeros(Str1,3)
:"abc"->Str1
That won't work either, because Zeros() already creates the static variable Str1 (three null bytes). Instead, do either this:
Code: (Axe) [Select]
:Copy("abc",Str1,3)or
Code: [Select]
:'a'→{Str1}
:'b'→{Str1}
:'c'→{Str1}
to put "abc" in a Str1 that already exists.

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: string - duplicate symbol
« Reply #4 on: August 24, 2011, 11:38:47 am »
and when I want to add a single letter to a string?
How to do that?
« Last Edit: August 24, 2011, 11:40:25 am by p2 »
*insert supercool signature*

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: string - duplicate symbol
« Reply #5 on: August 24, 2011, 11:59:57 am »
Try making the length of Str1 much larger then you need it to be -- I don't think it's easy to change the size of a constant after it's declared.
Code: [Select]
Zeros(50)->Str1

Copy("String 1",Str1,8)
Copy("The next string",Str1,15)

Alternatively, you could use either a buffer (like L1, L2, etc.) or an appvar.
This might not work/probably needs tweaking, but try something like:
Code: [Select]
Zeros(700)->L1
"Hello World!"->L1
Text(10,10,L1)
"Goodbye"[00]->L1
Text(10,20,L1)
(The [00] adds a null byte, just in case)

Also, I'm trying to remember -- if you compile as an app, can you rewrite program memory like Str1 or Pic02?

Edit:
Changed 'Zero(pointer,size)' to 'Zero(size)->pointer'
« Last Edit: August 24, 2011, 12:24:56 pm by Michael_Lee »
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: string - duplicate symbol
« Reply #6 on: August 24, 2011, 12:02:53 pm »
Also, I'm trying to remember -- if you compile as an app, can you rewrite program memory like Str1 or Pic02?
Nope, but you can always use safe RAM like L1.




Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: string - duplicate symbol
« Reply #7 on: August 24, 2011, 12:07:13 pm »
I'm not sure why everyone has been using Zeros(pointer,size) in their code. This is not valid syntax. Zeros() only takes a single argument, and that is size. You want to use Zeros(size)→pointer instead.

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: string - duplicate symbol
« Reply #8 on: August 24, 2011, 12:23:56 pm »
I'm not sure why everyone has been using Zeros(pointer,size) in their code. This is not valid syntax. Zeros() only takes a single argument, and that is size. You want to use Zeros(size)→pointer instead.

Erm, I was copying Deep Thought who (I suspect) was copying Qwerty.

>.>

*Michael hides
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline yrinfish

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 138
  • Rating: +8/-0
  • Zark, I'm not dead
    • View Profile
    • yrinthings
Re: string - duplicate symbol
« Reply #9 on: August 24, 2011, 01:44:31 pm »
Two things, first @DT:
Code: [Select]
:'a'→{Str1}
:'b'→{Str1}
:'c'→{Str1}
to put "abc" in a Str1 that already exists.

That should be:
Code: [Select]
:'a'→{Str1}
:'b'→{Str1+1}
:'c'→{Str1+2}

otherwise the first char would be overwritten with a, then b and finally c...

second, to add only one, do this:
Code: [Select]
:'a'→{Str1+<offset>}
I need help with Random (x86 Happy), pm me if you want to help :D
LOOK IN MY SPOILER, MY SIG IS UPDATED (almost) EVERY DAY
Spoiler For MiniTale:
No mini competition please, teamwork is better :D
I suggest we do not use "MiniCraft" as the name:
Notch has asked us to not do that.
It will get changed to "MiniTale"
@Hayleia, you don't _have to_ organize :P
THIS POST IS IN MY SIG TOO

Details
Language: Axe
Platform: TI 83+

Things we'll need to do/make
Draw the sprites saintrunner is working on this
A save file format.
A level generator.
A Tilemapper.
Some sort of AI.
Crafting system.

People on it (AFAIK)
annoyingcalc
saintrunner
Hayleia (your avatar is really cool btw)
epic7
Blue Raven
yrinfish

Useful info
For those who are going to work on this
General Program Structure
Spoiler For Spoiler:

:.Sprite Data
:.Other Data
:
:.Main menu
:.Option Start Game->init
:.Option How To Play->help
:.Option About->crdt
:
:.BEGIN init
:.Save file is present?
:.yes->strt
:.no->lgen
:.END init
:
:.BEGIN lgen
:.Make appvar appvMCSAVE
:.create 7 levels
:.edit for sky, mines, deep mines, nether
:.END lgen
:
:.BEGIN strt

~~~~ working on this ~~~~

Tiles
Spoiler For Spoiler:
Wheat
Water
Tree
Stone
Stairs
Sapling
Sand
Rock
Ore
Lava
InfiniteFall
Hole
HardRock
Grass
Flower
Farm
Dirt
Cloud
CloudCactus
Cactus

Biomes
Spoiler For Spoiler:
--Sky
Cloud
--Surface
Forest
Meadow
Plains
Cliffs
Mountain
Desert
Ocean
--Underground
Mines
Deep Mines
Nether

Items
Spoiler For Spoiler:
--Tools
Pick
Axe
Hoe
Shovel
--Weapon
Sword
--Utilities
Pow Glove
Workbench
Furnace
Lantern
Anvil
Oven
Chest
--Resources
Apple
Bread
Cloth
Slime
Wood
Seeds
Wheat
Acorn
Cactus
Flower
Cloud
Dirt
Stone
Sand
Coal
Iron Ore
Gold Ore
Gem
Glass
Iron
Gold
Spoiler For More...:
Spoiler For About me:

No, I didn't lie!!


quotes:HERE

And even more:


[07:53:14] <+Frey> Y'know, when people descend from my heavens , they're never Chuck Norris
[07:53:55] <+Frey> I usually get another catgirl or an angel pops down for a visit
[07:54:06] <+Frey> Some angels are really nice
[07:54:33] <+Frey> Some are into the whole "scare the locals" bit
[07:54:54] <+Frey> And some just absent minded
[07:55:38] * +david_ has nothing to do
[07:55:40] <+Frey> It's the absentminded ones you gotta look out for, because the'yre the ones that forget they're 40ft tall
[07:56:04] <+Frey> They're also the ones that forget about social taboos, like nudity
[07:56:28] <+Frey> Have you ever tryed to explain to an angel...anything?
[07:56:45] <+Frey> They don't listenunless they want to
[07:57:16] <+Frey> And don't learn unless they think they don't know
[07:57:51] <+Frey> Except for the nice ones, they're nice
[07:59:27] <+OmnomIRC> (O)<yrinfish> lol
[07:59:32] <+Frey> And they're all so pretty!
[07:59:38] <+Frey> It's ridiculous
[07:59:44] <+OmnomIRC> (O)<yrinfish> I hate PUSHES, THEY HAUNT ME
[08:00:06] <+Frey> Want an angel to come over and exorcise them?
[08:00:36] <+OmnomIRC> (O)<yrinfish> or, more specific: the fact that sometimes, happy outputs: pushes != pops
[08:00:47] <+OmnomIRC> (O)<yrinfish> I know why
[08:01:01] <+OmnomIRC> (O)<yrinfish> and I can solve it by adding a lookahead
[08:01:10] <+OmnomIRC> (O)<yrinfish> But I don't want to
[08:01:24] <+OmnomIRC> (O)<yrinfish> but continue your story
[08:01:35] <+OmnomIRC> (O)<yrinfish> lol
[08:03:13] <+Frey> Ok, so one day, I was walking to the school bus, and, long story short, got my life saved by an angel
[08:03:27] <+Frey> This one was a scary one
[08:03:42] <+Frey> Same height/age as me
[08:04:14] <+Frey> OMG She was the scariest person I had ever met
[08:04:28] <+Frey> She made the entire football team pee their pants
[08:04:43] <+Frey> I was so glad she was on my side
[08:05:04] <+Frey> Right up until she tryed to enter the bathroom with me
[08:05:37] <+OmnomIRC> (O)<yrinfish> lool
[08:05:45] <+Frey> After a muchness of arguing, I finally got through to her
[08:05:56] <+Patrick-D> is this a rap song?
[08:06:06] <+OmnomIRC> (O)<aeTIos> idk
[08:06:09] <+Frey> She tap danced outside my stall the entire time, though
[08:10:04] <+Frey> She was in all my classes too, which was weird, especially as they were all advanced courses and she joined in the middle of the semester
[08:10:28] <+Frey> Even the teachers were scared of her
[08:10:45] <+Frey> Note that she was gorgeous
[08:12:09] <+Frey> So, this angel and I, we managed to stop the apocalypse
[08:12:48] <+Frey> And she kissed me before going back,
[08:13:08] <+Frey> To heaven, but as it turns out that kiss sealed her to Earth
[08:13:47] <+Frey> We still don't know what to do


lol:

[11:30:53] <DThought> <OmnomIRC> (O)<yrinfish> 2 guests are looking at my topic
[11:30:53] <DThought> <OmnomIRC> (O)<yrinfish> I wonder who they are
[11:30:53] <DThought> <OmnomIRC> (O)<yrinfish> where they live
[11:30:53] <DThought> <OmnomIRC> (O)<yrinfish> how old they are
[11:30:55] <DThought> <OmnomIRC> (O)<yrinfish> What kind of jokes they make
[11:30:57] <DThought> <OmnomIRC> (O)<yrinfish> but it surprises me that theyre looking at my topic
[11:31:01] * DThought smacks yrinfish for stalking
[11:31:08] <yrinfish> lool
[11:31:14] <DThought> Whoa, why'd it include all the newlines?
[11:31:23] * calc84maniac  smacks DThought for talking
[11:31:28] * calc84maniac  runs

Crisps:

<OmnomIRC> (O)* Keoni29  Eating crisps
<OmnomIRC> (O)* yrinfish  asks keoni some
<OmnomIRC> (O)<Keoni29> 7$ shipping please
<OmnomIRC> (O)* yrinfish  gives
<OmnomIRC> (O)<Keoni29> It will arrive in 3 days
<OmnomIRC> (O)<yrinfish> Thank you
<OmnomIRC> (O)* Keoni29  Wonders if he wants some dip
<OmnomIRC> (O)<yrinfish> chili please
<OmnomIRC> (O)<Qwerty.55> Adobe, last time I updated one of your products, the changes broke half of the documents using it.
<OmnomIRC> (O)<Keoni29> :(
<OmnomIRC> (O)<Qwerty.55> Why the hell would I update anything else from you?
<OmnomIRC> (O)* yrinfish  kicks adobe
<OmnomIRC> (O)* yrinfish  runs
<OmnomIRC> (O)* Qwerty.55  runs with him
<OmnomIRC> (O)<Keoni29> I have guacamole :S
<OmnomIRC> (O)<Keoni29> I have guacamole :S
<OmnomIRC> (O)* yrinfish  likes that too
<OmnomIRC> (O)* Keoni29  yay
<OmnomIRC> (O)* yrinfish
<OmnomIRC> (O)<Keoni29> http://www.tinyurl.com/guacamole.jar
<OmnomIRC> (O)<Keoni29> :3
<OmnomIRC> (O)<yrinfish> 404
<OmnomIRC> (O)<yrinfish> no foooooooooooooooooooooooouwaaaaaaaaaaaaaaaaahnd
<OmnomIRC> (O)<Keoni29> <3 no shit
<OmnomIRC> (O)<Keoni29> You cant download jars of guacamole
<OmnomIRC> (O)<Keoni29> I have an idea!
<OmnomIRC> (O)<yrinfish> loool
<yrinfish> that came too late ;)
<OmnomIRC> (O)<Qwerty.55> Actually, I just realized why Adobe's update breaks everything.
<yrinfish> tell me
<yrinfish> again too late
<OmnomIRC> (O)<Keoni29> Buy yourself some :3
<yrinfish> that was to keoni
<yrinfish> lOLoL
<yrinfish> :D
<OmnomIRC> (O)<Qwerty.55> It's a security update and if you can't run anything, you obviously can't get infected by anything in those documents.
<OmnomIRC> (O)<Keoni29> Then I pay one dip
<OmnomIRC> (O)<Keoni29> Do you have paypal?
<OmnomIRC> (O)<Keoni29> :S
<OmnomIRC> (O)<yrinfish> nope
<OmnomIRC> (O)<yrinfish> lol
<OmnomIRC> (O)<yrinfish> hm, I could get some crisps
<OmnomIRC> (O)<yrinfish> it is too late to do that here
<OmnomIRC> (O)<yrinfish> main europe
* jkag ([email protected]) has joined #omnimaga
* Netbot45 gives voice to jkag
<OmnomIRC> (O)<yrinfish> MUSIC YAY
<OmnomIRC> (O)<Keoni29> Well the shops are closed here too
<OmnomIRC> (O)<Keoni29> 21:45
<OmnomIRC> (O)<yrinfish> where?
<OmnomIRC> (O)<Keoni29> Gwt+0
<OmnomIRC> (O)<Keoni29> The netherlands
<OmnomIRC> (O)<yrinfish> huh? loool
<OmnomIRC> (O)<yrinfish> hallo keoni, hoe gaat het? continue in english please
<OmnomIRC> (O)<Keoni29> :S
<OmnomIRC> (O)<yrinfish> really stupid dutch sentence^

Languages:
1308401677 <yrinfish> I'm dutch
1308401679 <yrinfish> lol
1308401687 <p2> Oh.
1308401702 <yrinfish> So I need to learn german
1308401705 <yrinfish> and french
1308401712 <yrinfish> and English
1308401717 <yrinfish> and Dutch
1308401724 <yrinfish> and Greek
1308401728 <yrinfish> and Latin
1308401739 <p2> I must learn french and English.
1308401739 <yrinfish> and Spanish
1308401749 <Spyro543> Y=sin(x+yrinfish)*>9000
NOTE: these are all the languages I have chosen to learn!
Spoiler For Info:

Spoiler For Projects:
Happy    [.---------] A C-like programming language for the z80 in js. REWRITING THE WHOLE THING, GOOD IDEAS NEEDED
DionJump [======----] Paused, but there is an update
Corona   [----------] Not enough time... If you need inspiration?
LGETC    [======----] getchar() LUT, useful and not too big. Waits for keyboard input and returns ASCII char

Spoiler For yrinthings tools:
stringLength Get the length in pixels of a small-font string.
safeText Html-ify a piece of text.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: string - duplicate symbol
« Reply #10 on: August 24, 2011, 01:53:04 pm »
I'm not sure why everyone has been using Zeros(pointer,size) in their code. This is not valid syntax. Zeros() only takes a single argument, and that is size. You want to use Zeros(size)→pointer instead.
* Qwerty.55 is launching a covert campaign to get Quigibo to change the syntax...
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: string - duplicate symbol
« Reply #11 on: August 24, 2011, 03:23:26 pm »
I'm not sure why everyone has been using Zeros(pointer,size) in their code. This is not valid syntax. Zeros() only takes a single argument, and that is size. You want to use Zeros(size)→pointer instead.
Copied from Qwerty. Wasn't thinking.
That should be:
Code: [Select]
:'a'→{Str1}
:'b'→{Str1+1}
:'c'→{Str1+2}
Again, wasn't thinking x.x




Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: string - duplicate symbol
« Reply #12 on: August 25, 2011, 08:55:29 am »
so that should be possible: ???
Code: [Select]
:{Str1+X}→{Str2+(lenth(Str1)+1)}

I've used a String (Str60) for the Free spaces - To delete a string I now use
Code: [Select]
:Copy(Str60,[i]Str2[/i],90) (90 because str60=90 spaces)





this is my newest code:
(You must read it to understand the program - No (english) description in it!!)
Spoiler For code:
:.CHAT
:"                                                                                "→Str60
:det(500)→Str1
:det(500)→Str2
:5→B
:"person:"→Str80
:"p1 = [1]"→Str81
:"p2 = [2]"→Str82
:Output(1,1,Str80
:Output(2,1,Str81
:Output(3,1,Str82
:Repeat B=1
: If getKey(34)
:  1→X
:  1→B
:  Goto 1
: End
: If getKey(26)
:  2→X
:  1→B
: End
:End
:
:
:Lbl 1
:
:
:1→A
:ClrDraw
:DispGraph
:
:
:
:
:
:
:
:
:
:
:
:Repeat getKey(15)
:
:
:
:
:
:
:
:.EMPFANGEN/
:
:Get(→Ans
:If Ans≠(0-1)
: Vertical -
: Vertical -
: Vertical -
: Vertical -
: Vertical -
: Vertical -
: Vertical -
:
:
: Text(0,40,Ans
: If X=1
:  conj(Str60,Str2,90)
: End
: If X=2
:  conj(Str60,Str1,90)
: End
:End
:
:./EMPFANGEN
:
:
:
:
:
:
:.SENDEN/
:
:If getKey(9)
: If X=1
:  Repeat Send(Str1,2000)≠(0-1)
:  End
:  Vertical -
:  Vertical -
:  Vertical -
:  Vertical -
:  Vertical -
:  Vertical -
:  Vertical -
:  Text(0,40,Str1
:  conj(Str60,Str1,90)
: End
: If X=2
:  Repeat Send(Str2,2000)≠(0-1)
:  Vertical -
:  Vertical -
:  Vertical -
:  Vertical -
:  Vertical -
:  Vertical -
:  Vertical -
:  Text(0,40,Str2
:  conj(Str60,Str2,90)
: End
:End
:
:./SENDEN
:
:
:
:
:
:
:.FENSTER/
:
:For(P,0,95
: For(Q,5,63
:  Pxl-Off(P,Q
: End
:End
:If getKey(1)
: Vertical -
:End
:If getKey(2)
: Horizontal +
:End
:If getKey(3)
: Horizontal -
:End
:If getKey(4)
:Vertical +
:End
:If getKey(1)=getKey(2)=getKey(3)=getKey(4)=1
: ClrDraw
: If X=1
:  Text(0,50,Str1
: End
: If X=2
:  Text(0,50,Str2
: End
:End
:If X=1
: Text(0,50,Str1
:End
:If X=2
: Text(0,50,Str2
:End
:
:./FENSTER
:
:
:
:
:
:
:.DEL/
:
:If getKey(56)
: If X=1
:  conj(Str60,Str1,90)
: End
: If X=2
:  conj(Str60,Str2,90)
: End
:End
:
:./DEL
:
:
:
:
:
:
:.MODUS/
:
:If getKey(55)
: A+1→A
: If A=4
:  1→A
: End
:End
:If A=1
: conj("         'WRMH  ?θVQLG  :ZUPKFC  YTOJEB  XSNIDA         ",Str99,56)
:End
:If X=2
: conj("         'wrmh  ?θvqlg  :zupkfc  ytojeb  xsnida         ",Str99,56)
:End
:If X=3
: conj("         +-*/^  ‾369)}  .258(K  0147,       2-1          ",Str99,56)
:End
:
:./MODUS
:
:
:
:
:
:
:.SCHREIBEN/
:
:For(Z,10,56
: If getKey(Z)
:  If X=1
:   conj({Str99+Z},Str1,length(Str1)+1)
:   Text(0,50,Str1
:  End
:  If X=2
:   conj({Str99+Z},Str2,length(Str2)+1)
:   Text(0,50,Str2
:  End
: End
:End
:
:./SCHREIBEN
:
:
:
:
:
:
:.ZEIGE/
:
:If X=1
: Text(0,50,Str1
:End
:If X=2
: Text(0,50,Str2
:End
:./ZEIGE
:
:
:
:
:
:
:
:End
:
:
:
:
:.LEAVE/
:
:If X=1
: conj(60,Str1,90)
: conj("p1 has left TItalk",Str1,18)
: Send(Str1,5000
:End
:If X=2
: conj(Str60,Str2,90)
:  conj("p2 has left TItalk",Str2,18)
: Send(Str2,5000
:End
:
:./LEAVE
« Last Edit: August 25, 2011, 09:36:21 am by p2 »
*insert supercool signature*