AccueilAccueil  FAQFAQ  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  Connexion  
Le Deal du moment : -50%
-50% Baskets Nike Air Huarache Runner
Voir le deal
69.99 €

 

 Problème de choix (race et nom)

Aller en bas 
5 participants
AuteurMessage
Maniac206
*Excellent utilisateur*
Maniac206


Messages : 4977
Localisation : Canada

Problème de choix (race et nom) Empty
MessageSujet: Problème de choix (race et nom)   Problème de choix (race et nom) EmptyDim 6 Mai 2007 - 23:41

Salut!
J'aimerais vous soumettre des problèmes tout con.
1.Voila j'aimerais que dans un text box, on ait le choix entre plusieur race (ex: Humain, Orc, Elfe) et quil soit stocker dans un txt externe pour pouvoir relire plus tard!
2. J'aimerais aussi qu'on puisse choisir son nom pour ensuite le stocker lui aussi dans le txt et le relire!

Votre aide serais très aprécier Hat
Revenir en haut Aller en bas
Super-Mouton
*Excellent utilisateur*
Super-Mouton


Messages : 4916
Localisation : Cyberworld
Projet Actuel : Sad

Problème de choix (race et nom) Empty
MessageSujet: Re: Problème de choix (race et nom)   Problème de choix (race et nom) EmptyDim 6 Mai 2007 - 23:52

Citation :
Files
It is useful to use external files in games. For example, you could make a file that describes at what moments certain things should happen. Also you probably want to save information for the next time the game is run (for example, the current room). The following functions exist to read and write data in text files:

file_text_open_read(fname) Opens the file with the indicated name for reading. The function returns the id of the file that must be used in the other functions. You can open multiple files at the same time (32 max). Don't forget to close them once you are finished with them.
file_text_open_write(fname) Opens the indicated file for writing, creating it if it does not exist. The function returns the id of the file that must be used in the other functions.
file_text_open_append(fname) Opens the indicated file for appending data at the end, creating it if it does not exist. The function returns the id of the file that must be used in the other functions.
file_text_close(fileid) Closes the file with the given file id.
file_text_write_string(fileid,str) Writes the string to the file with the given file id.
file_text_write_real(fileid,x) Write the real value to the file with the given file id.
file_text_writeln(fileid) Write a newline character to the file.
file_text_read_string(fileid) Reads a string from the file with the given file id and returns this string. A string ends at the end of line.
file_text_read_real(fileid) Reads a real value from the file and returns this value.
file_text_readln(fileid) Skips the rest of the line in the file and starts at the start of the next line.
file_text_eof(fileid) Returns whether we reached the end of the file.

To manipulate files in the file system you can use the following functions:


file_exists(fname) Returns whether the file with the given name exists (true) or not (false).
file_delete(fname) Deletes the file with the given name.
file_rename(oldname,newname) Renames the file with name oldname into newname.
file_copy(fname,newname) Copies the file fname to the newname.
directory_exists(dname) Returns whether the indicated directory does exist.
directory_create(dname) Creates a directory with the given name (including the path towards it) if it does not exist.
file_find_first(mask,attr) Returns the name of the first file that satisfies the mask and the attributes. If no such file exists, the empty string is returned. The mask can contain a path and can contain wildchars, for example 'C:\temp\*.doc'. The attributes give the additional files you want to see. (So the normal files are always returned when they satisfy the mask.) You can add up the following constants to see the type of files you want:

fa_readonly read-only files
fa_hidden hidden files
fa_sysfile system files
fa_volumeid volume-id files
fa_directory directories
fa_archive archived files

file_find_next() Returns the name of the next file that satisfies the previously given mask and the attributes. If no such file exists, the empty string is returned.
file_find_close() Must be called after handling all files to free memory.
file_attributes(fname,attr) Returns whether the file has all the attributes given in attr. Use a combination of the constants indicated above.

The following functions can be used to change file names. Note that these functions do not work on the actual files they only deal with the strings.


filename_name(fname) Returns the name part of the indicated file name, with the extension but without the path.
filename_path(fname) Returns the path part of the indicated file name, including the final backslash.
filename_dir(fname) Returns the directory part of the indicated file name, which normally is the same as the path except for the final backslash.
filename_drive(fname) Returns the drive information of the filename.
filename_ext(fname) Returns the extension part of the indicated file name, including the leading dot.
filename_change_ext(fname,newext) Returns the indicated file name, with the extension (including the dot) changed to the new extension. By using an empty string as the new extension you can remove the extension.

