Jump to content
  • 0

Anyone want to make Roulette script?


Peopleperson49

Question


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

I had a PM request (still perfer people just use the forums for requests as intended) to make a roulette game. Since games are my speciality I'm going to do it anyway. I'm not talking about the rock, paper, scissors roulette. A real roulette game. So I put this challenge out to the other great scripters here such as Annie, Euphy, GMOcean, Emistry, Xantara, or anybody else interested (including KeyWorld). Now its a bit unfair because I do specialize in these type of scripts, but lets see what we can all do with it! Either way I'm going to start working on mine tomorrow, so if you interested please post and let me know.

I in a week if somebody has submitted something along with mine I will post them here and let people vote on it. An actual voting topic would be nice (if somebody else wants to make one), but I have no clue on how to make those. This is intended to be for the players so overall coding isn't as important as realism, detail, game play, dialog formatting. Basically what ever makes it fun and interesting to play. Thanks to goddameit for the link. Roulette Wiki

Peopleperson49

------------------------------------------------------------------------------------------------------------------

Submitted Scripts:

Peopleperson49 roulette script found here under Roulette.rar.

Edited by Peopleperson49
Link to comment
Share on other sites

Recommended Posts


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

Posted (edited) · Hidden by AnnieRuru, December 8, 2012 - moderated
Hidden by AnnieRuru, December 8, 2012 - moderated

all flaming post has moderated

EDIT: tomorrow I also hide these 2 posts

EDIT2: also change the topic title ...

Edited by AnnieRuru
Link to comment

  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

I can post mine tonight or I wont be able to post it till tomorrow evening after I get out of work. Anybody else want to post tonight so its there for voting on Monday? Also how are we coordinating all the scripts from each person. It might be easier to put them in our script collections or a download and I put the links in the original topic for you.

Peopleperson49

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

so its there for voting on Monday?
no ****ing voting !

this is not a competition

Also how are we coordinating all the scripts from each person.
when anyone of us done the script, just make a reply -> I have done this script ...

PS : ... I haven't even start =/ though I might finish this one quite fast

script request is just a training area or playground for scripters so that we can learn other scripter's technique ... sigh ...

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

Thank you for the pm, I didn't see your edit :P

So now we can comment your script and try to improve it !

So here a list...

  1. Please don't use inline switch() / if(), it's not user-friendly to read and add comments :P
  2. Try to don't put "str" in a numerical variable, it can confuse :
    input .@StrPick;


  3. Code before a goto is NEVER execute, so you can remove all your close/end after a goto.
  4. In the start of your script, we have:
    set .RBet,select(.@RouletteMenu$);

    You are using a global NPC variable .RBet and use it after some next and menu. Problem ? Each time someone talk to the npc will reset everyone choice. So replace it by a player variable or scope variable should be a good choice.

  5. Some part can really be rewrite to reduce lines of code, like the huge switch() + goto part, it can be replace by an array...
  6. Do you really need to store the choice in permanent variable ? (getd("Bet_"+.@i+"$")). Should be better to use an @array$[].

