Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
20 May, 2013, 06:35:25 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1]   Go Down
  Print  
Author Topic: Odd Text Issues - Text seems to arbitrarily display weirdly after running other code.  (Read 551 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Blue72
LV2 Member (Next: 40)
**
Offline Offline

Gender: Male
Last Login: 25 May, 2012, 00:34:13
Date Registered: 18 September, 2011, 15:56:14
Posts: 20

Topic starter
Total Post Ratings: +3

View Profile
« on: 12 May, 2012, 03:58:52 »
0

So I've been puzzling over a strange issues with strings and text lately, where all my efforts to print information to the home and graph screens resulted in a bunch of gobbledy-gook (long amounts of +'s, n's, and 0's). After thinking I was coding something wrong I eventually tried doing the same thing before all of the other code, resulting in perfect text. Just wondering if anyone could shed some light on this? (I'm using TokenIDE so DeltaList = Data)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
.MATRIX

Fix 5

//Initial try, works fine
Text(10,10,"FFFFF")

Repeat getKey(15)
DispGraph
End

DeltaList(0->GDB1

For(Y,0,7)
For(X,0,7)
1->{Y*8+X+GDB1}
End
End

"!"->Str1

For(P,0,15)
({4*P+GDB1}*8)+({4*P+1+GDB1}*4)+({4*P+2+GDB1}*2)+{4*P+3+GDB1}->N
"F"->{Str1+P}
End

//Second try, plus trying to figure out if I used the string right
Text(10,10,"FFFFF")
Text(10,20,Str1)

Repeat getKey(15)
DispGraph
End

Fix 4
Logged
Builderboy
Physics Guru
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: Today at 02:13:35
Date Registered: 20 April, 2009, 00:28:53
Location: Ravenholm
Posts: 5642


Total Post Ratings: +589

View Profile
« Reply #1 on: 12 May, 2012, 05:14:46 »
+1


1
2
3
4
5
6
7
DeltaList(0->GDB1

For(Y,0,7)
For(X,0,7)
1->{Y*8+X+GDB1}
End
End

It looks like you define a single byte of data for GDB1 when you use the Data(0) command, but then you write to 64 bytes of data when you are in the For() loop.  This is likely corrupting several parts of your program, including the Text you are wanting to display.
Logged

Blue72
LV2 Member (Next: 40)
**
Offline Offline

Gender: Male
Last Login: 25 May, 2012, 00:34:13
Date Registered: 18 September, 2011, 15:56:14
Posts: 20

Topic starter
Total Post Ratings: +3

View Profile
« Reply #2 on: 12 May, 2012, 05:23:17 »
0

Any way to initialize all 64 bytes without listing them individually using Data( ?
Logged
Builderboy
Physics Guru
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: Today at 02:13:35
Date Registered: 20 April, 2009, 00:28:53
Location: Ravenholm
Posts: 5642


Total Post Ratings: +589

View Profile
« Reply #3 on: 12 May, 2012, 05:31:10 »
+1

You can use the Zeros(#) command, which creates # empty bytes of data.  Also, "F"->{Address} doesn't work, as "F" returns the *address* of a string, not the string itself.  What you probably want is 'F'->{Address}, as 'F' returns the byte that represents the referenced character.
Logged

Blue72
LV2 Member (Next: 40)
**
Offline Offline

Gender: Male
Last Login: 25 May, 2012, 00:34:13
Date Registered: 18 September, 2011, 15:56:14
Posts: 20

Topic starter
Total Post Ratings: +3

View Profile
« Reply #4 on: 12 May, 2012, 15:53:44 »
0

I can't find any mention of a Zeros( command, so for now I'm just sticking with Data(, but correctly initializing does seem to have fixed the problem.

On another note, is there any good way to convert a number to a character? Like 1 to '1'?

EDIT:

Also, I seem to be having a weird issue where text I print before or after printing a string prints both at the given coordinates and at the end of the string. (Picture attached)


1
2
Text(2,20,Str1)
Text(2,40,"HELLO!")


* AxeString.png (1.45 KB, 191x127 - viewed 113 times.)
« Last Edit: 12 May, 2012, 16:08:01 by Blue72 » Logged
Builderboy
Physics Guru
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: Today at 02:13:35
Date Registered: 20 April, 2009, 00:28:53
Location: Ravenholm
Posts: 5642


Total Post Ratings: +589

View Profile
« Reply #5 on: 12 May, 2012, 18:32:24 »
+1

It looks like you have the same issue initializing the Str1 variable?  Maybe it would help if I knew what it is you are trying to do?  And ah, I see the name of the command has been changed from Zeros() to Buff(), check it out in the commands list.
Logged

Blue72
LV2 Member (Next: 40)
**
Offline Offline

Gender: Male
Last Login: 25 May, 2012, 00:34:13
Date Registered: 18 September, 2011, 15:56:14
Posts: 20

Topic starter
Total Post Ratings: +3

View Profile
« Reply #6 on: 12 May, 2012, 22:55:53 »
0

I ended up using Data( for it, like this:


1
DeltaList('0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'->Str1

Is that the wrong way to manage strings? I'm still a little confused over whether strings are actually handled any differently than raw data in Axe.
Logged
Runer112
Anti-Riot Squad
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 05:58:57
Date Registered: 02 July, 2009, 06:38:05
Posts: 1679


Total Post Ratings: +492

View Profile
« Reply #7 on: 12 May, 2012, 23:22:19 »
+1

Everything in Axe is just raw data. Smiley You could draw a list of numbers as a sprite, you could read a string as a list of numbers, you could print sprite data as a string. None of those would have any meaningful output, but I'm just trying to get the idea across that, to Axe, data is just data.

One implication of this is that the Buff(#) command, which is probably det(#) in an environment like TokenIDE without the custom Axe tokens, can be used to allocate data for any purpose. For GDB1, it looks like you want it to hold 64 bytes of data. So you would initialize it like this:

det(64)→GDB1

To initialize a string that holds 16 characters, however, you need to allocate an extra 17th byte. This is because strings need a terminating null character to mark the end of the string. This is why you saw the behavior of printing Str1 resulting in both the 16 numbers and "HELLO!" because Str1 didn't have a terminating null character, so the print method printed the next string in memory as well. Defining a string like "STRING" automatically adds the terminating null character, which is why the printing stops after "HELLO!". Anyways, to initialize a string that holds 16 characters, you would do this:

det(17)→Str1


Hopefully this will help with the issues you've been experiencing!
« Last Edit: 13 May, 2012, 06:42:20 by Runer112 » Logged
Blue72
LV2 Member (Next: 40)
**
Offline Offline

Gender: Male
Last Login: 25 May, 2012, 00:34:13
Date Registered: 18 September, 2011, 15:56:14
Posts: 20

Topic starter
Total Post Ratings: +3

View Profile
« Reply #8 on: 12 May, 2012, 23:27:17 »
0

Thanks, knowing that really helps, and nice explanation too! I would give both of you positive post ratings, but either I don't know how or it won't let me because I have too few posts.
Logged
Hayleia
Programming Absol
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Last Login: Yesterday at 19:28:05
Date Registered: 01 June, 2011, 20:12:47
Location: ud-ud ?
Posts: 2043


Total Post Ratings: +254

View Profile
« Reply #9 on: 13 May, 2012, 07:32:12 »
0

Thanks, knowing that really helps, and nice explanation too! I would give both of you positive post ratings, but either I don't know how or it won't let me because I have too few posts.
Click on the thumb up () next to the "quote" () button Wink
Logged





Spoiler for what I am according to...:
me: useless
Pokemon Test: an Absol
turiqwalrus: an eggplant
p2: A HUMAN BEING !
Blackpilar and p2: iplantonlyplantwantplanttoplantknowplantifplantyouplantareplantaplantboyplantorplantaplantgirlplant
click here to know where you got your last +1s
Darl181
Vy'o'us pleorsdtu tlh'e gjaemue.
Coder Of Tomorrow
LV12 Extreme Poster (Next: 5000)
*
Online Online

Gender: Male
Last Login: Today at 06:20:10
Date Registered: 10 June, 2010, 00:32:08
Location: {I*9+L₁+1},{I*9+L₁+3}
Posts: 3272


Total Post Ratings: +267

View Profile WWW
« Reply #10 on: 13 May, 2012, 08:32:00 »
0

Thanks, knowing that really helps, and nice explanation too! I would give both of you positive post ratings, but either I don't know how or it won't let me because I have too few posts.
Yeah, you can't vote until you have 20 posts.  Only one away Tongue
Logged




 
Spoiler for Stuff:



OS 2.43  Boot 1.02  Hardware Rev. B

OS 1.04.32

OS 3.1.0.392  Boot1 3.0.99  Boot2 3.10.16
Spoiler for Misc:
Quote
You'll understand / It's not a shame / To be always / Losing the game / Burma-Shave
"Dynamic userbars!"
Omnimaga radio
Interactive Omnimaga radio
Our World of Text
Draw on websites
Then blow them up
In-browser flight simulator
Haxball: MMO soccer/air hockey game
  Draw with sand.  Yay?
The Game
You just lost the game
Zombo.com
light post color is #dfefff
dark post color is #cae4ff
quote box color is #6699ff
transparent color is...transparent 0.o
Spoiler for Forum search alternative (bookmarklet):
https://www.squarefree.com/bookmarklets/search.html
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("No%20selected%20text;%20enter%20search%20term.").replace(/\s\+/g,"%252B");if(q!=null)location="http://www.google.com/search?q="+q.replace(/\s+/g,"+")+"+site:"+location.hostname;void(0);
Blue72
LV2 Member (Next: 40)
**
Offline Offline

Gender: Male
Last Login: 25 May, 2012, 00:34:13
Date Registered: 18 September, 2011, 15:56:14
Posts: 20

Topic starter
Total Post Ratings: +3

View Profile
« Reply #11 on: 14 May, 2012, 00:01:22 »
+3

Yeah, you can't vote until you have 20 posts.  Only one away Tongue

Heh, this reply is definitely not for the sole purpose of attaining 20 posts...
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.249 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.