In rare situations you might need to read data from binary files. The following low-level routines exist for this:


file_bin_open(fname,mod) Opens the file with the indicated name. The mode indicates what can be done with the file: 0 = reading, 1 = writing, 2 = both reading and writing). The function returns the id of the file that must be used in the other functions. You can open multiple files at the same time (32 max). Don't forget to close them once you are finished with them.
file_bin_rewrite(fileid) Rewrites the file with the given file id, that is, clears it and starts writing at the start.
file_bin_close(fileid) Closes the file with the given file id.
file_bin_size(fileid) Returns the size (in bytes) of the file with the given file id.
file_bin_position(fileid) Returns the current position (in bytes; 0 is the first position) of the file with the given file id.
file_bin_seek(fileid,pos) Moves the current position of the file to the indicated position. To append to a file move the position to the size of the file before writing.
file_bin_write_byte(fileid,byte) Writes a byte of data to the file with the given file id.
file_bin_read_byte(fileid) Reads a byte of data from the file and returns this.

If the player has checked secure mode in his preferences, for a number of these routines, you are not allowed to specify a path, and only files in the application folder can e.g. be written.

The following three read-only variables can be useful:


game_id* Unique identifier for the game. You can use this if you need a unique file name.
working_directory* Working directory for the game. (Not including the final backslash.)
temp_directory* Temporary directory created for the game. You can store temporary files here. They will be removed at the end of the game.
In certain situations you might want to give players the possibility of providing command line arguments to the game they are running (for example to create cheats or special modes). To get these arguments you can use the following two routines.