Well I will try to make mine, but not have time today :(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

EDIT: Ops, didn't see the EDIT on first post, my bad.

Some part can really be rewrite to reduce lines of code, like the huge switch() + goto part, it can be replace by an array...

Not only it reduces the number of lines of the script, but it seriously reduce the compiletime and the runtime of that script.

EDIT 2:

Lemme criticize the script a little bit, showing some errors or optimizations that can be easily done:

mes "Welcome to Casino Roulette!";
goto RouletteStart;
close;

RouletteStart:

Totally useless goto. If the script falls into a label line, it just starts to run it.

Easy optimization:

mes "Welcome to Casino Roulette!";

Roulette Start:

    switch(rand(0,36)) { case 0: goto Slot00; case 1: goto Slot01; case 2: goto Slot02; case 3: goto Slot03; case 4: goto Slot04; case 5: goto Slot05; case 6: goto Slot06; case 7: goto Slot07; case 8: goto Slot08; case 9: goto Slot09; case 10: goto Slot10; case 11: goto Slot11; case 12: goto Slot12; case 13: goto Slot13; case 14: goto Slot14; case 15: goto Slot15; case 16: goto Slot16; case 17: goto Slot17; case 18: goto Slot18; case 19: goto Slot19; case 20: goto Slot20; case 21: goto Slot21; case 22: goto Slot22; case 23: goto Slot23; case 24: goto Slot24; case 25: goto Slot25; case 26: goto Slot26; case 27: goto Slot27; case 28: goto Slot28; case 29: goto Slot29; case 30: goto Slot30; case 31: goto Slot31; case 32: goto Slot32; case 33: goto Slot33; case 34: goto Slot34; case 35: goto Slot35; case 36: goto Slot36; }
   end;
   WheelSpin:
   Slot00: cutin "RouletteWheel0",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"0","3","4","3","3","4","RouletteWheel0","green"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot32: cutin "RouletteWheel32",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"32","1","2","1","1","3","RouletteWheel32","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot15: cutin "RouletteWheel15",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"15","2","3","2","2","2","RouletteWheel15","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot19: cutin "RouletteWheel19",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"19","1","1","1","2","2","RouletteWheel19","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot04: cutin "RouletteWheel04",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"4","2","1","2","1","1","RouletteWheel04","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot21: cutin "RouletteWheel21",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"21","1","3","1","2","2","RouletteWheel21","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot02: cutin "RouletteWheel02",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"2","2","2","2","1","1","RouletteWheel02","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot25: cutin "RouletteWheel25",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"25","1","1","1","2","3","RouletteWheel25","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot17: cutin "RouletteWheel17",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"17","2","2","2","2","2","RouletteWheel17","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot34: cutin "RouletteWheel34",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"34","1","1","1","1","3","RouletteWheel34","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot06: cutin "RouletteWheel06",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"6","2","3","2","1","1","RouletteWheel06","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot27: cutin "RouletteWheel27",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"27","1","3","1","2","3","RouletteWheel27","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot13: cutin "RouletteWheel13",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"13","2","1","2","2","2","RouletteWheel13","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot36: cutin "RouletteWheel36",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"36","1","3","1","1","3","RouletteWheel36","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot11: cutin "RouletteWheel11",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"11","2","2","2","2","1","RouletteWheel11","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot30: cutin "RouletteWheel30",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"30","1","3","1","1","3","RouletteWheel30","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot08: cutin "RouletteWheel08",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"8","2","2","2","1","1","RouletteWheel08","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot23: cutin "RouletteWheel23",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"23","1","2","1","2","2","RouletteWheel23","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot10: cutin "RouletteWheel10",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"10","2","1","2","1","1","RouletteWheel10","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot05: cutin "RouletteWheel05",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"5","1","2","2","2","1","RouletteWheel05","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot24: cutin "RouletteWheel24",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"24","2","3","1","1","2","RouletteWheel24","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot16: cutin "RouletteWheel16",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"16","1","1","2","1","2","RouletteWheel16","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot33: cutin "RouletteWheel33",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"33","2","3","1","2","3","RouletteWheel33","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot01: cutin "RouletteWheel01",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"1","1","1","2","2","1","RouletteWheel01","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot20: cutin "RouletteWheel20",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"20","2","2","1","1","2","RouletteWheel20","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot14: cutin "RouletteWheel14",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"14","1","2","2","1","2","RouletteWheel14","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot31: cutin "RouletteWheel31",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"31","2","1","1","2","3","RouletteWheel31","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot09: cutin "RouletteWheel09",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"9","1","3","2","2","1","RouletteWheel09","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot22: cutin "RouletteWheel22",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"22","2","1","1","1","2","RouletteWheel22","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot18: cutin "RouletteWheel18",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"18","1","3","2","1","2","RouletteWheel18","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot29: cutin "RouletteWheel29",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"29","2","2","1","2","3","RouletteWheel29","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot07: cutin "RouletteWheel07",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"7","1","1","2","2","1","RouletteWheel07","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot28: cutin "RouletteWheel28",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"28","2","1","1","1","3","RouletteWheel28","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot12: cutin "RouletteWheel12",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"12","1","3","2","1","1","RouletteWheel12","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot35: cutin "RouletteWheel35",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"35","2","2","1","2","3","RouletteWheel35","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot03: cutin "RouletteWheel03",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"3","1","3","2","2","1","RouletteWheel03","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   Slot26: cutin "RouletteWheel26",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"26","2","2","1","1","3","RouletteWheel26","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50;
   if(.@TotalCount<.@TotalBounce) { goto WheelSpin; close; }

This whole part can be easily replace with a fuction, that makes the script cleaner, easier to read, faster to compile and faster to run.

.@RouletteDetails$ variable can be really omitted as all the information it stores can be retrieve from pre-set variables you should have initialize throgh OnInit or similar.

You are abusing of "atoi" command a little bit too much. Atoi basically uses a stringstream based on bitmasks, that needs really too many checks to run. It's a nice command, used a lot, but not to abuse of. It can slow down everything, other then easily break up into some weir errors about converting not-numeric strings.

Just create an integer array, and if you need to pass the number to a string (I really don't see why you should put numbers into strings), just use a normal set.

set .@string$, "" + .@integer;

All the other problems were shown by Key-kun, so I didn't really explained details about that as he owned the theory.

Edited by Ryokem
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

@Ryoken

hMDyk.png

inside post#1 or.... script release section

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

Thanks for the eval KeyWorld. Overall was it a fun script? I will refine it and continue to improve it. It was pointed out that the game was impossible to make fun because it was a dialog based game, so I went away from that and made it use cutins. That wasn't all that bad compared to the hundreds of cutins for my multiplayer texas holdem script I made!

1) I'm not sure what you means its not user friendly to use switch/if.

2) I can easily change .@StrPick to any variable I need to, but it doesn't affect the overall operation of the script.

