| 
			
				|  | Castle Paradox 
 
 |  
 
	
		| View previous topic :: View next topic |  
		| Author | Message |  
		| bis_senchi 
 
 
  
 Joined: 08 Jun 2004
 Posts: 460
 Location: Reims, France
 
 | 
			
				|  Posted: Sat Jan 10, 2009 2:49 am    Post subject: Help to embetter my fake inn script! |   |  
				| 
 |  
				| Here is a new version of my fake inn scripts I've made 2 years ago. 
 
 
  	  | Code: |  	  | 
 Global variable (36, MyMoney) # get our current amont of money
 Global variable (39, hero0 stat)
 Global variable (40, hero0 stat max)
 Global variable (41, hero2 stat)
 Global variable (42, hero2 stat max)
 Global variable (43, hero3 stat)
 Global variable (44, hero3 stat max)
 
 #---------------------------------------------------------------------------
 # script fake inn part 1
 script, fake inn , begin
 
 suspend player
 
 set variable (MyMoney, party money) #store the amount we currently have
 get money (MyMoney) #prevents Hspeak from saying the variable is unused
 lose money (MyMoney)
 
 show text box (368)
 wait for text box
 
 nb hero:= 0 #reset heroes' counting
 
 # store main hero stats
 set variable (hero0 stat, get hero stat (0,stat:hp,current stat))
 set variable (hero0 stat max, get hero stat(0,stat:hp,maximum stat))
 set hero stat (0, stat:hp, 6, current stat) #prevents hspeak.exe from complaining
 set hero stat (0, stat:hp, 6, maximum stat)
 set hero stat (0, stat:hp, hero0 stat, current stat)
 set hero stat (0, stat:hp, hero0 stat max, maximum stat)
 get hero name (0,find hero(hero by slot(0)))
 increment (nb hero, 1) #store main hero's datas
 wait (2)
 
 if (hero by slot (1) <> -1) then, begin #if slot (1) is occupied then, store his stats and names
 set variable (hero1 stat, get hero stat (1,stat:hp,current stat))
 set variable (hero1 stat max, get hero stat(1,stat:hp,maximum stat))
 set hero stat (1, stat:hp, 6, current stat) #prevents hspeak.exe from complaining
 set hero stat (1, stat:hp, 6, maximum stat)
 set hero stat (1, stat:hp, hero1 stat, current stat)
 set hero stat (1, stat:hp, hero1 stat max, maximum stat)
 get hero name (1,find hero(hero by slot(1)))
 increment (nb hero, 1)
 wait (2)
 end, else, begin
 wait (1)
 end
 
 if (hero by slot (2) <> -1) then, begin #if slot (2) is occupied store his stats
 set variable (hero2 stat, get hero stat (2,stat:hp,current stat))
 set variable (hero2 stat max, get hero stat(2,stat:hp,maximum stat))
 set hero stat (2, stat:hp, 6, current stat) #prevents hspeak.exe from complaining
 set hero stat (2, stat:hp, 6, maximum stat)
 set hero stat (2, stat:hp, hero2 stat, current stat)
 set hero stat (2, stat:hp, hero2 stat max, maximum stat)
 get hero name (2,find hero(hero by slot(2)))
 increment (nb hero, 1)
 wait (2)
 end, else, begin
 wait (1)
 end
 
 if (hero by slot (3) <> -1) then, begin #if slot (3) is occupied store his stats
 set variable (hero3 stat, get hero stat(3,stat:hp,current stat))
 set variable (hero3 stat max, get hero stat(3,stat:hp,maximum stat))
 set hero stat (3, stat:hp, 6, current stat) #prevents hspeak.exe from complaining
 set hero stat (3, stat:hp, 6, maximum stat)
 set hero stat (3, stat:hp, hero3 stat, current stat)
 set hero stat (3, stat:hp, hero3 stat max, maximum stat)
 get hero name (3,find hero(hero by slot(3)))
 increment (nb hero, 1)
 wait (2)
 end, else, begin
 wait (1)
 end
 
 set tag (tag: inn case 1, off) #reset situation checking
 set tag (tag: inn case 2, off)
 set tag (tag: inn case 3, off)
 set tag (tag: inn case 4, off)
 set tag (tag: inn case 5, off)
 set tag (tag: inn case 6, off)
 set tag (tag: inn case 7, off)
 set tag (tag: enough cash, off)
 set tag (tag: stats stored, on)
 wait (2)
 
 if (check tag (tag: stats stored) == ON) then, begin
 if (nb hero == 1)then, begin #1 hero= hero (0) is alone
 show text box (381)
 wait for text box
 set tag (tag:inn case 8, on)
 resume player
 fake inn 2
 end # end for if (nb hero == 1)then...
 
 if (nb hero == 2)then, begin # 2 heroes (0) is with one another hero
 
 if (hero by slot (1) <> -1) then, begin #  if slot (1) is occupied, then hero (0) is alone with hero (1)...
 show text box (378)
 wait for text box
 set tag (tag:inn case 1, on)
 resume player
 fake inn 2
 end
 
 if (hero by slot (2) <> -1) then, begin #  if slot (2) is occupied, then hero (0) is alone with hero (2)...
 show text box (383)
 wait for text box
 set tag (tag:inn case 2, on)
 resume player
 fake inn 2
 end
 
 if (hero by slot (3) <> -1)then, begin  # if slot (3) is occupied, then hero (0) is alone with hero (3)...
 show text box (385)
 wait for text box
 set tag (tag:inn case 3, on)
 resume player
 fake inn 2
 end
 
 end # end for if (nb hero == 2)then, begin...
 
 
 if (nb hero == 3)then, begin #case 3 hero (0) is with 2 another heroes
 
 if (hero by slot (1) == -1) then, begin # slot (1) is free then the 2 other heroes are in slot (2) and (3)...
 show text box (382)
 wait for text box
 set tag (tag:inn case 4, on)
 resume player
 fake inn 2
 end
 
 if (hero by slot (2) == -1) then, begin # slot (2) is free the 2 other heroes are in slot (1) and (3)...
 show text box (384)
 wait for text box
 set tag (tag:inn case 5, on)
 resume player
 fake inn 2
 end
 
 if (hero by slot (3) == -1) then, begin # slot (3) is free the 2 other heroes are in slot (1) and (2)...
 show text box (379)
 wait for text box
 set tag (tag:inn case 6, on)
 resume player
 fake inn 2
 end #end for the else begin
 
 end # end for if (nb hero == 3)
 
 if (nb hero == 4)then, begin # all the slots are full
 show text box (380)
 wait for text box
 set tag (tag:inn case 7, on)
 resume player
 fake inn 2
 end # end for if (nb hero == 4)
 
 end #end for the check tag
 end# end of plotscript
 #---------------------------------------------------------------------------
 #script fake inn part 2
 script, fake inn 2, begin
 
 suspend player
 
 if (check tag (tag: go to team) == ON) then, begin
 if (MyMoney >= 500), then, begin # we check if we have at least 500
 set tag (tag: enough cash, on)
 wait (1)
 resume player
 end
 
 if (MyMoney << 500), then, begin # if we have less than 500 yens then...
 set tag (tag: enough cash, off)
 show text box (369) # Sorry. You don't have enough cash
 wait for text box
 resume player
 end
 
 end #  end for the if check tag
 
 if (check tag (tag: go to team) == OFF) then, begin
 resume player
 wait (1)
 end
 
 if (check tag(tag: inn case 8)==ON, and, check tag (tag: enough cash)== on) then, begin
 set hero stat(0,stat:hp, get hero stat(0,stat:hp,maximum stat), current stat) #restore stats hero 0
 set hero stat(0,stat:mp, get hero stat(0,stat:mp,maximum stat), current stat)
 set tag (tag: inn case 8, off)
 lose money (500) # pay the inn tender
 fade screen out
 fade screen in
 resume player
 end
 
 if (check tag(tag: inn case 1)==ON, and, check tag (tag: enough cash)== on) then, begin
 set hero stat(0,stat:hp, get hero stat(0,stat:hp,maximum stat), current stat) #restore stats hero 0
 set hero stat(0,stat:mp, get hero stat(0,stat:mp,maximum stat), current stat)
 set hero stat(1,stat:hp, get hero stat(1,stat:hp,maximum stat), current stat) #restore stats hero 1
 set hero stat(1,stat:mp, get hero stat(1,stat:mp,maximum stat), current stat)
 set tag (tag: inn case 1, off)
 lose money (500) # pay the inn tender
 fade screen out
 fade screen in
 resume player
 end
 
 if (check tag(tag: inn case 2)==ON,and ,check tag (tag: enough cash)== on) then, begin
 set hero stat(0,stat:hp, get hero stat(0,stat:hp,maximum stat), current stat) #restore stats hero 0
 set hero stat(0,stat:mp, get hero stat(0,stat:mp,maximum stat), current stat)
 set hero stat(2,stat:hp, get hero stat(2,stat:hp,maximum stat), current stat) #restore stats hero 2
 set hero stat(2,stat:mp, get hero stat(2,stat:mp,maximum stat), current stat)
 set tag (tag: inn case 2, off)
 lose money (500) # pay the inn tender
 fade screen out
 fade screen in
 resume player
 end
 
 if (check tag(tag: inn case 3)==ON, and ,check tag (tag: enough cash)== on) then, begin
 set hero stat(0,stat:hp, get hero stat(0,stat:hp,maximum stat), current stat) #restore stats hero 0
 set hero stat(0,stat:mp, get hero stat(0,stat:mp,maximum stat), current stat)
 set hero stat(3,stat:hp, get hero stat(3,stat:hp,maximum stat), current stat) #restore stats hero 3
 set hero stat(3,stat:mp, get hero stat(3,stat:mp,maximum stat), current stat)
 set tag (tag: inn case 3, off)
 lose money (500) # pay the inn tender
 fade screen out
 fade screen in
 resume player
 end
 
 if (check tag(tag: inn case 4)==ON, and ,check tag (tag: enough cash)== on) then, begin
 set hero stat(0,stat:hp, get hero stat(0,stat:hp,maximum stat), current stat) #restore stats hero 0
 set hero stat(0,stat:mp, get hero stat(0,stat:mp,maximum stat), current stat)
 set hero stat(2,stat:hp, get hero stat(2,stat:hp,maximum stat), current stat) #restore stats hero 2
 set hero stat(2,stat:mp, get hero stat(2,stat:mp,maximum stat), current stat)
 set hero stat(3,stat:hp, get hero stat(3,stat:hp,maximum stat), current stat) #restore stats hero 3
 set hero stat(3,stat:mp, get hero stat(3,stat:mp,maximum stat), current stat)
 set tag (tag: inn case 4, off)
 lose money (500) # pay the inn tender
 fade screen out
 fade screen in
 resume player
 end
 
 if (check tag(tag: inn case 5)==ON, and ,check tag (tag: enough cash)== on) then, begin
 set hero stat(0,stat:hp, get hero stat(0,stat:hp,maximum stat), current stat) #restore stats hero 0
 set hero stat(0,stat:mp, get hero stat(0,stat:mp,maximum stat), current stat)
 set hero stat(1,stat:hp, get hero stat(1,stat:hp,maximum stat), current stat) #restore stats hero 1
 set hero stat(1,stat:mp, get hero stat(1,stat:mp,maximum stat), current stat)
 set hero stat(3,stat:hp, get hero stat(3,stat:hp,maximum stat), current stat) #restore stats hero 3
 set hero stat(3,stat:mp, get hero stat(3,stat:mp,maximum stat), current stat)
 set tag (tag: inn case 5, off)
 lose money (500)  # pay the inn tender
 fade screen out
 fade screen in
 resume player
 end
 
 
 if (check tag(tag: inn case 6)==ON, and ,check tag (tag: enough cash)== on) then, begin
 set hero stat(0,stat:hp, get hero stat(0,stat:hp,maximum stat), current stat) #restore stats hero 0
 set hero stat(0,stat:mp, get hero stat(0,stat:mp,maximum stat), current stat)
 set hero stat(1,stat:hp, get hero stat(1,stat:hp,maximum stat), current stat) #restore stats hero 1
 set hero stat(1,stat:mp, get hero stat(1,stat:mp,maximum stat), current stat)
 set hero stat(2,stat:hp, get hero stat(2,stat:hp,maximum stat), current stat) #restore stats hero 2
 set hero stat(2,stat:mp, get hero stat(2,stat:mp,maximum stat), current stat)
 set tag (tag: inn case 6, off)
 lose money (500)  # pay the inn tender
 fade screen out
 fade screen in
 resume player
 end
 
 
 if (check tag(tag: inn case 7)==ON, and ,check tag (tag: enough cash)== on) then, begin
 set hero stat(0,stat:hp, get hero stat(0,stat:hp,maximum stat), current stat) #restore stats hero 0
 set hero stat(0,stat:mp, get hero stat(0,stat:mp,maximum stat), current stat)
 set hero stat(1,stat:hp, get hero stat(1,stat:hp,maximum stat), current stat) #restore stats hero 1
 set hero stat(1,stat:mp, get hero stat(1,stat:mp,maximum stat), current stat)
 set hero stat(2,stat:hp, get hero stat(2,stat:hp,maximum stat), current stat) #restore stats hero 2
 set hero stat(2,stat:mp, get hero stat(2,stat:mp,maximum stat), current stat)
 set hero stat(3,stat:hp, get hero stat(3,stat:hp,maximum stat), current stat) #restore stats hero 3
 set hero stat(3,stat:mp, get hero stat(3,stat:mp,maximum stat), current stat)
 set tag (tag: inn case 7, off)
 lose money (500)  # pay the inn tender
 fade screen out
 fade screen in
 resume player
 end
 
 end #end of plotscript
 #------------------------------
 
 
 | 
 
 James highlighed on the talk page for the article on the wiki (http://gilgamesh.hamsterrepublic.com/wiki/ohrrpgce/index.php/Talk:How_do_I_make_a_%22fake_inn%22%3F) that 2 tags could be activated at the same time (tag case 7 another one)
 
 My first question will be : what part of the script is not clear for you?
 (I need to know what part of the code you don't understand so that I can embetter it!)
 
 Good luck!
 _________________
 It's time to make games!
 |  |  
		| Back to top |  |  
		|  |  
		| Camdog 
 
 
 
 Joined: 08 Aug 2003
 Posts: 606
 
 
 | 
			
				|  Posted: Sat Jan 10, 2009 9:02 am    Post subject: |   |  
				| 
 |  
				| I think before a discussion about this can begin, you need to describe exactly what you want this script to do.  At first glance, it appears this script just does a whole lot of nothing.  For example, at the beginning, you store each of the hero stats in a global variable (why not local?), then you set the stats to 6 for some reason I don't understand (what is hspeak complaining about, exactly?), then you set them back to what they previously had been using your variables!  What exactly is this trying to accomplish? 
 Further down, when you actually get to the inn part of the script, it looks like it does nothing but restore stats, take some money, and fade the screen in and out...  Isn't this the default behavior of inns anyway?  What is the end goal here?
 
 And finally, I'd say it's better to just leave the hspeak warnings, rather than just creating tons of weird code to get around them.  It obfuscates the meaning of your code, and compile-time warnings don't hurt anything, provided you understand them and know why you can ignore them.
 |  |  
		| Back to top |  |  
		|  |  
		| bis_senchi 
 
 
  
 Joined: 08 Jun 2004
 Posts: 460
 Location: Reims, France
 
 | 
			
				|  Posted: Tue Jan 13, 2009 12:23 am    Post subject: More information about the script |   |  
				| 
 |  
				| I've made those 2 fake inn scripts to explain how to make an inn that  looks exactly like the one that goes with custom.exe except that you can choose more precisely which you want to restore. 
 At the beginning of the script the current money the hero team have is stored.
 
 The first text box announce that they can stay for the night if they pay $500.
 Then slots are checked (that's where you can read "if (hero by slot (3) <> -1)  ) to see if there are heroes in it or not and what are their current hp/mp stats.
 
 This part of the script is very important because it determines in which situation we are (hero1 and hero3? hero1 alone? 3 heroes in slots 0,1,2?)
 For each of the 8 cases; a tag will be turned on. To fake perfectly the basic inn, I've also used global variables to make appear in text boxes the current hp/mp stats and the heroes names.
 
 That 's where the problem comes from and that's I've posted the scripts. As there's always one hero (the main hero) in slot 0 inn case 7 is always turned on with another tag (if there are other heroes)
 
 Then fake inn2 starts. First we check if we have enough money. If  we dont, text box 369 appears.
 
 The script fake inn2 runs and when the tag previously activated arrives the stats are restored, the inn tender is payed and the fade screen out and fade screen in manage to fake when no scripts for night behaviour have been attributed for custom's basic inn .
 
 My question will be the following what other commands can I use to make heroes in slot detected and then make information about them (name current hp/ mp stats) appears in text boxes.
 
 As always, thank you very much in advance for your help!
 _________________
 It's time to make games!
 |  |  
		| Back to top |  |  
		|  |  
		| Camdog 
 
 
 
 Joined: 08 Aug 2003
 Posts: 606
 
 
 | 
			
				|  Posted: Tue Jan 13, 2009 10:46 am    Post subject: |   |  
				| 
 |  
				| The process of restoring all active party members can be drastically simplified with a for loop.  Remember, hero by slot returns -1 in the case of no hero being in the slot, so we can check for that in an if statement and wrap all the restoring in a tidy little for loop. 
 Further, since text boxes can include strings and variables, we only need one text box to show the status of the restored player; we can update the values that the text box will use before we display it.
 
 It would all look something like this:
 
 
  	  | Code: |  	  | global variable(1, heroHp) 
 script, fake inn , begin
 
 suspend player
 
 show text box (1) #do you want to stay for the night?
 wait for text box
 
 if (check tag(1)) then( #if you do want to stay for the night
 if (pay money(500)) then(
 variable(loop) #this is the number that will check slots 0 through 3
 variable(curHero) #this is the number that will store the hero id, or false if there is no hero id in the loop slot
 for (loop, 0, 3, 1) do(
 curHero := hero by slot(loop) #get the current hero id, if there is one
 if (curHero >= 0) then(
 #set the current hero stat equal to the maximum stat
 set hero stat(curHero, stat:hp, get hero stat(curHero, stat:hp, maximum stat), current stat)
 #and so on for any other stat you wish to restore
 
 #now, we update the text box string and global vars and show it
 get hero name(1, curHero)
 heroHp := get hero stat(curHero, stat:hp, current stat)
 show text box(2) #player $S{1} now has $V{1} hit points!
 wait for text box
 )
 )
 )
 else (
 show text box(3) #You don't have the money!
 wait for text box
 )
 )
 
 end
 | 
 
 So, to break it all down, text box 1 is the box which asks the player if they want to use the inn, and this box will come with a choice that will set tag 1 to true if they select 'yes'.
 
 If they select yes, the plotscript will check to see if they have enough money (in this case, 500).  Remember, 'pay money' command returns true if the player can pay the money and false otherwise, but it ONLY subtracts the money if the player can pay it, so:
 
 
  	  | Code: |  	  | if (pay money(500)) | 
 
 is sufficient to check if the player has enough money AND cause the player to pay the money.
 
 If the player has the money, the script will loop through each possible active party member slot, only restoring their health if there is actually a hero in the slot.  If the health is restored, we also change the values the info text box (box 2) reads to equate to the hero being healed, so when we display the text box, the information is correct.
 
 If the player does not have the money, the 'sorry not enough gold!' text box (box 3) is displayed.
 
 Using this method, we can drastically decrease code size, use fewer global variables (which pollute the namespace), make the code more readable, and make the code easier to update (as changes will only require an update of a single case, rather than eight).
 
 NOTE: I haven't compiled this snippet, so it's possible there's some minor syntax error or some such floating around in it, but the idea behind it is sound.
 
 [edit]
 Changed the code to fix the problem James pointed out.
 
 Last edited by Camdog on Tue Jan 13, 2009 2:21 pm; edited 2 times in total
 |  |  
		| Back to top |  |  
		|  |  
		| Bob the Hamster OHRRPGCE Developer
 
 
 
  
 Joined: 22 Feb 2003
 Posts: 2526
 Location: Hamster Republic (Southern California Enclave)
 
 | 
			
				|  Posted: Tue Jan 13, 2009 1:35 pm    Post subject: |   |  
				| 
 |  
				|  	  | Camdog wrote: |  	  | The process of restoring all active party members can be drastically simplified with a for loop.  Remember, hero by slot returns -1 (which evaluates as false in an if statement) in the case of no hero being in the slot, so we can wrap all the restoring in a tidy little for loop. | 
 
 Actually, 0 is false, so -1 will resolve to true. So your if statement should actually be:
 
 
  	  | Code: |  	  | if (curHero >= 0) then( | 
 
 Other than that it looks good.
 |  |  
		| Back to top |  |  
		|  |  
		| Camdog 
 
 
 
 Joined: 08 Aug 2003
 Posts: 606
 
 
 | 
			
				|  Posted: Tue Jan 13, 2009 2:21 pm    Post subject: |   |  
				| 
 |  
				| Whoops!  Thanks for catching that.  I've changed the code example. |  |  
		| Back to top |  |  
		|  |  
		| bis_senchi 
 
 
  
 Joined: 08 Jun 2004
 Posts: 460
 Location: Reims, France
 
 | 
			
				|  Posted: Thu Jan 15, 2009 11:45 pm    Post subject: It seems to be correct but.... |   |  
				| 
 |  
				| The code seems good but I don't understand how we can make appear 4 heroes hp AND mp stats with one global variable. 
 As I explain in the comments of my first version of the script there are 8 possiblities (the main hero will meet other heroes along my game and the player can change they order in the menu)
 
 case 1
 hero1 hp/mp
 
 case 2
 hero1 hp/mp
 hero2 hp/mp
 
 case 3
 hero1 hp/mp
 hero2 hp/mp
 hero3 hp/mp
 
 case 4
 hero1 hp/mp
 hero2 hp/mp
 hero3 hp/mp
 hero4 hp/mp
 
 case 5
 hero1 hp/mp
 
 hero3 hp/mp
 hero4 hp/mp
 
 
 case 6
 hero1 hp/mp
 hero2 hp/mp
 
 hero4 hp/mp
 
 case 7
 hero1 hp/mp
 
 
 hero4 hp/mp
 
 case 8
 hero1 hp/mp
 
 hero3 hp/mp
 
 Note that to perfectly fake the inn line spaces (which represents empty slots) are very important
 
 Could somoene confirm that the global variable equals 0 nothing appears on the text boxes even if there's a {V3} (or any other figure used to call global variables)?
 
 As always thanks for the help!
 _________________
 It's time to make games!
 |  |  
		| Back to top |  |  
		|  |  
		| Moogle1 Scourge of the Seas
 Halloween 2006 Creativity Winner
 
  
 
  
 Joined: 15 Jul 2004
 Posts: 3377
 Location: Seattle, WA
 
 | 
			
				|  Posted: Fri Jan 16, 2009 12:28 am    Post subject: |   |  
				| 
 |  
				| Why do you need to separate all of the cases? I guess I don't understand the purpose of your script. _________________
 
 |  |  
		| Back to top |  |  
		|  |  
		| Camdog 
 
 
 
 Joined: 08 Aug 2003
 Posts: 606
 
 
 | 
			
				|  Posted: Fri Jan 16, 2009 8:13 am    Post subject: |   |  
				| 
 |  
				|  	  | bis_senchi wrote: |  	  | The code seems good but I don't understand how we can make appear 4 heroes hp AND mp stats with one global variable. | 
 
 You can't.  You just need another global variable for each stat.  (At least if you want to display global variables in a text box using the method I described).
 
 The code I gave you will deal with of all the cases you described, or any combination of heroes, really.  Do you understand why?  It's pretty important you understand how it works if you want to alter it to suit your needs.  Feel free to ask me questions.
 
 [edit]
 Oh, I see what the issue is!  You're concerned with the formatting of the information text box, right?  This can be accomplished pretty easily with strings.  I'd make a single text box with 4 lines like so:
 
 ${S1}
 ${S2}
 ${S3}
 ${S4}
 
 Then, while looping through the hero possibilities, if you find no hero, you clear the string, and if you do find a hero, you construct the string to display the name and stats in whatever format you like.
 |  |  
		| Back to top |  |  
		|  |  
		| bis_senchi 
 
 
  
 Joined: 08 Jun 2004
 Posts: 460
 Location: Reims, France
 
 | 
			
				|  Posted: Thu Jan 22, 2009 1:36 am    Post subject: |   |  
				| 
 |  
				|  	  | camdog wrote: |  	  | 
 Oh, I see what the issue is! You're concerned with the formatting of the information text box, right? This can be accomplished pretty easily with strings. I'd make a single text box with 4 lines like so:
 
 ${S1}
 ${S2}
 ${S3}
 ${S4}
 
 Then, while looping through the hero possibilities, if you find no hero, you clear the string, and if you do find a hero, you construct the string to display the name and stats in whatever format you like.
 | 
 
 That's exactly what I need! How do put all this in plotscript language? I'm never cleared string! This is done using plotscripting isn't it?
 _________________
 It's time to make games!
 
 Last edited by bis_senchi on Wed Jan 28, 2009 12:09 am; edited 1 time in total
 |  |  
		| Back to top |  |  
		|  |  
		| bis_senchi 
 
 
  
 Joined: 08 Jun 2004
 Posts: 460
 Location: Reims, France
 
 | 
			
				|  Posted: Wed Jan 28, 2009 12:09 am    Post subject: Help to clear strings! |   |  
				| 
 |  
				| So? Could somoene help me with clearing strings? _________________
 It's time to make games!
 |  |  
		| Back to top |  |  
		|  |  
		| Spoon Weaver 
 
 
  
 Joined: 18 Nov 2008
 Posts: 421
 Location: @home
 
 | 
			
				|  Posted: Wed Jan 28, 2009 12:55 am    Post subject: |   |  
				| 
 |  
				| right?
 
 Not to be rude but did you even look at the Plotscripting Dictionary ?
 That's were I get all my information.
 |  |  
		| Back to top |  |  
		|  |  
		| TMC On the Verge of Insanity
 
 
 
 
 Joined: 05 Apr 2003
 Posts: 3240
 Location: Matakana
 
 | 
			
				|  Posted: Wed Jan 28, 2009 6:10 am    Post subject: |   |  
				| 
 |  
				| Here's Camdog's script modified to use a single textbox, number 2, containing the following: 
  	  | Code: |  	  | ${S0} ${S1}
 ${S2}
 ${S3}
 | 
 We'll use strings 0 to 3 because that's simpler.
 I've marked all the lines I changed with comments beginning with ###
 
 
  	  | Code: |  	  | script, fake inn, begin
 
 suspend player
 
 show text box (1) #do you want to stay for the night?
 wait for text box
 
 if (check tag(1)) then( #if you do want to stay for the night
 if (pay money(500)) then(
 variable(loop) #this is the number that will check slots 0 through 3
 variable(curHero) #this is the number that will store the hero id, or false if there is no hero id in the loop slot
 variable(HeroHP) ###
 for (loop, 0, 3, 1) do(
 ### Clear the string
 clear string (loop)
 
 curHero := hero by slot(loop) #get the current hero id, if there is one
 if (curHero >= 0) then(
 #set the current hero stat equal to the maximum stat
 set hero stat(curHero, stat:hp, get hero stat(curHero, stat:hp, maximum stat), current stat)
 #and so on for any other stat you wish to restore
 
 #now, we update the text box string and global vars and show it
 get hero name(31, curHero)
 heroHp := get hero stat(curHero, stat:hp, current stat)
 
 ### build string number 'loop'
 $loop="Hero "
 concatenate strings (loop, 31)  #or write "loop $+ 31" for short
 $loop+" now has "
 append number (loop, heroHp)
 $loop+" HP!"
 )
 )
 ### display the textbox
 show textbox(2)
 wait for textbox
 )
 else (
 show text box(3) #You don't have the money!
 wait for text box
 )
 )
 
 end
 | 
 
 Do you understand how to piece together a string? Look up each command I used.
 _________________
 "It is so great it is insanely great."
 |  |  
		| Back to top |  |  
		|  |  
		| bis_senchi 
 
 
  
 Joined: 08 Jun 2004
 Posts: 460
 Location: Reims, France
 
 | 
			
				|  Posted: Mon Feb 16, 2009 10:31 am    Post subject: Help me to reoganise the scripts |   |  
				| 
 |  
				| I've tried The Mad Cacti system but the variable are empty Here is a little screenshot of what I would like to do using stings
 
 [url]http://membres.lycos.fr/sailormoonffe/ images_forum/	screenshot_inn.bmp [/url]
 
 The text box above appears just after "do you want to stay for the night?" and is linked with the tag. Could somoene help me to reorganise the script lines?
 _________________
 It's time to make games!
 |  |  
		| Back to top |  |  
		|  |  
		| Camdog 
 
 
 
 Joined: 08 Aug 2003
 Posts: 606
 
 
 | 
			
				|  Posted: Tue Feb 17, 2009 12:00 pm    Post subject: |   |  
				| 
 |  
				| What exactly do you mean by 'the variables are empty'?  Could you post your script and the contents of your target text box? |  |  
		| Back to top |  |  
		|  |  
		|  |  
  
	| 
 
 | You can post new topics in this forum You can reply to topics in this forum
 You cannot edit your posts in this forum
 You cannot delete your posts in this forum
 You cannot vote in polls in this forum
 
 |  
 Powered by phpBB © 2001, 2005 phpBB Group
 
 
 |