Author Topic: Features Wishlist  (Read 615025 times)

0 Members and 2 Guests are viewing this topic.

Offline defmenge

  • LV3 Member (Next: 100)
  • ***
  • Posts: 40
  • Rating: +5/-0
    • View Profile
Re: Features Wishlist
« Reply #2415 on: June 24, 2011, 11:06:22 am »
What are inline if statements?
An inline if statement returns one of two values depending on whether a condition is true or not.
Example (pretending it would be implemented in Axe as IIf(Condition,TrueValue,FalseValue):
Code: [Select]
"True"->Str1
"False"->Str2
Disp IIf(A=B,Str1,Str2)
Spoiler For DROD8x:
Status: Pre-Alpha "ROACHIE" - Progress: 20%
[=====] Graphics: 100% (full greyscale tileset)
[==== ] Tilemapping: 80% (maps load successfully, additional tile data not implemented yet)
[=    ] Storage formats: 20% (planned: segmentable holds, composed of levels, made of up to [presumably] 8x8 rooms)
[==   ] Monsters: 40% (roaches and roach queen AI working; planned: eyes, wubbas, golems and possibly more)
[     ] Gameplay Elements: 0% (walls and floors only)
[     ] GUI: 0% (very bare in-game GUI)
[=    ] Editor: 20% (integrated basic editor)
Project is currently on hold due to lots of homework and tests.

Ashbad

  • Guest
Re: Features Wishlist
« Reply #2416 on: June 24, 2011, 11:22:58 am »
You can technically do Iif statements in axe already:

Code: [Select]
"True"->Str1
"False"->Str2
Disp ((A=B)->C*(°Str1)+(not(C)*(°Str2)))

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Features Wishlist
« Reply #2417 on: June 24, 2011, 11:25:52 am »
Aww, I was writing a big long post about inline if statements but you ninja'd me. :P

But the way you suggested it as a command would be nice. I figure the IS<( token would be perfect for this, as it's currently an unused token easily accessible in the programming menu. It even sort of makes sense without a token replacement if you read it as "is." It would be nice if it had 4 forms, like:

Code: [Select]
.If condition, true, false
iif(A=B,C,D)

.If not(condition), true, false
!iif(A=B,D,C)

.If condition, true
iif(A=B,C)

.If not(condition), true
!iif(A=B,D)

The latter two forms are a bit unconventional, but I could see them being used for optimization purposes. For instance, here is some code I wrote a long time ago. It moves a sprite around the screen according to user key input and draws it, and applies boundaries to the sprite so it does not move offscreen.

As small as I could get it, 345 bytes of executable code. ;)

Code: [Select]
:.SMILE
:[004466000000817E]->Pic1
:DiagnosticOff
:0->X->Y
:Repeat getkey(15)
:ClrDraw
:getKey(3)-getKey(2)+X
:!If +1
:+1
:End
:-1
:Pt-On(min(,88)→X,getKey(1)-getKey(4)+Y+(=⁻1)min(,56)→Y,Pic1)
:DispGraph
:End

The fancy If stuff you see there is an optimized way of making sure the position does not become -1. However, I could only use it for the x coordinate.



EDIT: Ashbad, that would work, yes. But it would be unnecessarily bloated and slow. That would be about 1.5x larger than an inline if statement, and an incredible ~15x slower. It would also require the multiplication routine being added to the program, which may not have previously existed in the program and making the code even larger.
« Last Edit: June 24, 2011, 11:33:17 am by Runer112 »

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: Features Wishlist
« Reply #2418 on: July 01, 2011, 08:40:07 pm »
Would it be possible to do special escape sequences in strings, such as "ABC\→"→Str1 to point STR1 at the string "ABC→". The compiler errors on the "→" currently. The only workaround I've found with this is to write the entire string in hex, which is understandably a bit of a pain for non-ASCII characters.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Features Wishlist
« Reply #2419 on: July 01, 2011, 08:47:50 pm »
I don't think an escape code should be necessary. You could solve this problem without entering the whole string as hex, just enter the one character as hex. In this example, the "" at the end is so Axe knows the data is a string and appends a null terminator. If the hex is in the middle of the string, you don't need to add this null string.

Code: [Select]
"ABC"[1C]""→Str1


EDIT: Also, while looking into this, I discovered that some of Axe's ASCII equates are not correct. and are at least two incorrect ones. All the more reason to use B_CALL(_Get_Tok_Strng) to parse tokens into ASCII.
« Last Edit: July 01, 2011, 08:51:11 pm by Runer112 »

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: Features Wishlist
« Reply #2420 on: July 01, 2011, 08:49:04 pm »
You can add hex in strings?

That makes everything so much easier.
∂²Ψ    -(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: Features Wishlist
« Reply #2421 on: July 03, 2011, 04:30:49 pm »
You can add hex in strings?

Not in strings. Runer's code ends the string, tacks a hex byte on, and tacks a null string after that to add in a [00] character. It would be the same as

Code: (Axe) [Select]
"ABC"[1C00]→Str1
Because it's all inline, the pointer to the first string is what gets assigned to Str1.




Offline defmenge

  • LV3 Member (Next: 100)
  • ***
  • Posts: 40
  • Rating: +5/-0
    • View Profile
Re: Features Wishlist
« Reply #2422 on: July 13, 2011, 09:07:15 am »
Is there any possibility of a nicer syntax for single-byte custom name variables, like "MyVarr" or something similar? Almost every L1+xxx variable I'm currently using is single byte, and just attaching an "r" looks better and makes code less cluttered than {°MyVar}, and would probably be more optimized too (or maybe not, I don't know Axe's inner assembly workings :P).
The reason I can't use 16-bit is that the variables would overlap and collide with each other due to 1-byte offsets and I really need to conserve space by writing numbers

I know 1.0.0 just came out, sorry for bothering with feature requests that early, but custom names don't have that much of a use to me if they can't be made 1-byte easily. :/
Spoiler For DROD8x:
Status: Pre-Alpha "ROACHIE" - Progress: 20%
[=====] Graphics: 100% (full greyscale tileset)
[==== ] Tilemapping: 80% (maps load successfully, additional tile data not implemented yet)
[=    ] Storage formats: 20% (planned: segmentable holds, composed of levels, made of up to [presumably] 8x8 rooms)
[==   ] Monsters: 40% (roaches and roach queen AI working; planned: eyes, wubbas, golems and possibly more)
[     ] Gameplay Elements: 0% (walls and floors only)
[     ] GUI: 0% (very bare in-game GUI)
[=    ] Editor: 20% (integrated basic editor)
Project is currently on hold due to lots of homework and tests.

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Features Wishlist
« Reply #2423 on: July 13, 2011, 09:48:57 am »
It please should support xLib-codes.
They're very useful.
But axe automatically deactivates xLib, Deutsch/German, and every other APPs like them.
That's a little problem for every xLib-user.

And what's about a possibillity to write these special things like @ and all the others (in xLib it's real(13,2,X) X is a value from 1 to 255).
It's not possible to write them in a text. That's annoying, because then you have to drew these funny symbols.
« Last Edit: July 20, 2011, 12:51:21 pm by p2 »
*insert supercool signature*

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Features Wishlist
« Reply #2424 on: July 13, 2011, 10:11:14 am »
you can write this "@" and others, using Output(X,Y,Z►Char) but you have to know the necessary value
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Features Wishlist
« Reply #2425 on: July 13, 2011, 10:15:07 am »
but where is the char-command?
I can't find it.

Are the values the same as in xLib?

BUT:
How can I input such a symbol into a text / save into a string?
« Last Edit: July 13, 2011, 10:17:14 am by p2 »
*insert supercool signature*

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Features Wishlist
« Reply #2426 on: July 13, 2011, 10:18:08 am »
in Math. I don't know the values of  xLib but for Axe, to display a @ it is Output(x,y,64►Char)
« Last Edit: July 13, 2011, 10:29:08 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Features Wishlist
« Reply #2427 on: July 13, 2011, 10:27:21 am »
So it's
"ABC"+64>Char+"DEF"->Str1
Would that be correct?





And what's about supporting xLib-codes?
(I mean real(  -commands)
*insert supercool signature*

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Features Wishlist
« Reply #2428 on: July 13, 2011, 10:45:43 am »
To make the string "123@456", you would do something like the following. 40 is the hexadecimal character code for @.

Code: [Select]
"123"[40]"456"

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Features Wishlist
« Reply #2429 on: July 13, 2011, 10:50:29 am »
Thanx!

Where to find a list of the hexadecimal character codes?
*insert supercool signature*