3) Good point on removing the end and close. I just alway format in a consistant manner and seem to put them like that. Same with me and taking the spaces out of if ( and etc...

4) Replaced .@RouletteMenu$ with @RouletteMenu$. Nice catch.

5) I could reduce some code by optomizing "switch(rand(0,36)) { case 0: goto Slot00; case 1: goto Slot01; case 2: go with a array". I will change that later when I get a chance.

6) The idea there was that if the character closed out of the script they could still go back in it and still have all the same bets and info. I need to test this script with multiple characters playing and see how it works out. I must confess it only speant about 4 hours total working on it and didn't do much testing of it. I can change that easy.

Peopleperson49

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

@Ryoken

hMDyk.png

inside post#1 or.... script release section

Yeah LOL, I noticed it too late, just right after posting the message.

Updated Post#20 anyway :3

EDIT:

Thanks for the eval KeyWorld. Overall was it a fun script? I will refine it and continue to improve it. It was pointed out that the game was impossible to make fun because it was a dialog based game, so I went away from that and made it use cutins. That wasn't all that bad compared to the hundreds of cutins for my multiplayer texas holdem script I made!

Yeah, the idea itself is pretty nice, just you have to work out about how to structure it to optimize your code.

Edited by Ryokem
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  71
  • Reputation:   25
  • Joined:  11/23/11
  • Last Seen:  

I made a roulette script last year, it was based on npc mobs (never readed the rules of the real casino's roulette, so I made it "custom".)

I have it here: removed for now.

Maybe this can be off-topic... (I'm lazy to translate to english, it's just to show how it works.)

Edited by Omnipotent
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

Not bad Omnipotent, love the way you do/code it (I don't have an emu but I can see the way it should like with the code) :)

Just one possible bug (but it's a one year old npc):

- Player A (and C,D,E,F,G,...) run the game and wait at "close2".

- Player B run the game, start the roulette.

- Player A (and C,D,E,F,G...) press the "close2".

Result: the roulette will have some fun :P

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

Omnipotent I can break down the scripting, but is their any chance you can translate that into english? Either way I will give it a try when I get home. Thanks for submitting!

Peopleperson49

Edited by Peopleperson49
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

@keyworld,

kinda don't think its possible

it has been countered with $@ruleta_st variable

    close2 ;
   if ( .@s == 3 || zeny < 5000 || $@ruleta_st )

@Peopleperson49

try use google translator to translate his script

not very accurate translation ... but I can understand what that script does from the translations

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

Oh i didnt see it , have to buy some new glasses lol

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  71
  • Reputation:   25
  • Joined:  11/23/11
  • Last Seen:  

I translated it (I dunno if it's a good translation, though): removed for now.

Edited by Omnipotent
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

Thanks Omnipotent. I could see where you were going with the scripting, but I just couldn't seem to figure out all the dialog. I never even considered a translator though, never worked out for me in the past. They are probably more advanced now. How is your script coming Annie? I am expecting great things!

Peopleperson49

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...