
-----------------------------------
TheZsterBunny
Fri Mar 19, 2004 9:51 am

Keyboard or mouse
-----------------------------------
I know that there is a tutorial for this in the turing manual, but it didn't really answer my question.

The user must make a selection in this game. They can either enter a number in one window or click in another one. How could I do something like this? (even better if it puts the number in the screen where you could type if you clicked)

On a different note, how are commands different in a text window?

-bunny

-----------------------------------
Delos
Fri Mar 19, 2004 10:40 am


-----------------------------------
So...let me clarify.

You have 2 windows open:
1 is a keyboard operated window, the other is a mouse operated window.

Well, to switch between windows you'd have to have some fany Window. operations going on.
Eg.
Window.Select
Window.SetActive
etc

F10 to find out more.
You'd need IDs for each window:

var win1, win2 : int

so that you can distinguish:

if Window.GetActive = win1 and mouseButton > 0 then
...

As I said, fancy win maneuvers.
It's possibly doable, dual input windows, should be fun.

On the other hand.  Text windows...are you talking about 

setscreen("text")

?

Because if you are, then the commands are the same, just that you cannot use graphics of any sort (i.e. no GUI, no colour/colourback commands, no locates, no Draw commands).

So, text windows are only really useful for the programmer themself, so as to analyse large amounts of output.
Eg.  You make a sorting procedure.  You run it on a 1000-element test list.  You find that all the output scrolls off the window before you can check it.
So you change to text mode, and can scroll around it nicely.
NB: you can do this:
setscreen ("text;max;max")

-----------------------------------
TheZsterBunny
Fri Mar 19, 2004 11:06 am


-----------------------------------
I've been Window.SetActive for a while, and have been having no trouble with it. I only wish to know how i can get either of the inputs

using the word either makes me wonder, can I use OR for this, and how would I.

There are three windows. 

map - the map of the countries
stat - the player and ownership statistics
text - the text output for the game

There are still many bugs and some features have not been implimented yet (save, move troops) 

This is still a beta - I hope to release the finished product by 6 this evening (7 hours from now)

-----------------------------------
TheZsterBunny
Sat Mar 20, 2004 9:15 am


-----------------------------------
So I've been working on this for the last couple of days, and have finally narrowed down what I was looking for

If at anytime during this procedure, the current window becomes inactive, quit.

Sounds easy, but these procedures include get statements and mousewhere.

*sigh*

any help would be appreciated

-----------------------------------
McKenzie
Sat Mar 20, 2004 10:31 am


-----------------------------------
seems that you are making it harder than it has to be, try something like:
function kb_or_mouse : int
    var mx, my, mb : int := 0
    var country : int := 0
    var ch : string (1) := " "
    loop
        if hasch then
            getch (ch)
            if strintok (ch) then
                result strint (ch)
            end if
        end if
        mousewhere (mx, my, mb)
        if mb > 0 then
            result mx % you'll have to fix this
        end if
    end loop
end kb_or_mouse


-----------------------------------
TheZsterBunny
Sat Mar 20, 2004 3:37 pm


-----------------------------------
Thanks Mr.M, but how would getch work for either 1 or 2 digit numbers?

-bunny

-----------------------------------
jonos
Sat Mar 20, 2004 5:24 pm


-----------------------------------
getch can't do two digit numbers unless you did it like:


var ch : string (1)
var sent : string := ""
for i : 1..2
     getch(ch)
     sent := sent + ch
end for


or 


var ch : string (1)
var sent : string := ""
loop
     exit when length(sent) = 2
     getch(ch)
     sent := sent + ch
end loop


those should work , i haven't tested them though.

-----------------------------------
the_short1
Sat Mar 20, 2004 6:22 pm


-----------------------------------
nice nice start... i will be waiting for this game to finish.... i LOVE risk... also... then ppl can play it over MSN and just send each other cords.... ill have u a match...

one thing.... maybe size map down a notch so all windows can fit on  800 x 600 res without being moved

taht would rock...

if you need a good program to size down pictures keeping 100% of original quality,,, use irfanview.. FREE... and under 1MB... Yea... its WICKED

get it from http://www.irfanview.com
or....
get my download manager (search the short 1 to find it)

not meaning to plug here...  this is intended for bunny... but im too lazy to PM



EDIT: Cervantes.... yea... paint sucks tho.. 
its hard to crop acurately (exactly to the pixel) and the resize dont do realy good quality, cervantes... try out irfanview for a week... ull love it..
(if u use it for all it is... (slideshows, resizing, scanning, editing)+more) TRust me... it rocks.. and its under 1MEG!

-----------------------------------
Cervantes
Sat Mar 20, 2004 9:52 pm


-----------------------------------
indeed.  it is going offtopic.  I shall add one piece though:  Paint can resive images too, you just have to be sneaky.  All you do is change the zoom level and then hit print screen, paste it into a new window, select the part that you want, and save it!

now, back to the topic at hand!!  We wait until Bunny has another question :)

-----------------------------------
TheZsterBunny
Sat Mar 20, 2004 11:23 pm


-----------------------------------
*sigh* I wish I'd known sooner

I've hand tooled 4 pictures for this project in paint.

Down to the last pixel (pictures are 786x500)

Function works great, but I am having a strange error with my save/load function.



I/O attempted on unopened stream number -10. Open failed with message 'Access (permission) denied'.


Its my computer, I have admin access, I haven't had any errors before.
What the h3ll is happening?

-------Edited-------

Okay, I figured out what was happening. I can't explain it, but I understand what I did wrong. It couldn't open the file, because there was no file to open. But it didn't return file not found error. Hidden files?

-------Unedited-------

SaveLoad:


proc saveload
    put "Please select an option: "
    put "1. Save Game "
    put "2. Load Game "
    put "3. Return "
    put "Choice: " ..
    get input
    if strintok (input) and (strint (input) = 1 or strint (input) = 2) then
        selection := strint (input)
        file := Window.Open ("position:center;center,text:25;50,nobuttonbar,title: Save/Load Game")
        Window.SetActive (file)
        if selection = 1 then
            put "Enter a name for your save file: " ..
            get input : *
            open : dataget, "data/save/" + input + ".rsv", put
            put : dataget, maxplrno
            for i : 0 .. 39
                put : dataget, (pwnzr (i) * 100) + harmy (i)
            end for
            put : dataget, plrno
            put : dataget, turn
            close (dataget)
        elsif selection = 2 then
            dataget := Dir.Open ("data/save/")
            counter := 0
            loop
                strget := Dir.Get (dataget)
                exit when strget = ""
                if index (strget, ".rsv") not= 0 then
                    counter += 1
                    put counter, ". ", strget (1 .. (index (strget, ".rsv") - 1))
                end if
            end loop
            Dir.Close (dataget)
            put ""
            put "Which game number do you wish to load: " ..
            get input : *
            if strintok (input) and strint (input) >= 1 and strint (input) 