parameter_count() Returns the number of command-line parameters (note that the name of the program itself is one of them.
parameter_string(n) Returns command-line parameters n. The first parameter has index 0. This is the name of the program.

You can read the value of environment variables using the following function:


environment_get_variable(name) Returns the value (a string) of the environment variable with the given name.
cherchant "text" sur l'aide.

_________________
Hey là tabarnak lâche ma sig sacha >=|
Problème de choix (race et nom) Balrogko6
Problème de choix (race et nom) Supermouton
Revenir en haut Aller en bas
Maniac206
*Excellent utilisateur*
Maniac206


Messages : 4977
Localisation : Canada

Problème de choix (race et nom) Empty
MessageSujet: Re: Problème de choix (race et nom)   Problème de choix (race et nom) EmptyDim 6 Mai 2007 - 23:53

Super-Mouton a écrit:
cherchant "text" sur l'aide.
Ok mais mon vrai prob, c'est de savoir comment faire une text box a trois choix Oo
Revenir en haut Aller en bas
Invité
Invité




Problème de choix (race et nom) Empty
MessageSujet: Re: Problème de choix (race et nom)   Problème de choix (race et nom) EmptyLun 7 Mai 2007 - 0:14

ba personnellement je te conseil de stocker tes données dans un INI
c'est plus simple et plus efficasse super

DATA.ini a écrit:
[Perso01]
nom=bernar lecékse
race=orc blanc
puissance=800
santé=751
xp=11
Revenir en haut Aller en bas
Super-Mouton
*Excellent utilisateur*
Super-Mouton


Messages : 4916
Localisation : Cyberworld
Projet Actuel : Sad

Problème de choix (race et nom) Empty
MessageSujet: Re: Problème de choix (race et nom)   Problème de choix (race et nom) EmptyLun 7 Mai 2007 - 0:18

Ouais mais Ini c'est avec les trucs que j'ai posté en haut non?
Et ben je pensais que ton prob c'était le texte, désolé lol

_________________
Hey là tabarnak lâche ma sig sacha >=|
Problème de choix (race et nom) Balrogko6
Problème de choix (race et nom) Supermouton
Revenir en haut Aller en bas
Invité
Invité




Problème de choix (race et nom) Empty
MessageSujet: Re: Problème de choix (race et nom)   Problème de choix (race et nom) EmptyLun 7 Mai 2007 - 0:19

lol super-mouton tu crois que je vé me casser le c** a lire 4635645lignes de texte rire
Revenir en haut Aller en bas
Adamo
Utilisateur confirmé: Rang ***
Adamo


Messages : 681
Localisation : Quebec

Problème de choix (race et nom) Empty
MessageSujet: Re: Problème de choix (race et nom)   Problème de choix (race et nom) EmptyLun 7 Mai 2007 - 0:46

Revenir en haut Aller en bas
Maniac206
*Excellent utilisateur*
Maniac206


Messages : 4977
Localisation : Canada

Problème de choix (race et nom) Empty
MessageSujet: Re: Problème de choix (race et nom)   Problème de choix (race et nom) EmptyLun 7 Mai 2007 - 1:54

Revenir en haut Aller en bas
Maniac206
*Excellent utilisateur*
Maniac206


Messages : 4977
Localisation : Canada

Problème de choix (race et nom) Empty
MessageSujet: Re: Problème de choix (race et nom)   Problème de choix (race et nom) EmptyMar 22 Mai 2007 - 23:10

Maintenant mon prob se situe au niveau du texte :
Code:
draw_set_font(Size20)
draw_text(128,80,"Haaaw,ma tete...")
draw_set_font(Size15)
if keyboard_check(vk_right) draw_text(128,112,"Garde : Vous n'aviez qu'a ne pas vous ramassez ici.")
Quand le deuxième apparaît quand je clic sur vk_right il me l'affiche et quand je le relache il disparaît triste
Revenir en haut Aller en bas
Pepsy
Utilisateur confirmé: Rang ***
Pepsy


Messages : 608
Localisation : Devant mon ordinateur à écrire des lignes de codes
Projet Actuel : RPG

Problème de choix (race et nom) Empty
MessageSujet: Re: Problème de choix (race et nom)   Problème de choix (race et nom) EmptyMar 22 Mai 2007 - 23:20

je pense qu'il faut mettre

Code:
draw_set_font(Size20)
draw_text(128,80,"Haaaw,ma tete...")
draw_set_font(Size15)
if keyboard_check_pressed(vk_right) draw_text(128,112,"Garde : Vous n'aviez qu'a ne pas vous ramassez ici.")
Revenir en haut Aller en bas
http://creation-pepsy.ifrance.com
Maniac206
*Excellent utilisateur*
Maniac206


Messages : 4977
Localisation : Canada

Problème de choix (race et nom) Empty
MessageSujet: Re: Problème de choix (race et nom)   Problème de choix (race et nom) EmptyMar 22 Mai 2007 - 23:21

non ça me fait la même chose : (
se pourrait-il que mon problème ce fait car je suis dans l'event draw?
Revenir en haut Aller en bas
Pepsy
Utilisateur confirmé: Rang ***
Pepsy


Messages : 608
Localisation : Devant mon ordinateur à écrire des lignes de codes
Projet Actuel : RPG

Problème de choix (race et nom) Empty
MessageSujet: Re: Problème de choix (race et nom)   Problème de choix (race et nom) EmptyMar 22 Mai 2007 - 23:23

oué pe etre met une variable alors qui se met sur true quand tu a appuyer et qui se remet sur false quand c bon
Revenir en haut Aller en bas
http://creation-pepsy.ifrance.com
Nic353
Utilisateur confirmé: Rang ****
Nic353


Messages : 838
Localisation : Je suis partout
Projet Actuel : 2Day of Defeat

Problème de choix (race et nom) Empty
MessageSujet: Re: Problème de choix (race et nom)   Problème de choix (race et nom) EmptyMer 23 Mai 2007 - 2:54

qu'un petit essaie(non tester):

dans L'event Step ou celle que tu veux
Code:

event_perform(ev_draw,event_number){
draw_set_font(Size20)
draw_text(128,80,"Haaaw,ma tete...")
draw_set_font(Size15)}
if (keyboard_check(vk_right))
event_perform(ev_draw,event_number){
draw_text(128,112,"Garde : Vous n'aviez qu'a ne pas vous ramassez ici.")
}

_________________
Problème de choix (race et nom) 2dodbc6
Revenir en haut Aller en bas
http://nicrf.0moola.com
Contenu sponsorisé





Problème de choix (race et nom) Empty
MessageSujet: Re: Problème de choix (race et nom)   Problème de choix (race et nom) Empty

Revenir en haut Aller en bas
 
Problème de choix (race et nom)
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» problème de choix du joueur...
» Probleme : choix aléatoire
» Personnage Choix
» blob's Race
» Choix des touches

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Forum Le CBNA :: Développement :: Entraide débutants-
Sauter vers: