Post new topic    
King Slime
Send private message
Trick's over Treats...! 
 PostMon Oct 17, 2011 7:18 pm
Send private message Reply with quote
Alright, my script refuses to compile...
Heres the entire script. Now brace yourself...

Code:
plotscript, random name, begin
   variable(name)
   set variable(name,random(1,71))
   
   if (name == 1) then ($1= "Master K")
   if (name == 2) then ($1= "Spoonweaver")
   if (name == 3) then ($1= "Nathan Karr")
   if (name == 4) then ($1= "Mogri")
   if (name == 5) then ($1= "Rockstar")
   if (name == 6) then ($1= "Charbile")
   if (name == 7) then ($1= "James Paige")
   if (name == 8) then ($1= "Ncw64")
   if (name == 9) then ($1= "Willy Elektrix")
   if (name == 10) then ($1= "Thespazztikone")
   if (name == 11) then ($1= "Gizmog")
   if (name == 12) then ($1= "Mjohnson092088")
   if (name == 13) then ($1= "Meatballsub")
   if (name == 14) then ($1= "Jaguar")
   if (name == 15) then ($1= "TMC")
   if (name == 16) then ($1= "Fenrir-Lunaris")
   if (name == 17) then ($1= "Twinconclusive")
   if (name == 18) then ($1= "Ichiro")
   if (name == 19) then ($1= "Neospade")
   if (name == 20) then ($1= "Voltire")
   if (name == 21) then ($1= "JSH357")
   if (name == 22) then ($1= "Duke of Dellot")
   if (name == 23) then ($1= "RMSephy")
   if (name == 24) then ($1= "G-Wreck")
   if (name == 25) then ($1= "Marionline")
   if (name == 26) then ($1= "Shizuma")
   if (name == 27) then ($1= "Harlock Hero")
   if (name == 28) then ($1= "FnnrfYgmSchnish")
   if (name == 29) then ($1= "NaysusDante")
   if (name == 30) then ($1= "Msw188")
   if (name == 31) then ($1= "Greenwado")
   if (name == 32) then ($1= "Pepsi Ranger")
   if (name == 33) then ($1= "Barnabus")
   if (name == 34) then ($1= "Momoka")
   if (name == 35) then ($1= "Baconlabs")
   if (name == 36) then ($1= "Chronoboy")
   if (name == 37) then ($1= "Blue Train")
   if (name == 38) then ($1= "Surlaw")
   if (name == 39) then ($1= "RedMaverickZero")
   if (name == 40) then ($1= "Shakeyair")
   if (name == 41) then ($1= "TwirlySocrates")
   if (name == 42) then ($1= "Puzzle")
   if (name == 43) then ($1= "Sh4d0ws")
   if (name == 44) then ($1= "Umbrella")
   if (name == 45) then ($1= "Fieron")
   if (name == 46) then ($1= "Rebobinar")
   if (name == 47) then ($1= "Hachi")
   if (name == 48) then ($1= "Newbie Newtype")
   if (name == 49) then ($1= "Lucier")
   if (name == 50) then ($1= "Godsavant")
   if (name == 51) then ($1= "Uncommon")
   if (name == 52) then ($1= "8bifit")
   if (name == 53) then ($1= "Beau_rl")
   if (name == 54) then ($1= "Camdog")
   if (name == 55) then ($1= "Chenzi")
   if (name == 56) then ($1= "Mazin")
   if (name == 57) then ($1= "Aeth")
   if (name == 58) then ($1= "Chill-E")
   if (name == 59) then ($1= "Bengrande")
   if (name == 60) then ($1= "No_Shot")
   if (name == 61) then ($1= "Only One In All")
   if (name == 62) then ($1= "Kenecchi")
   if (name == 63) then ($1= "Fortis")
   if (name == 64) then ($1= "Shadowiii")
   if (name == 65) then ($1= "Rikokun")
   if (name == 66) then ($1= "Spectrumstudios")
   if (name == 67) then ($1= "Calehay")
   if (name == 68) then ($1= "VampiDucki")
   if (name == 69) then ($1= "Machu")
   if (name == 70) then ($1= "Artimus Bena")
   if (name == 71) then ($1= "Guild")
   if (name == 72) then ($1= "Eggie")
   if (name == 73) then ($1= "J Taylor)
   if (name == 74) then ($1= "Entropy")
   if (name == 75) then ($1= "Valigarmander")
   if (name == 76) then ($1= "Alk")
   if (name == 77) then ($1= "Quo")
   if (name == 78) then ($1= "Joseph)
   if (name == 79) then ($1= "Ihdrafter")
   if (name == 80) then ($1= "Raekuul")
   if (name == 81) then ($1= "MewMew")
   if (name == 82) then ($1= "English Ivy")
   if (name == 83) then ($1= "NinjaOverdrive")
   if (name == 84) then ($1= "SDHawk")
   if (name == 85) then ($1= "Jack")
   if (name == 86) then ($1= "Coximind")
   if (name == 87) then ($1= "TheCube")
   if (name == 88) then ($1= "Ametheyzt")
   if (name == 89) then ($1= "Mystic")
   if (name == 90) then ($1= "Jacuun")
   if (name == 91) then ($1= "Masail")
   if (name == 92) then ($1= "New-Gen")
   if (name == 93) then ($1= "Mistah_J")
   if (name == 94) then ($1= "Ajguy93")
   if (name == 95) then ($1= "Adventuregnome")
   if (name == 96) then ($1= "(+[]::)<GBA")
   if (name == 97) then ($1= "GLOW")
   if (name == 98) then ($1= "Minigaara")
   if (name == 99) then ($1= "Stewie")
   if (name == 100) then ($1= "ChaosNyte")
   
    end
   
plotscript, knock on door, begin
   suspend player
   suspend box advance
   show text box(3)
   wait(25)
   advance text box
   show text box(4)
   wait(25)
   advance text box
   show text box(5)
   wait(25)
   advance text box
   resume box advance
   show text box(6)
   wait for text box
   tri or tre
   resume player
   end
   
plotscript, tri or tre, begin
   variable(which)
   set variable(which,random(1,2))
   
   if (tag(tag:No Costume == ON) then
   costumeless
   
   ) else (
   
   if (which == 1) then (player treat)
   if (which == 2) then (player trick)
   
   end
   
plotscript, costumeless, begin
   variable(which one)
   set variable(which one,random(1,3))
   
   if (which one == 1) then (player treat costumeless)
   if (which one == 2) then (player trick)
   if (which one == 3) then (player trick)
   
   end
   
plotscript, player treat, begin
   variable(comment)
   variable(candy)
   set variable(comment,random(1,9))
   set variable(candy,random(3,99))
   suspend box advance
   
   show text box(1)
   wait(55)
   advance text box
   
   resume box advance
   random name
   
   if(comment == 1) then (show text box(13))
   if(comment == 2) then (show text box(14))
   if(comment == 3) then (show text box(15))
   if(comment == 4) then (show text box(16))
   if(comment == 5) then (show text box(17))
   if(comment == 6) then (show text box(18))
   if(comment == 7) then (show text box(19))
   if(comment == 8) then (show text box(20))
   if(comment == 9) then (show text box(21))
   
   wait for text box
   
   get money(candy)
   
   end
   
plotscript, player treat costumeless, begin
   variable(insult)
   variable(candy get)
   set variable(insult,random(1,5))
   set variable(candy get,random(1,50))
   suspend box advance
   
   show text box(1)
   wait(55)
   advance text box
   
   resume box advance
   random name
   
   if(insult == 1) then (show text box(7))
   if(insult == 2) then (show text box(8))
   if(insult == 3) then (show text box(9))
   if(insult == 4) then (show text box(10))
   if(insult == 5) then (show text box(11))
   if(insult == 6) then (show text box(12))
   
   wait for text box
   
   get money(candy get)
   
   end
   
plotscript, player trick, begin
   variable(number)
   variable(payoff)
   set variable(battle,random(1,3))
   set variable(candy get,random(1,70))
   suspend box advance
   
   show text box(2)
   wait(55)
   advance text box
   
   resume box advance
   
   fight formation(number)
   get money(candy get)
   
   end


Heres the warning:
declaration plotscript is not permitted in a script. Perhaps randomname has an extra begin or (.

And before you say it, yes, I do know that begin/( are the same.

Feel free to point out any extra errors.

Also, I got a question:

In treat, would it be possible to assign $3 to the variable 'Candy's value? So it would say in a text box: You recieved ${S3} piece(s) of candy!"
Metal King Slime
Send private message
 
 PostMon Oct 17, 2011 8:39 pm
Send private message Reply with quote
You ought to give the line number on which HSpeak reports an error. The script that contains too many begins or not enough ends is the one immediately before the script or plotscript line that reports an error.

I figured it out anyway, it's "tri or tre". Look at your if's construction:
Code:
   if (tag(tag:No Costume == ON) then
   costumeless
   
   ) else (
   
   if (which == 1) then (player treat)
   if (which == 2) then (player trick)


Unfortunately HSpeak is pretty stupid when it comes to noticing and reporting errors: there are lots of mistakes in this script that it should have noticed first. Firstly, there's no command named "tag", you meant to use "check tag". Secondly, the "==ON" should be outside the checktag, like this: "checktag(tag:No Costume)==ON", or left out altogether: "checktag(tag:No Costume)". Thirdly, there should be two ')'s before 'then', to match the two '('s on the line. Next, you forgot the '(' after 'then', and finally you forgot the final ')' after the final statement of the 'else' block.

To place a number in a string, do:
Code:
$3 = ""
append number (3, candy)

Or you could just make 'candy' a global variable, and use "${V#}" in your textbox instead.
Metal Slime
Send private message
 
 PostTue Oct 18, 2011 2:19 am
Send private message Reply with quote
Wow, that's 100 ohr-ers! Wonder how many are still active, quickly counting... maybe 27?

EDIT

As an aside:

My mouse is having trouble holding a click, which causes turbo clicking sometimes. I was able to double post with a single click of one button. How does that work?
Metal Slime
Send private message
 
 PostTue Oct 18, 2011 3:23 am
Send private message Reply with quote
Quote:
if (name == 28) then ($1= "FnnrfYgmSchnish")


You spelled "Fnrrf" wrong.
FYS:AHS -- Swapping out some step-on NPCs for zones + each step script
Puckamon -- Not until the reserve party is expanded.[/size]
Slime Knight
Send private message
Re: Trick's over Treats...! 
 PostTue Oct 18, 2011 8:15 am
Send private message Reply with quote
Code:

   if (name == 19) then ($1= "Neospade")


This line right here is the problem. NeoSpade is wrote the same way NeoBahamut is wrote in FF7. :P

Also I'm not quite sure about this, but I think you need to add an else after each entry, because they're all different cases.

Code:

       if (name == 19)
       then ($1 = "NeoSpade")
       else
       if (name == 20)
       then ($1 = "Voltire")
       else
       ...
       if (name == 100)
       then ($1 = "ChaosNyte")
       else
       end
 end


While this isn't the reason it isn't compiling, might I also add that the random function is only accounting for the first 71 users.

I hate to do this but, I wrote an article for HamsterSpeak 39 that covers changing NPCs into a different character, just change the alter NPC commands into set hero palette and set hero picture and you're all set.
Metal Slime
Send private message
 
 PostTue Oct 18, 2011 2:26 pm
Send private message Reply with quote
No need for else's since "name" can't be more than one value at a time. Unless the script is causing some slow down since it is having to check 100 if checks every time. If that's the case, Neospade's setup won't help; you'd technically need opening parentheses for each 'else', and then 100 closing parentheses at the end. This would be a job for a switch/case statement.

Also, there's something wonderful about seeing a post that is nothing but telling someone that they spelled "Fnrrf" wrong.
I am Srime
Liquid Metal Slime
Send private message
 
 PostTue Oct 18, 2011 2:41 pm
Send private message Reply with quote
For the love of god, change that giant list of users to a switch. I know it seems like work, but trust me, you'll thank me for this down the road. Nesting a billion if statements like you have is a recipe for disaster.

If you don't know how, here's how:

Code:

switch(name)  #The variable being investigated
do(
     case(1) do ($1= "Master K")
     case(2) do ($1= "JSH")
     #And so on...

     #Note that you can also make 2 cases do the same thing
     case(5)
     case(6) do($1 = "Nathan Karr") # Both 5 and 6 would yield Nathan
)



See how much easier it is? Accomplishes the same thing.[/code]
My website, the home of Motrya:
http://www.jshgaming.com
Slime Knight
Send private message
 
 PostTue Oct 18, 2011 5:00 pm
Send private message Reply with quote
D'ah! Why did I totally forget about switch statements! ;_; I knew there was an easier way to do it.
[/fail]
King Slime
Send private message
 
 PostTue Oct 18, 2011 6:00 pm
Send private message Reply with quote
Quote:
Wow, that's 100 ohr-ers! Wonder how many are still active, quickly counting... maybe 27?


I searched through Game Discussion Topics, Game postings, and some came from the top of my head. Have fun trying to spot every name ingame.

The way it works is, if you get treat, then you get a comment from the person in the house. $1 is going to be the name of the person in the house, so it is possible to have 100 different people giving you candy, and random amounts of it, too.

I'm trying to add as many comments from house owners as I can.

Quote:
You spelled "Fnrrf" wrong.


Pick, pick, pick! I'll fix that when I get the chance.

Quote:
This line right here is the problem. NeoSpade is wrote the same way NeoBahamut is wrote in FF7. :P


I'll fix that as well.

@JSH: So, instead of having "If (name == 1)" I would have what you have for every name?
Liquid Metal Slime
Send private message
 
 PostTue Oct 18, 2011 6:04 pm
Send private message Reply with quote
Yes. Trust me, it saves a ton of work in the end and you'll be using switches constantly once you get used to them. Much less to keep track of. There are still cases where you'll need if/then/else, but in a situation like this it's very easy to set up as a switch.
My website, the home of Motrya:
http://www.jshgaming.com
Super Slime
Send private message
 
 PostTue Oct 18, 2011 6:36 pm
Send private message Reply with quote
Switches are exactly equivalent to big if..then blocks, but much easier to read.

Also, I did not know you could fall through the cases in HS and I feel stupid and relieved at the same time.
Mega Tact v1.1
Super Penguin Chef
Wizard Blocks
Liquid Metal King Slime
Send private message
 
 PostTue Oct 18, 2011 7:46 pm
Send private message Reply with quote
Mogri wrote:
Also, I did not know you could fall through the cases in HS and I feel stupid and relieved at the same time.


I didn't know about that feature either :)

I do know that the "continue" command causes a case block to flow on to the next one. I am guessing a case with no do() automatically gets an implicit do(continue) ...but I haven't looked at the implementation to be sure.
Metal King Slime
Send private message
 
 PostTue Oct 18, 2011 10:52 pm
Send private message Reply with quote
I'm going to have to disagree with JSH. Nesting lots of if's is terrible, but in this script there are no nested if's. Replacing all those ifs with a switch block doesn't really gain you much unless you want to make some names more likely than others. Not that it's a mistake: use switch next time.

It's true that switch is faster than a long list of ifs, but it's only a constant factor faster because jump tables aren't used. I'd guess they're about three times faster. However, speed is definitely NOT an issue here (HamsterSpeak is slow but nowhere near that slow).

Nope James. This

Code:
     case(5)
     case(6) do($1 = "Nathan Karr") # Both 5 and 6 would yield Nathan


is not fall through. It's just another way of writing

Code:
    case(5, 6) do($1 = "Nathan Karr") # Both 5 and 6 would yield Nathan


As James mentioned, continue causes real fall through, like in C. For example, you could implement a limited version of the ^ exponent operator like this:

Code:
script, exponent, n, power, begin
  variable (result)
  result := 1
  switch (power) do (
    case (6) do (result *= n, continue)
    case (5) do (result *= n, continue)
    case (4) do (result *= n, continue)
    case (3) do (result *= n, continue)
    case (2) do (result *= n, continue)
    case (1) do (result *= n)
  )
  return (result)
end
Display posts from previous: