|
Post by n00b on Oct 8, 2016 11:42:59 GMT -6
The only thing that happens when you use an array as the index of another array is that the array being used as the index gets replaced by its number value and then the outer array gets replaced by its value. So the arrays are just another way to represent its value.
|
|
|
Post by eyfenna on Oct 9, 2016 9:53:01 GMT -6
I wrote down following code:
loadimage(0, "Spaceship5.png") setImageAlpha(0,100) windowopen(0,"drawImage test",windowpos_centered,windowPos_centered,800,600,0) canvasopen(0,800,600,0,0,800,600,0)
while true ImageExists(0) clearcanvas() drawImage(0,100,0) update()
if key(k_escape) then end end if wend
I have a image with this name stored in the same folder and get following error: image slot is empty, every other code that applies this loadImage(0,"Spaceship5.png") works. I sort of feel misunderstood.
Okay found out that:
windowopen(0,"drawImage test",windowpos_centered,windowPos_centered,800,600,0) canvasopen(0,800,600,0,0,800,600,0)
loadimage (0, "Spaceship5.png") setImageAlpha(0,100)
while true ImageExists(0) clearcanvas() drawImage(0,100,0) update()
if key(k_escape) then end end if wend
works excatly like I want it to. GOing to keep in mind to first open a window and a canvas before loading images.
|
|
|
Post by n00b on Oct 9, 2016 23:14:00 GMT -6
I will update this in the docs when I get a chance. Explaining why you have to have a window open would involve explaining SDL2 completely. Its not complicated, but it is a long explanation.
|
|
|
Post by eyfenna on Oct 15, 2016 7:26:39 GMT -6
I'm trying to create a state handler and giving it following code
sub statehandler(byref game_events$,offsetX,offsetY) update() if game_events$ = "nonp_round" then movement_ai(offsetX, offsetY, game_events$) elseif game_events$ = "player_round" then if mb1 then playership_marking() end if gui(game_events$) end if end sub Result is that I get following error
illegal operation: PROGRAM.STATEHANDLER.GAME_EVENTS$, s0 could not evaluate ID Error on line: if game_events$ = "nonp_round" then
only with strings.
edit One wish for a new command in RCBASIC:
bool arrayexist(arrayname)
|
|
|
Post by n00b on Oct 15, 2016 12:14:14 GMT -6
This is a bug. I don't actually know where it could be happening so it might take a few days to fix.
|
|
|
Post by eyfenna on Oct 16, 2016 10:35:59 GMT -6
Wrote down a short program that applies the sub decider(byref string$) code and also get's this error:
sub decider(byref decision$) if decision$ = "text" then fprint("Hello world!\n") elseif decision$ = "numbers" then fprint(123456 + "\n") else fprint("Not a decision\n") end if decision$ = "None" end sub
string$ = "None"
while true string$ = input$("write down text or numbers") decider(string$) if key(k_escape) then end end if wend
One workaround is to declare a string variable within the sub/function scope and set it's value to that of the string variable in the sub/function declaration:
sub decider(byref decision1$) decision$ = "none" decision$ = decision1$ if decision$ = "text" then fprint("Hello world!\n") elseif decision$ = "numbers" then fprint(123456 + "\n") else fprint("Not a decision\n") end if decision$ = "None" end sub
string$ = "None"
while true string$ = input$("write down text or numbers") decider(string$) if key(k_escape) then end end if wend
|
|
|
Post by eyfenna on Oct 18, 2016 11:35:41 GMT -6
Something that is slightly unnerving is:
a = 2 b = -a fprint (b) won't accept -a as -2 and hands out following error:
Compiling RCBASIC Program
1 code_line:: a = 2 2 code_line:: 3 code_line:: b = -a expected number
return error Error on line: b = -a Compiler stopped at line 3
However:
a = 2 b = 0 b = b-a fprint (b) works and
a = 2 b = -1*a fprint (b)
is a workaround.
|
|
|
Post by aurel on Nov 27, 2021 8:40:24 GMT -6
spaaaaam
|
|
|
Post by johnno56 on Nov 27, 2021 18:35:47 GMT -6
Aurel,
You may be right. I am not sure that I have the necessary privileges to remove those posts, But, I suppose if we ask Admin nicely, he may be able to take care of them... If the "poster" had an account, then I could do something, but he logged in as a "guest".
Maybe a bit controversial, but allowing 'only' members to post maybe the way to go, and all others would be "read only", except for emailing Admin to answer "Basic" related questions or clicking a link asking to register... Just a thought...
J
|
|
|
Post by n00b on Nov 27, 2021 19:11:53 GMT -6
johnno56 You should have the ability to delete any post but I went on head and deleted it myself.
|
|
|
Post by johnno56 on Nov 27, 2021 21:15:00 GMT -6
Cool... "Post Options" revealed the secret... Moo Ha Ha....
|
|